isaacscript-common
Version:
Helper functions and features for IsaacScript mods.
10 lines • 449 B
TypeScript
/**
* Helper type to represent a tuple of length N.
*
* From:
* https://stackoverflow.com/questions/52489261/typescript-can-i-define-an-n-length-tuple-type/52490977#52490977
*/
export type Tuple<T, N extends number> = N extends N ? number extends N ? T[] : _TupleOf<T, N, []> : never;
type _TupleOf<T, N extends number, R extends unknown[]> = R["length"] extends N ? R : _TupleOf<T, N, [T, ...R]>;
export {};
//# sourceMappingURL=Tuple.d.ts.map