Răsfoiți Sursa

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

Johnson Chu 4 ani în urmă
părinte
comite
c901dca5ad
1 a modificat fișierele cu 2 adăugiri și 1 ștergeri
  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 =