TypeScript Utility Types
Required<T> — require all properties
Required removes the optional marker from each immediate property, leaving nested object types unchanged. With strict null checks, removing optionality removes the implicit undefined associated with that marker; exactOptionalPropertyTypes can distinguish an explicitly included undefined. It does not fill missing runtime properties or validate an object. Example output: "7 Ready". Verified with strict TypeScript 5.8.3, ES2022 and Node.js 22.16.0. This utility affects static typing; no runtime validation or transformation is supplied by the type itself.
Formal Syntax & Structure
typescript syntaxtypescript
Required<T>Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| T | type parameter | Source type whose optional markers are removed. |
Working Example
Example Snippettypescript
type Draft = { id?: number; title?: string };const saved: Required<Draft> = { id: 7, title: "Ready" };console.log(saved.id, saved.title);