From: 引证 Date: Wed, 26 Oct 2022 07:01:37 +0000 (+0800) Subject: types(shared): Improve LooseRequired (#6244) X-Git-Tag: v3.2.42~56 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cbc3e67c375ed75fb4ef605c6d5a823890a29712;p=thirdparty%2Fvuejs%2Fcore.git types(shared): Improve LooseRequired (#6244) --- diff --git a/packages/shared/src/typeUtils.ts b/packages/shared/src/typeUtils.ts index 8730d7f38b..3f3620c667 100644 --- a/packages/shared/src/typeUtils.ts +++ b/packages/shared/src/typeUtils.ts @@ -5,7 +5,7 @@ export type UnionToIntersection = ( : never // make keys required but keep undefined values -export type LooseRequired = { [P in string & keyof T]: T[P] } +export type LooseRequired = { [P in keyof (T & Required)]: 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