reactjs - some incompatible instantion of Props -


why not work:

try flow!

function mergetheme<props: {}, t: {}>(   component: react.componenttype<{ theme: t } & props>,   injectedtheme: t ): react.componenttype<{ theme: t } & props> {   const themed = (props: { theme: t } & props) => {       let theme: t = injectedtheme;       return <component {...props} theme={theme} />;   };   return themed; } 

the error:

11:         return <component {...props} theme={theme} />;                    ^ props of react element `component`. type incompatible 5: function mergetheme<props: {}, t: {}>(    ^ incompatible instantiation of `props` 11:         return <component {...props} theme={theme} />;                    ^ props of react element `component`. type incompatible expected param type of 5: function mergetheme<props: {}, t: {}>(    ^ incompatible instantiation of `props` 

but works:

try flow!

function mergetheme<props: {}, t: {}>(   component: react.componenttype<{ theme: t } & props>,   injectedtheme: t ): react.componenttype<{ theme: t } & props> {   const themed = (props: { theme: t } & props) => {       const baseprops: props = props;       let theme: t = injectedtheme;       return <component {...props} theme={theme} />;   };   return themed; } 

what's difference between two? how first 1 work?


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -