类型体操
Published by powerfulyang on Jan 4, 2023
How to type a non-empty array in typescript?
1
export type NonEmptyArray<T> = [T, ...T[]];
How to type a array which shouldn't contain nullable item?
1
export type NonNullableElement<T> = T extends (infer U)[] ? NonNullable<U>[] : T;