From 0b194a2b34ded03de3294763336767e0283d24fa Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 1 Nov 2018 16:48:12 -0700 Subject: [PATCH] Define Rest as Pick> to ensure it is homomorphic --- src/lib/es5.d.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 70e7e805899..98b4e3c625f 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1416,13 +1416,6 @@ type Pick = { [P in K]: T[P]; }; -/** - * From T, omit a set of properties whose keys are in the union K - */ -type Rest = { - [P in Exclude]: T[P]; -}; - /** * Construct a type with a set of properties K of type T */ @@ -1445,6 +1438,11 @@ type Extract = T extends U ? T : never; */ type NonNullable = T extends null | undefined ? never : T; +/** + * From T, pick all properties except those in the union K + */ +type Rest = Pick>; + /** * Obtain the parameters of a function type in a tuple */