Closed
Description
TypeScript Version: 2.0
Code
interface IProps {
primaryText: string,
[propName: string]: any
}
function VerticalNavMenuItem(props: IProps) {
return <div>props.primaryText</div>
}
function VerticalNav() {
return (
<div>
<SOME_JSX />
<VerticalNavMenuItem primaryText={2} />
</div>
)
}
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.