Skip to content

DeepNormalizedArray<T>

ts
type DeepNormalizedArray<T> = T extends infer U[] ? DeepNormalized<U>[] : T;

Defined in: types.ts:156

Recursively applies DeepNormalized to an array type.

Type Parameters

Type ParameterDescription
T extends unknown[]The array type to normalize

Example

ts
// Before:
type RawItem = {
  id: string | number | null;
  tags?: (string | null | undefined)[];
};

type RawItems = RawItem[];

// Usage:
type NormalizedItems = DeepNormalizedArray<RawItems>;

// After (assuming `DeepNormalized<T>` removes null/undefined and recurses):
// type NormalizedItems = Array<{
//   id: string | number;
//   tags: string[];
// }>;