Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types: h doesn't accept Component with props #3218

Closed
KaelWD opened this issue Feb 10, 2021 · 0 comments · Fixed by #3219
Closed

types: h doesn't accept Component with props #3218

KaelWD opened this issue Feb 10, 2021 · 0 comments · Fixed by #3219

Comments

@KaelWD
Copy link
Contributor

KaelWD commented Feb 10, 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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants