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 committed Jan 4, 2024
1 parent 0275dd3 commit 2bcf07b
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 @@ -301,7 +301,9 @@ type PropsWithDefaults<
Defaults extends InferDefaults<T>,
BKeys extends keyof T,
> = Readonly<Omit<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
? T[K]
: NotUndefined<T[K]>
Expand Down

0 comments on commit 2bcf07b

Please sign in to comment.