You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I cannot get the following code to work, but i think this should work according to the new feature. Code
import*asReactfrom'react';import*asReactDOMfrom'react-dom';interfaceTestProps{children: string|JSX.Element;}constFoo=(props: TestProps)=><div>{props.children}</div>;// Error on FooReactDOM.render(<Foo><div>Test</div></Foo>,document.getElementById('content'),);
Expected behavior:
No Errors
Actual behavior:
I get the following error on compilation:
TestTsxChildren>tsc--versionVersion2.3.2TestTsxChildren>tscmain.tsx(11,5): error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes&TestProps'.Type'{}'isnotassignabletotype'TestProps'.Property'children'ismissingintype'{}'.
I hope you can tell me, what i am dooing wrong or maybe i missunderstood the new feature.
The text was updated successfully, but these errors were encountered:
Thanks @VSDekar for report an issue. This error happens because the accompany react DTS is not updated. I have updated the DTS (DefinitelyTyped/DefinitelyTyped#16327) once that is merged, please update your react type files.
TypeScript Version: 2.3.2
I am struggeling with the new JSX
children
checking feature. I have already asked on Stackoverflow - TypeScript type checking JSX children but no answers so far, thats why i am asking here.I cannot get the following code to work, but i think this should work according to the new feature.
Code
Expected behavior:
No Errors
Actual behavior:
I get the following error on compilation:
I hope you can tell me, what i am dooing wrong or maybe i missunderstood the new feature.
The text was updated successfully, but these errors were encountered: