reactjs - some incompatible instantion of Props -
why not work:
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:
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
Post a Comment