On this page
Required
Prev: `Partial` | Up: object_transforms | Next: `Readonly`
Rel: object_transforms, Conditional & Mapped Types
Ref: TypeScript Docs — Utility Types
Tags: #public #web #typescript #utility-types #object_transforms #tier/core
Syntax & Overview
Required<T>
Removes ? optionality from every property of T.
Notes & Pitfalls
- Opposite of
Partial<T>: Removes?optionality from all top-level properties (great for normalized config objects after applying defaults).
Example
interface Options { retries?: number; timeoutMs?: number }
type ResolvedOptions = Required<Options>;
const opts: ResolvedOptions = { retries: 3, timeoutMs: 5000 };
Linked from
Related notes
- tuts/typescript/utility_types/object_transforms/Partial Linked here; links to this page; shared tags: #tier, #typescript, #web
- tuts/typescript/utility_types/object_transforms/Readonly Linked here; links to this page; shared tags: #tier, #typescript, #web
- tuts/typescript/utility_types/object_transforms Linked here; links to this page; shared tags: #typescript, #web
- tuts/typescript/type_system/conditional_and_mapped_types Linked here; shared tags: #typescript, #web
- tuts/typescript/builtins/any shared tags: #tier, #typescript, #web
- tuts/typescript/builtins/as_const shared tags: #tier, #typescript, #web
- tuts/typescript/builtins/asserts shared tags: #tier, #typescript, #web
- tuts/typescript/builtins/enum shared tags: #tier, #typescript, #web
- tuts/typescript/builtins/infer shared tags: #tier, #typescript, #web
- tuts/typescript/builtins/is shared tags: #tier, #typescript, #web