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 plugin doesn't fully work if using workspace typescript version #169

Closed
ananni13 opened this issue May 3, 2021 · 3 comments
Closed
Labels
enhancement New feature or request

Comments

@ananni13
Copy link

ananni13 commented May 3, 2021

If I set VSCode to use the workspace version of typescript instead of its own (> TypeScript: Select TypeScript version... -> Use Workspace Version) and remove the *.d.ts file, it shows this error even with Volar TS plugin enabled:

ts_error
Cannot find module './App.vue' or its corresponding type declarations. ts(2307)

The error goes away if I set > TypeScript: Select TypeScript version... -> Use VS Code's Version

Is this intended?

If you need a repo to test it, I created a clean one here (it's just the @vitejs/create-app vue-ts preset) with the shims-vue.d.ts file commented out: https://github.com/ananni13/volar-ts-test

@johnsoncodehk
Copy link
Member

johnsoncodehk commented May 5, 2021

Thanks for your repro case!

VSCode using built-in TS library by default, and VSCode provide typescriptServerPlugins contribute point to allow VSCode extension setup a TS plugin for built-in TS library.

VSCode extension can't setup a TS plugin for workspace TS library, so when you using workspace TS version, you need to config the Volar TS plugin to workspace tsconfig.json plugins option. UPDATE: it can, see https://github.com/johnsoncodehk/volar/blob/7804f2fbff233583f2dda360d74054576e814e94/package.json#L400.

But I have not released Volar TS plugin to npm so you can't do that yet. 😅

@johnsoncodehk
Copy link
Member

Published in 0.25.3: https://www.npmjs.com/package/typescript-vue-plugin

@productdevbook
Copy link
Contributor

productdevbook commented Jun 8, 2021

Published in 0.25.3: https://www.npmjs.com/package/typescript-vue-plugin

tsconfig.json added or no add ? which one should i do

 "plugins": [
      {
        "name": "typescript-eslint-language-service"
      },
      {
        "name": "typescript-vue-plugin"
      }
    ],

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

3 participants