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
Cannot call `React.lazy` with function bound to `component` because in the return value:
- Either a callable signature is missing in `Promise` [1] but exists in `React.StatelessFunctionalComponent` [2].
- Or `Promise` [1] is incompatible with statics of `React.Component` [3].
React.lazy takes a function that must call a dynamic import(). This must return a Promise which resolves to a module with a default export containing a React component.
The type here is wrong. Your type is right. Want to put up a PR?
@alexeyraspopov: Yes, but that's a very disruptive and breaking change. We certainly should change the name, but we should have a codemod ready to go along with the release.
Activity
jbrown215 commentedon Nov 28, 2018
@bvaughn: Mind helping out here?
Is it always meant to render a
{default: React$ComponentType<P>}from an export?jbrown215 commentedon Nov 28, 2018
Ah, from the react docs:
The type here is wrong. Your type is right. Want to put up a PR?
bvaughn commentedon Nov 28, 2018
I'd be happy to add this change to my PR if it's easier for everyone.
nicholas-l commentedon Nov 28, 2018
@bvaughn yes, go for it :)
alexeyraspopov commentedon Nov 28, 2018
Also, "StatelessFunctionalComponent" seems to be using the old terminology. I guess we can change it to "FunctionComponent", right?
jbrown215 commentedon Nov 28, 2018
@alexeyraspopov: Yes, but that's a very disruptive and breaking change. We certainly should change the name, but we should have a codemod ready to go along with the release.
[-]Flow error when returning Promise in React.lazy[/-][+]React.lazy has an incorrect type definition[/+][PR] Add React.Suspense component, remove React.useMutationEffect hook