Skip to content

Commit

Permalink
refactor: Remove string as length on tuple creator
Browse files Browse the repository at this point in the history
  • Loading branch information
eythaann committed Oct 19, 2023
1 parent 79fc1ea commit f00a579
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/modules/arrays-and-tuples/infrastructure.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ export type TupleIncludes<T, TypeToSearch> = T extends [infer Current, ...infer
* type B = Tuple<number>;
* // ^? [] | [number, ...number[]]
*/
export type Tuple<Type, Length extends number | string = never> = IsNever<Length> extends true ? nLengthTuple<Type> : _Tuple<Type, Length>;
export type Tuple<Type, Length extends number = never> = IsNever<Length> extends true ? nLengthTuple<Type> : _Tuple<Type, Length>;

type _Tuple<Type, Length extends number | string, result extends unknown[] = []> = `${result['length']}` extends `${Length}`
type _Tuple<Type, Length extends number, result extends unknown[] = []> = result['length'] extends Length
? result
: [..._Tuple<Type, Length, [Type, ...result]>];

Expand Down

0 comments on commit f00a579

Please sign in to comment.