Types from the start
What TypeScript adds to JavaScript, the basic types, and typed functions with optional, default and rest parameters.
About 4 hours of study
Learning objectives
- Read and fix type errors
- Use primitive, array, tuple and unknown types
- Write typed functions and callbacks
Lessons
- 1
Why TypeScript Intermediate
What TypeScript adds to JavaScript, how the type checker finds mistakes before a program runs, type annotations and inference, and how a TypeScript program becomes JavaScript.
- 2
Basic types: primitives, arrays, tuples and unknown Intermediate
The primitive types, arrays and tuples, null and undefined under strict mode, literal types, and the difference between any and unknown.
- 3
Typed functions Intermediate
Parameter and return types, optional, default and rest parameters, function types for callbacks, void and never, and how TypeScript checks every call.
Module practice
- TypeScript: Greet with typesEasy
- TypeScript: Temperature tableMedium
- TypeScript: Name the type of JSON valuesHard
- TypeScript: Summarise marksEasy
- TypeScript: Rank players with tuplesMedium
- TypeScript: Read a typed configurationHard
- TypeScript: A calculator of typed functionsEasy
- TypeScript: A pipeline of number functionsMedium
- TypeScript: Memoized Fibonacci with bigintHard