TypeScript

TS Type Playground

Write TypeScript type definitions and see them explained. Explore utility types, generics, and conditional types interactively.

Mapped

Record<K, V>

Constructs an object type whose property keys are K and values are T.

Mapped

Partial<T>

Makes all properties in T optional.

Mapped

Required<T>

Makes all properties in T required (removes optionality).

Utility

Omit<T, K>

Constructs a type by picking all properties from T and then removing K.

Mapped

Pick<T, K>

Constructs a type by picking the set of properties K from T.

Conditional

Extract<T, U>

Extracts from T those types that are assignable to U.

Conditional

Exclude<T, U>

Excludes from T those types that are assignable to U.

Infer

ReturnType<T>

Extracts the return type of a function type.

Infer

Parameters<T>

Extracts the parameter types of a function type as a tuple.

Infer

Awaited<T>

Recursively unwraps the "awaited type" of a Promise.

Conditional

NonNullable<T>

Excludes null and undefined from T.