TypeScript Utility Types
Every built-in TypeScript utility type — with real usage patterns, examples that compile, and the shallow-vs-deep gotcha for each one. TS 5+ semantics.
Object Transforms
Partial<T>
Constructs a type where every property of T is set to optional. Useful for representing update payloads, patch objects, and configuration overrides where all fields may be omitted.
Required<T>
Removes optionality from every property of T, producing a type where all fields must be present. The -? mapping modifier strips the ? flag from every key.
Readonly<T>
Marks every property of T as readonly, preventing reassignment after construction. Only enforced at compile-time — the underlying object is still mutable at runtime.
Pick<T, K>
Builds a new type containing only the properties from T whose keys are in the union K. Ideal for narrowing large interfaces to the subset a function or component actually needs.
Omit<T, K>
Constructs a type by removing the properties in K from T. Unlike Pick, its K is not constrained to keyof T, so extra keys are silently ignored.
Record<K, V>
Creates an object type whose keys come from the union K and whose values all have type V. Useful for lookup tables, dictionaries, and enum-keyed maps.
Exclude<T, U>
Filters a union T by removing every member that is assignable to U. Distributes over union members via the conditional type, producing the set-difference T \ U.
Extract<T, U>
Keeps only those members of union T that are assignable to U. The dual of Exclude, giving the set-intersection T ∩ U.
NonNullable<T>
Removes null and undefined from the type T. In TS 4.9+ it is implemented as `T & {}`, which drops nullish members without altering the rest.
Function Types
ReturnType<T>
Infers the return type of a function type T using `infer R`. Widely used to derive types from existing functions without redeclaring them.
Parameters<T>
Extracts the parameters of a function type T as a tuple. Enables reusing a function's argument list for wrappers, currying, or higher-order utilities.
ConstructorParameters<T>
Extracts the parameter tuple of a class constructor T. Mirrors Parameters but operates on `new (...)` signatures instead of call signatures.
ThisParameterType<T>
Extracts the explicit `this` parameter type from a function T, or `unknown` if none is declared. Useful for reflecting on method-style callbacks that require a specific caller.
OmitThisParameter<T>
Returns a function type identical to T but without its explicit `this` parameter. Commonly paired with `Function.prototype.bind` to model the bound function's signature.
String Manipulation
Uppercase<S>
Compile-time intrinsic that converts a string literal type S to its uppercase form. Introduced in TS 4.1 alongside template literal types.
Lowercase<S>
Intrinsic string type manipulator that converts each character of literal S to lowercase. Available since TS 4.1 and evaluated by the compiler with no runtime cost.
Capitalize<S>
Intrinsic string type utility that uppercases the first character of literal string S, leaving the rest unchanged. Enables typed camelCase-to-PascalCase and getter-name construction.
Uncapitalize<S>
Intrinsic type utility that lowercases the first character of literal S, leaving the rest unchanged. The inverse of Capitalize and widely used for PascalCase-to-camelCase mappings.
Conditional & Extraction
InstanceType<T>
Given a constructor type T (typically obtained via `typeof ClassName`), returns the type of an instance produced by `new T()`. Useful for factory functions and generic wrappers over classes.
ThisType<T>
A marker interface with no members that, when used in a contextual type, sets the `this` type inside method-like properties of an object literal. Requires `noImplicitThis` to be genuinely useful and is a compile-time only hint.
Awaited<T>
Models the type produced by awaiting T, recursively unwrapping nested Promises (and other thenables). Introduced in TS 4.5 and used internally by the `await` expression's type.