diff --git a/lib/lib.es2015.core.d.ts b/lib/lib.es2015.core.d.ts index 79901dfe96b56..fa13765fb85ab 100644 --- a/lib/lib.es2015.core.d.ts +++ b/lib/lib.es2015.core.d.ts @@ -276,42 +276,31 @@ interface NumberConstructor { parseInt(string: string, radix?: number): number; } -interface ObjectConstructor { - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source The source object from which to copy properties. - */ - assign(target: T, source: U): T & U; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V): T & U & V; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - * @param source3 The third source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; +/** +* Return a empty object type if the param's type is undefined +*/ +type Undefined2Object = T extends undefined ? {} : T; + +/** +* Remove the first two item of tuple +*/ +type RemoveFirstTwo = T extends [a: First, b: Second, ...rest: infer P] ? P : []; + +/** +* Convert tuple to intersection with tuple item's type +*/ +type MergeTuple = T[2] extends undefined + ? Undefined2Object & Undefined2Object + : MergeTuple<[T[0], T[1]]> & MergeTuple>; +interface ObjectConstructor { /** * Copy the values of all of the enumerable own properties from one or more source objects to a * target object. Returns the target object. * @param target The target object to copy to. * @param sources One or more source objects from which to copy properties */ - assign(target: object, ...sources: any[]): any; - + assign(target: T, ...sources: R): MergeTuple<[T, ...R]>; /** * Returns an array of all symbol properties found directly on object o. * @param o Object to retrieve the symbols from.