Open ghost opened 5 years ago
That.... shouldn't work. It should never have typechecked - a function that returns a component (or an instance of a component) is not a jsx element. React even has a warning for this at runtime nowadays:
Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.
Those tests just straight up contain invalid react code that should never have typechecked correctly and won't work at runtime.
We would need this issue to avoid invalid React code, right? https://github.com/Microsoft/TypeScript/issues/26182
TypeScript Version: 3.2.0-dev.20181103
Code
Expected behavior:
No error, as in ts3.1.
Actual behavior:
Discovered in
react-helmet/v4
andreact-flag-icon-css
on DefinitelyTyped. Thereact-flag-icon-css
variation is more like: