-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: JSX/TSXRelates to the JSX parser and emitterRelates to the JSX parser and emitter
Milestone
Description
TypeScript Version: 3.2.2
Search Terms:
excess property jsx
Code
function Foo(props: { x: { foo: number } }) {
return null;
}
Foo({ x: { foo: 42, bar: 'hello' } }); // <-- correctly has error
<Foo x={{ foo: 42, bar: 'hello' }} />; // <-- incorrectly has no error
Expected behavior:
Both of the last 2 lines should exhibit an excess property error.
Actual behavior:
Only the first line does.
Related Issues:
It's also the case that
React.createElement(Foo, { x: { foo: 42, bar: 'hello' } });
fails to produce the error, however by tweaking the type of createElement
in @types/react
I'm able to fix that. So #14729 seems related, in that, if the JSX type checking were based on createElement
's type, this issue could be fixed by fixing @types/react
.
eps1lon, jmca, ssynix, henri-hulski and levenleven
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: JSX/TSXRelates to the JSX parser and emitterRelates to the JSX parser and emitter