When calling functions with object arguments, extra keys are forbidden:
function foo({ key }) {}
foo({ key: 1, key2: 2 });
Argument of type '{ key: number; key2: number; }' is not assignable to parameter of type '{ key: any; }'.
Object literal may only specify known properties, and 'key2' does not exist in type '{ key: any; }'
However, with React functional components, this error doesn't trigger:
function Foo({
obj: { key },
}) {}
<Foo obj={{ key: 1, key2: 2 }} />
Is there a way to make this an error?