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

Update Typescript used to 3.7.2 #4811

Closed
ziazon opened this issue Nov 7, 2019 · 6 comments
Closed

Update Typescript used to 3.7.2 #4811

ziazon opened this issue Nov 7, 2019 · 6 comments

Comments

@ziazon
Copy link

ziazon commented Nov 7, 2019

What problem does this feature solve?

when updating a project to use typescript 3.7.2 which includes optional chaining, the new syntax is not supported in .vue files since it's still using an older version of typescript.

We should not get a syntax error for things like foo?.bar which is a new optional chaining syntax introduced in typescript 3.7.2

What does the proposed API look like?

no linting errors on proper 3.7.4 typescript syntax

@LinusBorg
Copy link
Member

Since you did not produce a reproduction of the problem, I assume the following:

  1. The problem does not happen during compilation
  2. The problem happens in your editor (VSCode)
  3. You are using the Vetur extension for .vue file support.

I think that by default Vetur is using the typescript version that VSCode comes with, not the one you installed in your node_modules.

You can do enable "vetur.useWorkspaceDependencies" (check autocomplete for exact option name) in your vscode settings to tell vetur to always use the version installed in your project.

It seems this is missing from the vetur docs. If this indeed solves your issue, please open an issue in the vetur repository asking for the docs to include this.

@kukoo1
Copy link

kukoo1 commented Nov 8, 2019

@vue/cli-plugin-typescript and ts-loader require typescript as peerDependencies
"typescript": ">=2" for @vue/cli-plugin-typescript
"typescript": "*" for ts-loader

So, the version of tsc used to compile is the version you installed in your project.
In my case, the problem is that I installed typescript as a global package as well.
I upgraded the project typescript, so the global package remained the old version.

yarn global upgrade typescript or npm update -g typescript did solve my problem

@LevYas
Copy link

LevYas commented Nov 11, 2019

It seems that there is nothing to update in vue/cli-plugin-typescript
In my case

  1. VS Code used its own old version of Typescript. I changed it according to this manual https://code.visualstudio.com/docs/typescript/typescript-compiling#_using-newer-typescript-versions
  2. tsconfig.json had in compilerOptions "target": "esnext", I changed it to "target": "es2020",.

Now it highlights and compiles ok.

@doits
Copy link
Contributor

doits commented Nov 13, 2019

For reference similar issues on this topic: #4680, #4738

@Robula
Copy link

Robula commented Feb 3, 2020

Has anyone got typescript@3.7 working alongside ESLint?

@sodatea
Copy link
Member

sodatea commented Feb 7, 2020

Updated in the 4.2 release.

@sodatea sodatea closed this as completed Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants