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

TS: defineComponent returns incorrect type #730

Closed
jods4 opened this issue Feb 16, 2020 · 1 comment · Fixed by #822
Closed

TS: defineComponent returns incorrect type #730

jods4 opened this issue Feb 16, 2020 · 1 comment · Fixed by #822

Comments

@jods4
Copy link
Contributor

jods4 commented Feb 16, 2020

Version

3.0.0-alpha.4

Reproduction link

https://codesandbox.io/s/boring-cerf-fkv0z

Steps to reproduce

In Typescript, use defineComponent to create a component, then try to use it with .component('x-tag', MyComponent).

What is expected?

TS should compile (it does run).

What is actually happening?

There is a type error at compilation.


The problem seems to be that defineComponent is lying about its return type. It says that it returns a constructor, which is not true since it is mostly a noop (it returns its parameter directly, which is an object).

createApp accepts this because it seems to accept constructors in addition to components. But .component() does not.

@jods4
Copy link
Contributor Author

jods4 commented Mar 12, 2020

@yyx990803 It's still broken in alpha.8.

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

Successfully merging a pull request may close this issue.

1 participant