remeda
Version:
A utility library for JavaScript and Typescript.
17 lines • 876 B
TypeScript
//#region src/internal/types/IterableContainer.d.ts
/**
* This should only be used for defining generics which extend any kind of JS
* array under the hood, this includes arrays *AND* tuples (of the form [x, y],
* and of the form [x, ...y[]], etc...), and their readonly equivalent. This
* allows us to be more inclusive to what functions can process.
*
* @example
* function map<T extends IterableContainer>(items: T) { ... }
*
* We would've named this `ArrayLike`, but that's already used by typescript...
* @see This was inspired by the type-definition of Promise.all (https://github.com/microsoft/TypeScript/blob/1df5717b120cddd325deab8b0f2b2c3eecaf2b01/src/lib/es2015.promise.d.ts#L21)
*/
type IterableContainer<T = unknown> = ReadonlyArray<T> | readonly [];
//#endregion
export { IterableContainer };
//# sourceMappingURL=IterableContainer-B2PfkIAC.d.ts.map