TypeScript Concepts

Type stripping — runtime execution without checking

Node.js 22.16.0 supports running files with erasable TypeScript syntax through its experimental type-stripping facility. It removes supported type syntax without checking types, does not apply tsconfig path mappings or downlevel transformations, and rejects transform-requiring syntax such as enums in strip-only mode. Run tsc separately for static validation. The displayed example also compiles conventionally; dedicated direct Node fixtures verify stripping and its limits. Observed output: '8'. Local example verified with TypeScript 5.8.3, strict checking, ES2022/CommonJS and Node.js 22.16.0; declarations enabled.

Formal Syntax & Structure

typescript syntaxtypescript
node --experimental-strip-types main.ts

Working Example

Example Snippettypescript
const count: number = 4;console.log(count * 2);
TypeScript Reference