Explorar o código

feat(types): avoid props JSDocs loss by `default` option (#5871)

Johnson Chu %!s(int64=4) %!d(string=hai) anos
pai
achega
c901dca5ad
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      packages/runtime-core/src/componentProps.ts

+ 2 - 1
packages/runtime-core/src/componentProps.ts

@@ -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 =