Skip to content

Commit 6d8c51f

Browse files
committed
Simplify type definition
We can remove the dummy generic M as suggested by tycho01 [here](microsoft/TypeScript#6229 (comment)).
1 parent 7a9896a commit 6d8c51f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/index.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// we use numeric literal types for length as TS 2.7 does for fixed size tuples
22
// N is the length of the array
33
// T is the type of array elements
4-
// M is a dummy type inizialized to '0', we need it to trick the compiler
5-
export type FixedSizeArray<N extends number, T, M extends string = '0'> = {
6-
[k in M]: any;
7-
} & { length: N } & ReadonlyArray<T>;
4+
export type FixedSizeArray<N extends number, T> = {
5+
0: any;
6+
length: N;
7+
} & ReadonlyArray<T>;

0 commit comments

Comments
 (0)