Skip to content

Commit

Permalink
fix: incorrect resulting type when merging 3+ readonly tuples
Browse files Browse the repository at this point in the history
fix #16
  • Loading branch information
RebeccaStevens committed Nov 22, 2021
1 parent b317e60 commit f7098fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/types/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ type DeepMergeArraysDefaultHKTHelper<
? Head extends ReadonlyArray<unknown>
? Rest extends readonly [
ReadonlyArray<unknown>,
...ReadonlyArray<unknown[]>
...ReadonlyArray<ReadonlyArray<unknown>>
]
? DeepMergeArraysDefaultHKTHelper<Rest, MF, [...Acc, ...Head]>
: [...Acc, ...Head]
Expand Down
3 changes: 3 additions & 0 deletions tests/types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ const f = {
// $ExpectType { foo: [1, 2, 3, "a", "b", "c"]; }
deepmerge(e, f);

// $ExpectType { foo: [1, 2, 3, "a", "b", "c", "a", "b", "c"]; }
deepmerge(e, f, f);

// $ExpectType { foo: (string | number)[]; }
deepmerge(e as E, f as F);

Expand Down

0 comments on commit f7098fb

Please sign in to comment.