Skills
TypeScript

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:

  • number
  • boolean
  • string
  • undefined
  • null

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:

Optional Reading

The TypeScript Handbook:

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
  • typeof type guards
  • instanceof narrowing

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:

  • compilerOptions
  • include
  • exclude
  • extends

You should know about the most important compiler options:

  • strict
  • outDir
  • target
  • lib
  • noEmit

Required Reading

Getting Things Done in Next.js:

Optional Reading

TSConfig Reference:

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 keyof type operator
  • the typeof type 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:

TypeScript Reference:

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:

  • public
  • protected
  • private

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:

  • module
  • moduleResolution
  • baseUrl
  • paths
  • esModuleInterop
  • allowArbitraryExtensions
  • allowImportingTsExtensions

Required Reading

The TypeScript Handbook:

TypeScript Modules Reference:

TypeScript TSConfig Reference:

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 @types organization

Required Reading

TypeScript Declaration Files:

Optional Reading

There is no optional reading for this skill.