-
Notifications
You must be signed in to change notification settings - Fork 122
Typings for Nuxt callbacks don't apply for Component Classes #83
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
Comments
I'm facing the same issue here, and I'm trying to fix this by adding Take a look here : nuxt/nuxt#5330 and here https://codesandbox.io/s/6l91r3qn5z |
I’ve tried using nuxt-property-decorator but it didn’t make a difference for me as I believe the problem is the typings from @nuxt/types aren’t being included for some reason.
… On 23 Aug 2019, at 7:08 pm, Michel EDIGHOFFER ***@***.***> wrote:
I'm facing the same issue here, and I'm trying to fix this by adding nuxt-property-decorator (repo). By this way, typing is provided.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Sorry but this isn't and won't be supported around here. Usage of Nuxt functions inside class are only supported with That's why I'm not a fan of it and I would recommend using You can try open an issue around Also see further notes around #58 |
Thanks for the comment.
Can you provide any pointers on the recommended way of using Nuxt hooks?
I must misunderstand the toes as I thought @nuxt/types extended ‘Vue’ and hence made ‘asyncData’ available in a class that implements ‘Vue’
… On 23 Aug 2019, at 7:31 pm, Kevin Marrec ***@***.***> wrote:
Sorry but this isn't and won't be supported around here.
Usage of Nuxt functions inside class are only supported with nuxt-property-decorator, cause they are registering hooks that make functions available.
See https://github.com/nuxt-community/nuxt-property-decorator/blob/master/lib/nuxt-property-decorator.umd.js#L10
That's why I'm not a fan of it and I would recommend using vue-property-decorator and use asyncData in component options to have proper type checking.
You can try open an issue around nuxt-property-decorator.
Also see further notes around #58
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@jmannau |
Describe the bug
I have set up a new Nuxt 2.9 app using nuxt/typescript 0.1.10. I have tried to use the @component decorator for .vue Pages. The typings for asyncData and other Nuxt properties aren't being picked up. I have replicated this using the minimal Component Class sandbox.
To Reproduce
Steps to reproduce the behavior:
ctx
parameter ofasyncData
has an implicit any typeExpected behavior
From my understanding of the project, https://github.com/nuxt/typescript/blob/master/packages/types/app/vue.d.ts#L12 asyncData should be available as either a component option used in the
@Component
decorator or in the component classThe text was updated successfully, but these errors were encountered: