DeepNormalized<T>
ts
type DeepNormalized<T> = T extends null ? null : T extends undefined ? undefined : T extends unknown[] ? DeepNormalizedArray<T> : T extends object ? DeepNormalizedObject<T> : T extends string ? T | null : T;Defined in: types.ts:184
Recursively normalizes a type by making all properties nullable throughout the type tree. Non-string primitive types, null, and undefined are preserved as-is.
Type Parameters
| Type Parameter | Description |
|---|---|
T | Type to normalize |
Example
ts
type Original = {
name: string;
age: number;
address: {
street: string
}
};
type Result = DeepNormalized<Original>;
// Result: {
// name: string | null;
// age: number;
// address: {
// street: string | null
// }
// }