What does the error “JSX element type '…' does not have any construct or call signatures” mean?

后端 未结 13 2254
余生分开走
余生分开走 2020-11-28 02:05

I wrote some code:

function renderGreeting(Elem: React.Component) {
    return Hello, !;
}
         


        
13条回答
  •  迷失自我
    2020-11-28 02:40

    The following worked for me: https://github.com/microsoft/TypeScript/issues/28631#issuecomment-472606019 I fix it by doing something like this:

    const Component = (isFoo ? FooComponent : BarComponent) as React.ElementType
    

提交回复
热议问题