Typescript was regularly receiving updates, and new versions were being released.
// It will display the version of node.js installed on your operating system. node -v or node --version // It will display the version of npm installed on your operating system. npm -v or npm --version
To check the version installed in your development environment, we can use the following command in your terminal.
tsc --version
This will display the version of the Typescript compiler installed on your machine.
we can use npm (Node Package Manager) to install the latest Typescript package globally using below command.
// `latest` keyword indicate Newer version of Typescript npm install typescript@latest -g
Alternatively, we can also upgrade the Typescript version locally in our project, navigate to your project directory and run above command.
// it will install module under devDependency object in package.json npm install typescript --save-dev
// TypeScript 4.0 and earlier let num: count = 33;
// TypeScript 4.1 and later let num: count = 33 as const;
Short-Circuiting Assignment
// TypeScript 4.1 and later type DAYS = 'Monday' | 'Friday' | 'Sunday'; let day: DAYS = 'Monday'; // Allowed // let day: DAYS = 'Tuesday'; // Error
// TypeScript 4.0 and earlier let tuple: [string, number, number] = ["Monday", 06, 2023]; TypeScript 4.0 and Later (Labeled Tuple Elements):
let tuple: [day: string, month: number, year:number ] = ["Monday", 06, 2023];
TypeScript 4.1 and Later:
TypeScript 4.0 and Earlier:
TypeScript 4.0 and later:
To check if a specific Typescript feature is available in your installed Typescript version, you can refer to the Typescript release notes or check the Typescript handbook for the feature's introduction version.