Skip to main content

Type Alias: StrictRequired<T>

StrictRequired<T>: { [P in keyof T]-?: NonNullable<T[P]> }

Transforms every key in an object to be strictly required, essentially removing undefined and null from the type.

Type Parameters

Type Parameter
T

Example

interface Sample {
id: string;
name: string | null;
middleName?: string;
}

type BB = StrictRequired<Sample>;
// Expected:
// {
// id: string;
// name: string;
// middleName: string;
// }

Defined in

types.ts:223