TypeScript

JavaScript with added type annotations, checked by a compiler before the code runs.

In more detail

TypeScript catches mistakes such as passing a number where a string is expected, and gives editors autocomplete. The compiler, tsc, then removes the annotations to leave plain JavaScript that runs anywhere JavaScript does.

Examples

The course's lesson files are .tsx, TypeScript files that may contain JSX.
In the browser: The course examples are written in TypeScript: interfaces and type names such as string[] describe the shape of data, and the types are removed when the code is compiled to plain JavaScript for the browser.
Current Node.js versions can run many .ts files directly by stripping the annotations, and loader hooks can transpile other files as they are imported.
The course examples are written in TypeScript: interfaces describe the shape of props, and union types describe reducer actions.
interface CardProps { title: string; count: number; }
function add(a: number, b: number): number { return a + b; }

Related terms

Taught in

References