From 489df2e2db55d0847f762b7fb5be43127b9e440a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=95=E8=AF=81?= Date: Sat, 9 Jul 2022 20:51:47 +0800 Subject: [PATCH 1/3] types(shared): Improve LooseRequired Improve the implementation of `LooseRequired`. --- packages/shared/src/typeUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/shared/src/typeUtils.ts b/packages/shared/src/typeUtils.ts index 8730d7f38bf..468774b523a 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 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 From e4b1b1434628db3dccb8cfe83c7547cf5581b5df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=95=E8=AF=81?= Date: Sun, 10 Jul 2022 13:46:01 +0800 Subject: [PATCH 2/3] Update typeUtils.ts Improve the implementation of LooseRequired. --- packages/shared/src/typeUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/shared/src/typeUtils.ts b/packages/shared/src/typeUtils.ts index 468774b523a..26bc0c2709d 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 keyof Required]: 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 From cf3d6a180b6080663b91cb25f1005b251a796c1f Mon Sep 17 00:00:00 2001 From: GU Yiling Date: Mon, 11 Jul 2022 12:03:31 +0800 Subject: [PATCH 3/3] chore: format code --- packages/shared/src/typeUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/shared/src/typeUtils.ts b/packages/shared/src/typeUtils.ts index 26bc0c2709d..3f3620c6672 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 keyof (T & Required)]: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