Skip to content

Commit

Permalink
fix: incorrect resulting type when merging 3+ readonly tuples (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaStevens committed Nov 22, 2021
1 parent daa1d4e commit 696a1b2
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 @@ -133,7 +133,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 696a1b2

Please sign in to comment.