Learn
Types
Review
All right! You’ve taken some first steps into the wonderful world of type safety with TypeScript. 💪
To recap, you’ve learned:
- TypeScript is a superset of JavaScript that adds types.
- The type system refers to TypeScript’s understanding of how your code is meant to function: mainly what data types should be stored under your variables.
- TypeScript expects the data type of the variable to match the type of the value initially assigned to it at its declaration—this is know as type inference.
- An object’s shape describes, among other things, what properties and methods it does or doesn’t contain. TypeScript knows not only what type something is but also what shape that type has.
- When it isn’t able to infer a type, TypeScript will consider a variable to be of type
any
. - Type annotations are little pieces of code that indicate what type a variable is meant to be.
let youAreAwesome: boolean; youAreAwesome = true;
Instructions
Great job! Feel free to play around with the TypeScript you’ve learned in this lesson!