返回
创建于
状态公开
How to type a non-empty array in typescript?
1export type NonEmptyArray<T> = [T, ...T[]];
How to type a array which shouldn't contain nullable item?
1export type NonNullableElement<T> = T extends (infer U)[] ? NonNullable<U>[] : T;
1export type NonEmptyArray<T> = [T, ...T[]];
1export type NonNullableElement<T> = T extends (infer U)[] ? NonNullable<U>[] : T;