Dev HelpersOpen library

TypeScript code examples

Browse 253 TypeScript code examples across 26 topics, including object types, discriminated unions, generic functions.

Jump to a topic

Object types

Discriminated unions

Generic functions

Tuple types

Literal unions

Optional and nullable values

Unknown input

Mapped types

Template literal types

Conditional types

Function signatures

Typed collections

Interfaces and classes

Async typing

State machines

Recursive data

Branded values

Typed events

Type-safe configuration

Form handling

Typed pagination

Sorting and indexing

Binary and numeric data

Typed routes

Immutable updates

Coordinate systems