remeda
Version:
A utility library for JavaScript and Typescript.
11 lines (9 loc) • 423 B
text/typescript
/**
* In versions of TypeScript prior to 5.4 there is an issue inferring an array
* type after passing it to Partial without additional testing. To allow simpler
* code we pulled this check into it's own utility.
*
* TODO [>2]: Remove this utility once the minimum TypeScript version is bumped.
*/
type PartialArray<T> = T extends ReadonlyArray<unknown> | [] ? Partial<T> : never;
export type { PartialArray as P };