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
The code above is for lazy-loading a React component. I would expect the resulting MyComponent to have its props inferred from the props of the component at './MyComponent'.default.
Actual behavior:
The above compiles without errors and will behave as expected, but the props of the resulting component are inferred to {} instead of the actual props. The type parameter T is inferred correctly to the component type in the other module, but the type parameter P is not inferred to the props of T.
I believe it may have something to do with the fact that type parameter P of React.ComponentType<P> has a default value of {}. How do I get it to infer the actual type without having to explicitly specify the parameter?
Additionally, I can't get the first line of render() to work without the cast to React.ComponentType. The next line says that the type T is not callable.
The text was updated successfully, but these errors were encountered:
TypeScript Version: 2.6.2
Code
Expected behavior:
The code above is for lazy-loading a React component. I would expect the resulting
MyComponent
to have its props inferred from the props of the component at'./MyComponent'.default
.Actual behavior:
The above compiles without errors and will behave as expected, but the props of the resulting component are inferred to
{}
instead of the actual props. The type parameterT
is inferred correctly to the component type in the other module, but the type parameter P is not inferred to the props ofT
.I believe it may have something to do with the fact that type parameter
P
ofReact.ComponentType<P>
has a default value of{}
. How do I get it to infer the actual type without having to explicitly specify the parameter?Additionally, I can't get the first line of
render()
to work without the cast toReact.ComponentType
. The next line says that the typeT
is not callable.The text was updated successfully, but these errors were encountered: