lazy produces TypeScript error: JSX element type 'Component' does not have any construct or call signatures
#3219
Labels
JSX element type 'Component' does not have any construct or call signatures
#3219
Describe the bug
As of 10.5.14 code like the following:
may begin to error with:
TS2604: JSX element type 'MyComponent' does not have any construct or call signatures
#3139 changed the type of
lazy
as follows:From what I can tell, in the above code fragment, TypeScript tries to infer the type of
T
by matching the return value of the function against the newly addedT
instead of{ default: T }
and hence resolves the return type oflazy
as{ default: React.FunctionComponent<Props> }
notReact.FunctionComponent<Props>
as it previously did.For the time being it seems possible to work around this by explicitly providing the generic type parameter such as follows:
The text was updated successfully, but these errors were encountered: