diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 7dfccb327ea41..98db54f39bb93 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1443,10 +1443,17 @@ type Exclude = T extends U ? never : T; */ type Extract = T extends U ? T : never; +type KnownKeys = { + [K in keyof T]: string extends K ? never : number extends K ? never : K +} extends { [_ in keyof T]: infer U } ? ({} extends U ? never : U) : never; +type OmitFromKnownKeys = KnownKeys extends infer U ? + [U] extends [keyof T] ? Pick> : never : never; /** * Construct a type with the properties of T except for those in type K. */ -type Omit = Pick>; +type Omit = OmitFromKnownKeys + & (string extends K ? {} : (string extends keyof T ? { [n: string]: T[Exclude]} : {})) + & (number extends K ? {} : (number extends keyof T ? { [n: number]: T[Exclude]} : {})); /** * Exclude null and undefined from T