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

v8 type error when register components in Options #441

Closed
zhangtaoBqteam opened this issue Aug 22, 2020 · 9 comments · Fixed by vuejs/core#1943
Closed

v8 type error when register components in Options #441

zhangtaoBqteam opened this issue Aug 22, 2020 · 9 comments · Fixed by vuejs/core#1943

Comments

@zhangtaoBqteam
Copy link

when i resgister components in Options, the type error occurs: Type 'typeof xxx' is not assignable to type 'Component'.
Here is the type error:
image
the child component
image
the global declaration of *.vue file
image

@ktsn
Copy link
Member

ktsn commented Aug 22, 2020

Try this in vue-shim.d.ts.

declare module '*.vue' {
  import { ComponentOptions } from 'vue'
  const _default: ComponentOptions
  export default _default
}

@ktsn ktsn closed this as completed Aug 22, 2020
@zhangtaoBqteam
Copy link
Author

Try this in vue-shim.d.ts.

declare module '*.vue' {
  import { ComponentOptions } from 'vue'
  const _default: ComponentOptions
  export default _default
}

Ok, thks

@zhangtaoBqteam
Copy link
Author

zhangtaoBqteam commented Aug 22, 2020

sorry, i have tried, but the error still exists
image

@syphzur
Copy link

syphzur commented Aug 22, 2020

Try this in vue-shim.d.ts.

declare module '*.vue' {
  import { ComponentOptions } from 'vue'
  const _default: ComponentOptions
  export default _default
}

i've got the same problem, unfortunately that didn't help

@ktsn
Copy link
Member

ktsn commented Aug 23, 2020

Please provide a self-contained reproduction to confirm. Thanks.
About reproduction

@ktsn
Copy link
Member

ktsn commented Aug 23, 2020

In any case, it doesn't actually relate to vue-class-component as you do not use its typings but from the shim type. You may want to try it without vue-class-component and report to vue-next repo if it's still a problem for you.

@dodiwahyu
Copy link

In my case this happens when i try using @options for register component in Vue 3 with TypeScript.
Screen Shot 2020-08-23 at 11 51 48 AM
Screen Shot 2020-08-23 at 11 52 00 AM

@syphzur
Copy link

syphzur commented Aug 23, 2020

Please provide a self-contained reproduction to confirm. Thanks.
About reproduction

https://github.com/syphzur/vue-ts-issue

@ktsn
Copy link
Member

ktsn commented Aug 23, 2020

It's upstream type issue. vuejs/core#1943

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

Successfully merging a pull request may close this issue.

4 participants