01Intro
June 10, 2021We'll discuss the goals and agenda of this course, and how to get up and running with the workshop project in 2 minutes or less.
We'll discuss the goals and agenda of this course, and how to get up and running with the workshop project in 2 minutes or less.
In order to truly understand how types and values "stack" on each other, we'll first tackle the concept of declaration merging. Often when people grasp how TypeScript handles this, they never look at the language the same way again
Although most of the code we write today is in the form of ES modules, plenty of dependencies are packaged in the CommonJS module format. In this chapter, we'll look at modules in depth so that you have all the tools you need in order to consume all the dependencies you care about, while keeping the TS compiler happy
Type queries allow us to obtain type information from values. As we work toward building our own "standard library" of utility types, we'll need this important tool in our toolbox
Conditional types can be thought of as "a ternary operator, for types". While there is no "control flow" in a world where we're describing constraints with types (instead of procedural steps to execute "in a flow"), this tool does provide an important foundation for switching logic based on type information
Now that we've learned about conditional types, let's study the built-in utility types Extract and Exclude, which are *implemented* with conditional types
Conditional types are not just for switching behavior based on comparison -- they can be used with an 'infer' keyword to access sub-parts of type information within a larger type
Indexed Access types provide a mechanism for retrieving part(s) of an array or object type via indices.
Mapped allow types to be defined in other types through a much more flexible version of an index signature. We'll study this type in detail, and demonstrate how it makes language features like indexed access types and conditional types even more powerful!