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

Missing Nuxt types in Vue 2 + Nuxt + Options API project #1337

Closed
rchl opened this issue May 23, 2022 · 1 comment
Closed

Missing Nuxt types in Vue 2 + Nuxt + Options API project #1337

rchl opened this issue May 23, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@rchl
Copy link
Collaborator

rchl commented May 23, 2022

I've set up a project at https://github.com/rchl/volar-vue2-test where the pages/index.vue is using Nuxt-specific asyncData component option. The argument to that option is Nuxt Context:

  async asyncData(context) {
    context.redirect('https://google.com');
  },

The issue is that context is not typed.

@nuxt/types, which extends component types, is included in tsconfig.json types array and also the following volar-specific options are enabled:

  "vueCompilerOptions": {
    "experimentalCompatMode": 2,
    "experimentalImplicitWrapComponentOptionsWithDefineComponent": true,
    "experimentalTemplateCompilerOptions": {
      "compatConfig": { "MODE": 2 } // optional
    }
  }

and also:

  "compilerOptions": {
    "jsx": "preserve",
  },
@johnsoncodehk
Copy link
Member

johnsoncodehk commented Jul 16, 2022

Please use experimentalImplicitWrapComponentOptionsWithVue2Extend instead of in v0.38.6.

  "vueCompilerOptions": {
    "target": 2,
    "experimentalImplicitWrapComponentOptionsWithVue2Extend": true
  }

@johnsoncodehk johnsoncodehk added enhancement New feature or request and removed pending triage labels Jul 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants