Skip to content

Commit

Permalink
fix(types): optimizing type inference with defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoErii authored and yangchangtao committed Aug 16, 2024
1 parent c96ec67 commit 9754321
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/runtime-core/src/apiSetupHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,9 @@ type PropsWithDefaults<
Defaults extends InferDefaults<T>,
BKeys extends keyof T,
> = Readonly<MappedOmit<T, keyof Defaults>> & {
readonly [K in keyof Defaults]-?: K extends keyof T
readonly [K in keyof Defaults as K extends keyof T
? K
: never]-?: K extends keyof T
? Defaults[K] extends undefined
? IfAny<Defaults[K], NotUndefined<T[K]>, T[K]>
: NotUndefined<T[K]>
Expand Down

0 comments on commit 9754321

Please sign in to comment.