Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/lib/es2015.core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,19 @@ interface NumberConstructor {
parseInt(string: string, radix?: number): number;
}

/**
* Assign properties from U to T.
*/
type Assign<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U

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<T, U>(target: T, source: U): T & U;
assign<T, U>(target: T, source: U): Assign<T, U>;

/**
* Copy the values of all of the enumerable own properties from one or more source objects to a
Expand All @@ -272,7 +277,7 @@ interface ObjectConstructor {
* @param source1 The first source object from which to copy properties.
* @param source2 The second source object from which to copy properties.
*/
assign<T, U, V>(target: T, source1: U, source2: V): T & U & V;
assign<T, U, V>(target: T, source1: U, source2: V): Assign<Assign<T, U>, V>;

/**
* Copy the values of all of the enumerable own properties from one or more source objects to a
Expand All @@ -282,7 +287,7 @@ interface ObjectConstructor {
* @param source2 The second source object from which to copy properties.
* @param source3 The third source object from which to copy properties.
*/
assign<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
assign<T, U, V, W>(target: T, source1: U, source2: V, source3: W): Assign<Assign<Assign<T, U>, V>, W>;

/**
* Copy the values of all of the enumerable own properties from one or more source objects to a
Expand Down