📓 3.2.0.1 TypeScript Objectives
TypeScript has become the standard for professional JavaScript development. In this section, we'll learn TypeScript as its own language before applying it in our React applications. By the end of this section, you'll be comfortable writing and reading typed JavaScript code, and equipped to handle the TypeScript errors and warnings that come up in real projects.
In this course section, we'll cover the following:
- Type annotations - declaring what type a value should be
- Type inference - TypeScript deducing types automatically
- Arrays and tuples - typed collections and fixed-length sequences
- Type aliases and interfaces - defining the shape of an object
- Union and literal types - a value that can be one of several specified types
- Functions with types - typed parameters and return values
- Optional properties - properties or parameters that may or may not be present
- Generics - types that work with multiple types
- Type narrowing - safely handling values whose type is uncertain
- Type assertions - overriding TypeScript's inference when you know more than the compiler
- Discriminated unions - a union pattern where each variant carries a shared tag for reliable narrowing
- Utility types - built-in tools for transforming existing types
You've already learned functional programming patterns such as pure functions and immutability. These translate directly into TypeScript. Typed function signatures and typed data structures will reinforce what you've already practiced.
After this section, we'll begin building React applications, and all of that code will be written in TypeScript. The investment you make in this section pays off immediately when you start building components.
Independent Project Objectives
For the independent project at the end of this section, you will build a standalone TypeScript application (no React). Your project will be assessed on the following objectives:
- Code compiles with no TypeScript errors and the
anytype is not used - Application defines at least one custom type using
typeorinterface - Application includes at least three typed functions with explicit parameter and return type annotations
- Project includes a README describing what the application does