What are higher-order types in TypeScript?
Answer
Higher-order types are types that take other types as arguments and/or return types — analogous to higher-order functions in functional programming. All generic utility types are higher-order: Partial<T>, Record<K, V>, etc. You can compose them: type PartialRecord<K extends keyof any, V> = Partial<Record<K, V>>;. Type-level functions: mapped types and conditional types act as type-level functions. A generic mapped type like type Stringify<T> = { [K in keyof T]: string } is a type-level function that takes T and returns a new type. You can create complex type transformations by composing these: type MakeGetters<T> = { [K in keyof T as `get\${Capitalize<string & K>}`]: () => T[K] };. Higher-order types enable powerful meta-programming in TypeScript — building type-safe APIs, ORMs, validation libraries, and framework integrations that would be impossible with simple type annotations.
Previous
What is the Extract and Exclude difference and when to use each?
Next
What is structural typing in TypeScript?