O'Reilly logo
live online training icon Live Online training

Advanced TypeScript programming

Yakov Fain

TypeScript is a language with optional typing, simplifying the gradual upgrade of existing JavaScript applications. But TypeScript offers powerful types that may not be easy to understand, especially if you’re used to writing code without types.

Join Expert Yakov Fain for a hands-on exploration of advanced TypeScript programing concepts. Over three hours, you’ll learn the advanced TypeScript types and discover how to prepare your TypeScript apps for deployment with webpack and Babel.

What you'll learn-and how you can apply it

By the end of this live, hands-on, online course, you’ll understand how to:

  • The role of bundlers
  • How to prepare bundles that can work in browsers that partially implement a particular version of the ECMAScript specification

And you’ll be able to:

  • Use advanced TypeScript constructs
  • Read and write code that uses generics, mapped, and conditional types
  • Use JavaScript libraries with your TypeScript code
  • Prepare files for deployment using webpack and Babel

This training course is for you because...

  • You already have some familiarity with TypeScript and want to take your skills to the next level.
  • You like working with object-oriented languages (Java, C#, Python, etc.).
  • You’re evaluating a framework that uses TypeScript.

Prerequisites

  • General knowledge of JavaScript syntax (ES5 edition), HTML, and basic TypeScript types

Recommended preparation:

Recommended follow-up:

About your instructor

  • Yakov Fain is the co-author of the Amazon bestseller Angular 2 Development with TypeScript, as well as a number of other technical books on programming. Yakov works as a software architect at the IT consultancy Farata Systems and develops software products for the insurance industry. A Java Champion, he has taught multiple classes and workshops on web and Java-related technologies, presented at international conferences, and published more than a thousand blog posts (see https://yakovfain.com).

Schedule

The timeframes are only estimates and may vary according to how the class is progressing

TypeScript generics (30 minutes)

  • Group discussion: Structural versus nominal typing systems
  • Lecture: Understanding generics; creating your own generic types; creating generic functions
  • Hands-on exercises: Restrict types in generic arrays; create a generic interface comparator
  • Q&A

Decorators (25 minutes)

  • Lecture: The role of decorators; creating class decorators; creating method decorators
  • Hands-on exercises: Create and apply a class decorator, @useSalutation; create a decorator to log trades
  • Q&A
  • Break (5 minutes)

Mapped and conditional types (40 minutes)

  • Lecture: The readonly mapped type; declaring your own mapped types; other built-in mapped types; conditional types
  • Hands-on exercises: Make all call properties readonly; remove the readonly qualifer from the class properties; change the method return type depending on the method argument
  • Q&A

Tooling (40 minutes)

  • Lecture: Source maps; the TSLint linter; bundling code with webpack; using the Babel transpiler; using Babel with TypeScript and webpack
  • Hands-on exercises: Debug TypeScript code in the Chrome browser; configure webpack for TypeScript bundling; bundle a sample TypeScript project
  • Q&A
  • Break (5 minutes)

Using TypeScript and JavaScript in the same project (30 minutes)

  • Lecture: Type definition files
  • Group discussion: A sample TypeScript app that uses a JavaScript library; introducing TypeScript in your JavaScript project
  • Hands-on exercise: Run a sample TypeScript app that uses a JavaScript library

Wrap-up and Q&A (5 minutes)