]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
feat(types): avoid props JSDocs loss by `default` option (#5871)
authorJohnson Chu <johnsoncodehk@gmail.com>
Wed, 11 May 2022 11:37:49 +0000 (19:37 +0800)
committerGitHub <noreply@github.com>
Wed, 11 May 2022 11:37:49 +0000 (07:37 -0400)
packages/runtime-core/src/componentProps.ts

index 6b267ad14446fcb6e4eed04c49d3fd53084809b0..2f3a2fe1452d6a2e816066c91b40d329c6999be4 100644 (file)
@@ -135,7 +135,8 @@ const enum BooleanFlags {
 
 // extract props which defined with default from prop options
 export type ExtractDefaultPropTypes<O> = O extends object
-  ? { [K in DefaultKeys<O>]: InferPropType<O[K]> }
+  // use `keyof Pick<O, DefaultKeys<O>>` instead of `DefaultKeys<O>` to support IDE features
+  ? { [K in keyof Pick<O, DefaultKeys<O>>]: InferPropType<O[K]> }
   : {}
 
 type NormalizedProp =