-
Notifications
You must be signed in to change notification settings - Fork 12.8k
JSX Not validating when index signature is present #10265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The interpreted intent of the index signature is to allow arbitrary extra properties. Otherwise there would be no way to represent a component that accepted any property names. |
@RyanCavanaugh thanks for the quick response. I guess I'm confused - shouldn't the index signature allow any additional properties with Maybe I am misunderstanding the docs but for the following example:
the docs say that: Doesn't that mean that the types for Also, when I tested this in the TS playground using normal functions the primaryText was checked to be a string. |
Sorry, I totally misread your original post. Rereading/investigating |
Yeah this is very much supposed to be an error. Thanks for following up! |
TypeScript Version: 2.0
Code
Expected behavior:
In VerticalNav I have the child component:
<VerticalNavMenuItem primaryText={2} />
This should throw a type error because primary text must be a string.
However, if I remove
[propName: string]: any
from IProps then the type error will be thrown.Actual behavior:
No error is thrown.
The text was updated successfully, but these errors were encountered: