Rathore
Rathore

Reputation: 305

Typescript New Features intelisense

Is there any way (via tslint/eslint plugins or VS code plugins) to identify if a particular line of code can be updated to latest version of Typescript? e.g.

// Prior to v3.7

if (data && data.customer && data.customer.address) {
   const {address} = data.customer
   const fullAddress = `${address.street}, ${address.city}, ${address.state }${address.zipcode}`
}

// v3.7 onwards

// data access
const address = data?.customer?.address
const fullAddress = `${address?.street}, ${address?.city}, ${address?.state } ${address?.zipcode}`

Is there any way to get such intellisence option in vscode or via any npm module?

Upvotes: 0

Views: 53

Answers (1)

tHeSiD
tHeSiD

Reputation: 5333

in your project do an npm install -D typescript@latest to get the latest version of typescript. Or if you project already has typescript that's updated to the version you want, that is fine too

Then in VSCode, open the command palette and select Typescript: Select Typescript Version

Select TS Version option

It will then list all the versions of typescripts that are available for VSCode

Typescript versions

You can then choose the one you want to use.

Workspace version is the version you install in your project via npm/yarn, VSCode's bundled typescript version has been update to v3.9.3 with VSCode 1.46

Upvotes: 2

Related Questions