]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
feat(types): support IDE renaming for props (#3656)
authorJohnson Chu <johnsoncodehk@gmail.com>
Thu, 1 Jul 2021 17:48:23 +0000 (01:48 +0800)
committerGitHub <noreply@github.com>
Thu, 1 Jul 2021 17:48:23 +0000 (13:48 -0400)
packages/runtime-core/src/componentProps.ts

index 5f73fbd84169c39d5711d91f5b4ef936dda8d6ef..cacd72102badac9fdbc80cf394520e2e93043bee 100644 (file)
@@ -109,7 +109,8 @@ type InferPropType<T> = [T] extends [null]
             : T
 
 export type ExtractPropTypes<O> = O extends object
-  ? { [K in RequiredKeys<O>]: InferPropType<O[K]> } &
+  ? { [K in keyof O]?: unknown } & // This is needed to keep the relation between the option prop and the props, allowing to use ctrl+click to navigate to the prop options. see: #3656
+      { [K in RequiredKeys<O>]: InferPropType<O[K]> } &
       { [K in OptionalKeys<O>]?: InferPropType<O[K]> }
   : { [K in string]: any }