TypeScript: from JavaScript to safer apps

8 steps · about 3 h 50 min · Intermediate

  1. See what TypeScript adds (doc, TypeScript, 15 min)

    Start with the language's purpose and its relationship to JavaScript.

  2. Type a small JavaScript program (tutorial, TypeScript, 20 min)

    Use inference and annotations in a compact working example.

  3. Use everyday types (doc, TypeScript, 35 min)

    Practise arrays, objects, unions and function signatures.

  4. Narrow uncertain values (doc, TypeScript, 35 min)

    Turn runtime checks into safe compile-time knowledge.

  5. Design typed functions (doc, TypeScript, 35 min)

    Express parameters, callbacks, overloads and return values clearly.

  6. Reuse types with generics (doc, TypeScript, 35 min)

    Preserve relationships between inputs and outputs without using any.

  7. Organise code into modules (doc, TypeScript, 25 min)

    Connect typed files using modern import and export patterns.

  8. Configure a strict project (reference, TypeScript, 30 min)

    Choose compiler options that catch mistakes early and fit the runtime.