Subscribe on changes!

types: h doesn't accept Component with props

avatar
Feb 10th 2021

Version

3.0.5

Reproduction link

https://codesandbox.io/s/blissful-sun-gqg87

Steps to reproduce

Try to compile h(comp as Component, { id: 'ok' }) or h(comp as Component<{ id: string }>, { id: 'ok' })

What is expected?

Should compile

What is actually happening?

Type 'ComponentOptions<...>' is not assignable to type 'ComponentPublicInstanceConstructor<...>


A test was created for #922 but the case with props has // @ts-expect-error

Component should behave the same as DefineComponent and FunctionalComponent:

  • Allow extraneous props
  • Require non-optional props if Props is provided

Probably related: TSX throws TS2604: JSX element type 'component' does not have any construct or call signatures. if you try to use a Component with it.