TypeScript adds a static type system on top of JavaScript. Every valid JavaScript file is already close to valid TypeScript; you opt in to types gradually, and the compiler (`tsc`) erases them to produce plain JS for the browser or Node.
The core promise is catching mistakes before runtime: typos in property names, wrong argument counts, and mismatched types are flagged in your editor as you type, instead of surfacing as a crash in production.
ts
function double(n: number): number {
return n * 2;
}
double("5"); // compile error: string is not assignable to numberBecause it compiles away, TypeScript has zero runtime cost — types exist only during development and are stripped out. This makes it attractive for web3 tooling, where a wrong type (e.g. passing a `string` where a `bigint` wei amount is expected) can cause expensive bugs.