This course has been updated! We now recommend you take the TypeScript Fundamentals, v3 course.
Table of Contents
Introduction
Introduction
Mike North explains what TypeScript is, and what has changed since the last version of the course.Rationale
Mike explains why TypeScript is a useful tool for developers.Course Overview
Mike gives a rough outline of what will be learned, and general philosophy regarding how the course is structured.Flags
Mike navigates into the code and demonstrates various flags that can be added to the typescript command in order to run the code in various environments.Configuring TypeScript
Mike demonstrates how to set up the configuration file in TypeScript.
TypeScript Basics
Variables
Mike demonstrates how variables are typed in TypeScript.Variable Declarations
Mike introduces the separation of variable declarations and initialization, and speaks to type "any".Arrays & Tuples
Mike introduces how arrays and tuples are typed in TypeScript.Object Types & Interfaces
Mike shows how to make properties on objects optional, and introduces the concept of an interface.Intersection & Union Types
Mike introduces types that can be either type, or must be multiple types.Type Systems & Object Shapes
Mike introduces type systems, explains what object shapes are, and goes on to put the types in a hiearchy to explain how objects can be identified as more specific or broader types.Functions
Mike demonstrates how to create type annotations for the arguments and return values.Function Signature Overloading
Mike introduces a method to provide multiple function signatures.Lexical Scope
Mike demonstrates how lexical scope affects types in TypeScript.
Interfaces & Type Aliases
Type Aliases & extends
After giving an overview of what will be covered in the section, Mike explains what type aliases do for the user.Call & Construct Signatures
Mike demonstrates how to utilize an interface to describe call and construct signatures.Dictionary Objects & Index Signatures
Mike explains how dictionary objects are typed in TypeScript, and pays special attention to a common error that developers fall into.Combining Interfaces
Mike explains how to combine interfaces with other types.Type Tests
Mike introduces the dslint library, which allows for type test in TypeScript.
Classes
Classes
Mike introduces how to create a class in TypeScript.Access Modifiers & Initialization
Mike demonstrates how to use access modifier keywords to make the class initialization more succint.Definite Assignment & Lazy Initialization
Mike demonstrates how to suppress errors, and how to use a getter to create a lazy initialization.Abstract Classes
Mike introduces an example of an abstract class.
Converting to TypeScript
Converting to TypeScript
Mike introduces the 3 step process of converting JavaScript to TypeScript, and first talks about what not to do.Compiling in "loose mode"
Mike describes the first step in converting JavaScript to TypeScript.Making Anys Explicit
Mike describes the second step in converting JavaScript to TypeScript.Strict Mode
Mike describes the third step in converting JavaScript to TypeScript, and answers an audience question about when it makes sense to convert JavaScript to TypeScript.Address Book Exercise
Students are instructed to chance an address book file written in JavaScript to TypeScript.Address Book Solution
Mike live codes the solution to the exercise.
Generics
Generics
Mike explains what generics are, and jumps into examples of how it allows the user to parameterize types.Type Parameters
Mike discusses default types, and gives an example of how to utilize TypeScript's ability to infer what a type is.Constraints & Scope
Mike introduces constraints and scope within the context of generics.Use Cases
Mike warns against using generics innapropriately, and gives an example of a bad use for generics, then answers student questions.Dictionary Exercise
Students are instructed to create two functions that map and reduce dictionary data using generics.Dictionary Solution
Mike live codes the solution to the exercise.
Top & Bottom Types
Top Types
Mike introduces the unknown and any types.Type Guards
Mike introduces user-defined type guards.Unknowns & Branded Types
Mike introduces unknowns, then reveals branded types as the safer alternative.Bottom Types
Mike introduces bottom types by first discussing type never.
Advanced Types
Mapped & Conditional Types, & Type Queries
Mike introduces the mapped types, type queries, and conditional types.Built-In Utility Types
Mike introduces the builtin utility types partial, pick, extract, exclude, and record