Record
A built-in TypeScript type, Record<K, V>, for an object whose keys are of type K and values of type V.
In more detail
Record<string, unknown> means any object with string keys whose values are not yet known, a useful first step when checking parsed data. Record<"home" | "checkout", RouteConfig> requires exactly those keys.
Related terms
- index signature — A type rule such as { [key: string]: string } for objects whose property names are not known in advance.
- utility types — Generic types built into TypeScript, such as Partial, Pick and ReturnType, that compute a new type from an existing one.
- mapped type — A type that builds a new object type by looping over a set of keys, such as { [K in keyof T]: T[K] }.
Taught in
- any Versus unknown: Defensive Typing In Practice — Production TypeScript
- void, undefined And null: Exact Optional Property Types — Production TypeScript
- Optional Properties, Readonly And Index Signatures — Production TypeScript
- Union Types, Intersections And Property Conflicts — Production TypeScript
- Generic Constraints: extends, keyof And Indexed Access — Production TypeScript
- Core Utilities: Partial, Required, Readonly, Pick And Omit — Production TypeScript
- The satisfies Operator: Safe Validation Without Widening — Production TypeScript