Skip to content

Commit

Permalink
Simplify type definition
Browse files Browse the repository at this point in the history
We can remove the dummy generic M as suggested by tycho01 [here](microsoft/TypeScript#6229 (comment)).
  • Loading branch information
mstn committed Apr 6, 2018
1 parent 7a9896a commit 6d8c51f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// we use numeric literal types for length as TS 2.7 does for fixed size tuples
// N is the length of the array
// T is the type of array elements
// M is a dummy type inizialized to '0', we need it to trick the compiler
export type FixedSizeArray<N extends number, T, M extends string = '0'> = {
[k in M]: any;
} & { length: N } & ReadonlyArray<T>;
export type FixedSizeArray<N extends number, T> = {
0: any;
length: N;
} & ReadonlyArray<T>;

0 comments on commit 6d8c51f

Please sign in to comment.