Skip to content

Commit

Permalink
fix(types): constrain inferred types of Defu
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Aug 16, 2022
1 parent 551ae4c commit 3d3ea3e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/types.ts
Expand Up @@ -28,9 +28,13 @@ export type MergeObjects<
export type Defu<S extends Input, D extends Array<Input | IgnoredInput>> =
D extends [infer F, ...infer Rest]
? F extends Input
? Defu<MergeObjects<S, F>, Rest>
? Rest extends Array<Input | IgnoredInput>
? Defu<MergeObjects<S, F>, Rest>
: MergeObjects<S, F>
: F extends IgnoredInput
? Defu<S, Rest>
? Rest extends Array<Input | IgnoredInput>
? Defu<S, Rest>
: S
: S
: S

Expand Down

0 comments on commit 3d3ea3e

Please sign in to comment.