TypeScript type stripping
TypeScript adds static checks to JavaScript. Node can remove certain type annotations and execute the remaining program, but that does not mean it checks types. Run a compiler check separately, then execute the program. An annotation describes an expected value; it does not convert it. Node 22.16.0 supports experimental stripping of erasable syntax, enabled by default in this release. The explicit flag in the example documents the intended mode. The compiler command `tsc --strict --noEmit --target es2022 --module nodenext main.mts` checks without producing files. A separate emit workflow can compile JavaScript before running it. Enums and parameter properties require transformation; native stripping is not a general compiler and does not apply tsconfig path aliases. Use a reviewed transpiler when needed. Do not interpret successful execution as type safety. An annotation of `number` cannot make an external string a number. Check unknown input at runtime. Evidence: Actual TypeScript source execution, independent tsc check. Source: https://nodejs.org/download/release/v22.16.0/docs/api/typescript.html
Formal Syntax & Structure
See example for the scoped contractWorking Example
const quantity: number = 3;const unitCents: number = 125;function total(q: number, price: number): number { return q * price; }console.log(total(quantity, unitCents));