]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
types(shared): Improve LooseRequired<T> (#6244)
author引证 <browsnet@qq.com>
Wed, 26 Oct 2022 07:01:37 +0000 (15:01 +0800)
committerGitHub <noreply@github.com>
Wed, 26 Oct 2022 07:01:37 +0000 (03:01 -0400)
packages/shared/src/typeUtils.ts

index 8730d7f38bf545c4ef108d2d0ef638f8e252a0e3..3f3620c6672305025a2160838f53c78239b014be 100644 (file)
@@ -5,7 +5,7 @@ export type UnionToIntersection<U> = (
   : never
 
 // make keys required but keep undefined values
-export type LooseRequired<T> = { [P in string & keyof T]: T[P] }
+export type LooseRequired<T> = { [P in keyof (T & Required<T>)]: T[P] }
 
 // If the the type T accepts type "any", output type Y, otherwise output type N.
 // https://stackoverflow.com/questions/49927523/disallow-call-with-any/49928360#49928360