Typescript gives different errors in vscode than through webpack

Viewed 1248

Visual Studio Code runs an instance of the typescript compiler internally to power the in-editor error feedback. You can choose which typescript to use with the typescript.tsdk setting.

I now have a situation where I get a red underlining telling me about an error that I don't get when building through webpack with ts-loader. I don't see a warning during webpack building either.

So apparently the build is different and I like to know how that can be the case.

The error I'm getting specifically is a typescript regression in newer version that I could google in several projects. The message is:

Expression produces a union type that is too complex to represent. ts(2590)

This question isn't about that specific error though, but about how it can come that the in-editor typescript disagrees with the ts-loader-loaded one even though they are the same version.

1 Answers

I think you should check if you use the same TS version. Open command palette (ctrl+shift+p) type "Select Typescript version" and there you can verify if the bundled version matches your workspace version, you can also switch versions there.

Related