Table of Contents
IntroductionMike North introduces the course by providing some brief background information, the purpose and inspiration for this course, and what to expect from this course.
TypeScript Basics QuizMike walks through the first few questions from the introduction quiz that focus on TypeScript basics. TypeScript fields, immutable values, and a fill-in-the-blank question regarding how to expand a string are covered in this segment.
Primitive Types QuizMike discusses questions from the introduction quiz regarding primitive types. The union of the two primitive types, string and number, results in a never, whereas the interface types String and Number do not.
Async vs Promise QuizMike walks through the last question from the introduction quiz regarding the order of execution when it comes to async functions and promises. If a promise has been resolved it does not mean the corresponding .then or await is called immediately.
Recent TypeScript Features
Variadic Tuple TypesMike discusses the recent change to TypeScript, which allows variadic tuple types. A variadic tuple type is a tuple type that has the same properties, defined length, and the type of each element is known, but where the exact shape is yet to be defined.
Class Property InferenceMike demonstrates the ability to no longer add types to every class field with class property inference when noImplicitAny is set to true. A student's question regarding what happens when there are conflicting types in the constructor and declaration is also covered in this segment.
Thrown Values as unknownMike discusses how thrown values used to be considered type any but now can be chosen to be regarded as type unknown. The useUnknownInCatchVariables compilerOption allows any error found in a catch block to be labeled as type unknown automatically.
Template Literal & Key RemappingMike demonstrates that template literal types build on string literal types and can expand into many strings via unions. Key remapping has been given a new syntax to allow the transformation of keys in a more declarative way.
Checked index accessMike discusses the compiler flag that automatically describes the possibility of being undefined: noUncheckedIndexAccess.
Typed Data Store ExerciseStudents are instructed to build a data store with type errors that alert on miss-named methods in the class. If a new entity such as Comic is added, type errors should alert the absence of a clearComics, getAllComics, and getAllSongs method. There should be no externally-visible properties on an instance of DataStore beyond the required methods, the code and the test suite should type-check, and all pre-existing tests should pass.
Typed Data Store SolutionMike walks through the solution to the typed data store exercise.
Will It Compile QuizMike walks through 13 brief exercises to help familiarize with whether or not TypeScript will compile and, if not, what kind of error to expect with the given code example. A student's questions regarding what an abstract class is also covered in this segment.
Typing jQuery ExerciseStudents are instructed to implement new code to allow the refactored jQuery snippets to run correctly.
Typing jQuery SolutionMike walks through the solution to the typing jQuery exercise.
TyperdyMike provides a brief TypeScript version of the game Jeopardy. Categories covered include language features, compiler options, utility types, tools and ecosystem, best practices, and JS/TS conversion.
Beginner Type ChallengesMike walks through a few examples of beginner-level exercises from the type-challenges GitHub repo and answers a student's question regarding why a read-only array and array are treated differently. Examples in this segment include implementing the correct types for each of the following If<C, T, F>, LengthOfTuple<T>, EndsWith<A, B>, and Concat<A, B>.
Intermediate Type Challenges: ReturnOf & SplitMike demonstrates some intermediate type challenges, including correctly typing ReturnOf<F> and Split<S, SEP>.
Intermediate Type Challenges: Q&A and IsTupleMike answers student questions regarding how practical the type challenges are for everyday use of TypeScript and if ternary expressions with the extends keyword are the only way to do conditional types. A walkthrough of the last intermediate type challenge involving correctly typing IsTuple is also covered in this segment.
Expert Type ChallengesMike walks through an example of an expert type challenge, including solving for the correct type for IndexOf<T, U>.
Penpal Types ExerciseStudents are instructed to create a utility type WrapForPenpal<T> that takes an object T with methods and emits a type with similar methods. Any non-promise return types become ”Promise-ified.”
Penpal Types SolutionMike walks through the solution to the penpal types exercise.