I upgraded TypeScript to 3.7.2 from 3.6.x. And write code using optional chaining. But get strange error
Expression expected.ts(1109)
in (vim, VSCode) IDE, even when build was successful.
Click the version in the bottom right of VS Code.
A dropdown will appear at the top with a few options such as "Use VS Code's Version" and "Use Workspace Version".
Select "Use Workspace Version" which will select the version of typescript that tsc
is using, typically installed in your devDependencies
.
This will automatically add a line to your Workspace Configuration File that looks something like the following:
{
"typescript.tsdk": "node_modules/typescript/lib"
}
It could be that your editor isn't using TypeScript 3.7 yet - see if there are options for using the TypeScript version in the TSServer from from your node_modules.
You can start using TypeScript 3.7 features in VS Code today by installing the JavaScript and TypeScript Nightly extension.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With