TypeScript
TS01 - TypeScript Basic Typing
Complexity
Junior
Timeframe
4h
Summary
You be able to type primitives, arrays, objects and functions.
Skill Breakdown
You should know how to use tsc to compile TypeScript to JavaScript.
You should know how to use the most relevant primitive types:
numberbooleanstringundefinednull
You should know how and when to use any and unknown.
You should know how write array types and object types.
You should know how to use a type alias to write less verbose types.
You should know how to use type assertions.
You should know how to annotate functions:
- parameter type annotations
- return type annotations
- optional parameters
You should know how to write function type expressions.
Required Reading
Getting Things Done in Next.js:
- Why TypeScript? (opens in a new tab)
- Basic Types (opens in a new tab)
- Annotating Functions (opens in a new tab)
Optional Reading
The TypeScript Handbook:
- The Basics (opens in a new tab)
- Everyday Types (opens in a new tab)
- More on Functions (opens in a new tab)
- Object Types (opens in a new tab)
TS02 - TypeScript Union Types
Complexity
Junior
Timeframe
2h
Summary
You should understand union types and type narrowing.
Skill Breakdown
You should know about literal types and the as const syntax.
You should be able to create union types of both literal types and non-literal types.
You should understand the different ways of narrowing a union type:
- equality narrowing
- truthiness narrowing
typeoftype guardsinstanceofnarrowing
You should know how to use the non-null assertion operator.
You should how to use type predicates to write user-defined type guards.
You should know how to use discriminated unions.
Required Reading
Getting Things Done in Next.js:
Optional Reading
The TypeScript Handbook:
TS03 - TypeScript Generics
Complexity
Junior
Timeframe
4h
Summary
You should know how to use generic functions and objects.
Skill Breakdown
You should understand why generics are useful.
You should understand the concept of a type parameter and know how to write and call generic functions.
You should know how to write generic objects.
You should know how to apply generic constraints.
You should understand some of the most important generics:
Array<Type>Record<Key, Value>Map<Key, Value>Set<Type>Promise<Type>
Required Reading
Getting Things Done in Next.js:
Optional Reading
The TypeScript Handbook:
TS04 - TypeScript Configuration
Complexity
Junior
Timeframe
1h
Summary
You be able to setup and configure a TypeScript project.
Skill Breakdown
You should understand how to set up und configure a TypeScript project and what the purpose of the tsconfig.json file is.
You should understand the purpose of the following top-level options:
compilerOptionsincludeexcludeextends
You should know about the most important compiler options:
strictoutDirtargetlibnoEmit
Required Reading
Getting Things Done in Next.js:
Optional Reading
TSConfig Reference:
- compilerOptions (opens in a new tab)
- include (opens in a new tab)
- exclude (opens in a new tab)
- extends (opens in a new tab)
- strict (opens in a new tab)
- outDir (opens in a new tab)
- target (opens in a new tab)
- lib (opens in a new tab)
- noEmit (opens in a new tab)
TS05 - TypeScript Types from Types
Complexity
Middle
Summary
You should be able to create TypeScript types from other types.
Timeframe
3h
Skill Breakdown
You should understand the following ways to create types from other types:
- the
keyoftype operator - the
typeoftype operator - indexed access types
- conditional types
- mapped types
- template literal types
You should understand important utility types that can help you with creating types:
Partial<Type>Required<Type>Readonly<Type>Pick<Type, Keys>Omit<Type, Keys>Exclude<UnionType, Excluded>Extract<Type, Union>NonNullable<Type>Parameters<Type>ReturnType<Type>
Required Reading
The TypeScript Handbook:
- Keyof Type Operator (opens in a new tab)
- Typeof Type Operator (opens in a new tab)
- Indexed Access Types (opens in a new tab)
- Conditional Types (opens in a new tab)
- Mapped Types (opens in a new tab)
- Template Literal Types (opens in a new tab)
TypeScript Reference:
Partial<Type>(opens in a new tab)Required<Type>(opens in a new tab)Readonly<Type>(opens in a new tab)Pick<Type, Keys>(opens in a new tab)Omit<Type, Keys>(opens in a new tab)Exclude<UnionType, Excluded>(opens in a new tab)Extract<Type, Union>(opens in a new tab)NonNullable<Type>(opens in a new tab)Parameters<Type>(opens in a new tab)ReturnType<Type>(opens in a new tab)
Optional Reading
There is no optional reading for this skill.
TS06 - TypeScript Classes
Complexity
Middle
Timeframe
3h
Summary
You should be able to annotate classes in TypeScript.
Skill Breakdown
You should know how to annotate class members:
- annotating fields
- annotating methods
- annotating constructors
- annotating getters and setters
You should know how to use the readonly modifier on class members.
You should know how to use implements to implement an interface.
You should know about member visibility:
publicprotectedprivate
You should know how to write generic classes.
You should know how to write abstract classes and members.
Required Reading
The TypeScript Handbook:
Optional Reading
There is no optional reading for this skill.
TS07 - TypeScript Modules
Complexity
Middle
Timeframe
2h
Summary
You should know how to work with modules in TypeScript.
Skill Breakdown
You should understand the concept of a host.
You should understand the module format deteection process.
You should broadly understand how module resolution works.
You should be broadly aware of CJS and ESM/CJS interop in TypeScript.
You should know about the following compiler options:
modulemoduleResolutionbaseUrlpathsesModuleInteropallowArbitraryExtensionsallowImportingTsExtensions
Required Reading
The TypeScript Handbook:
TypeScript Modules Reference:
TypeScript TSConfig Reference:
- module (opens in a new tab)
- moduleResolution (opens in a new tab)
- baseUrl (opens in a new tab)
- paths (opens in a new tab)
- esModuleInterop (opens in a new tab)
- allowArbitraryExtensions (opens in a new tab)
- allowImportingTsExtensions (opens in a new tab)
Optional Reading
There is no optional reading for this skill.
TS08 - TypeScript Declaration Files
Complexity
Middle
Timeframe
2h
Summary
You should understand how to write and use declaration files.
Skill Breakdown
You should understand the purpose of and how to write .d.ts declaration files.
You should know how to write declarations for the following:
- global variables
- (global) functions
- objects and their properties
- classes
You should understand how to write and organize reusable types in declaration files.
You should understand that you can publish .d.ts files by:
- bundling them with the package
- publishing them to the
@typesorganization
Required Reading
TypeScript Declaration Files:
Optional Reading
There is no optional reading for this skill.