Skip to content

Commit 38acb6b

Browse files
author
falsandtru
committed
Use Partial types for Object.assign
1 parent 4ee8213 commit 38acb6b

File tree

3 files changed

+6
-87
lines changed

3 files changed

+6
-87
lines changed

lib/lib.es2015.core.d.ts

+2-29
Original file line numberDiff line numberDiff line change
@@ -296,36 +296,9 @@ interface ObjectConstructor {
296296
* Copy the values of all of the enumerable own properties from one or more source objects to a
297297
* target object. Returns the target object.
298298
* @param target The target object to copy to.
299-
* @param source The source object from which to copy properties.
299+
* @param sources The source objects from which to copy properties.
300300
*/
301-
assign<T, U>(target: T, source: U): T & U;
302-
303-
/**
304-
* Copy the values of all of the enumerable own properties from one or more source objects to a
305-
* target object. Returns the target object.
306-
* @param target The target object to copy to.
307-
* @param source1 The first source object from which to copy properties.
308-
* @param source2 The second source object from which to copy properties.
309-
*/
310-
assign<T, U, V>(target: T, source1: U, source2: V): T & U & V;
311-
312-
/**
313-
* Copy the values of all of the enumerable own properties from one or more source objects to a
314-
* target object. Returns the target object.
315-
* @param target The target object to copy to.
316-
* @param source1 The first source object from which to copy properties.
317-
* @param source2 The second source object from which to copy properties.
318-
* @param source3 The third source object from which to copy properties.
319-
*/
320-
assign<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
321-
322-
/**
323-
* Copy the values of all of the enumerable own properties from one or more source objects to a
324-
* target object. Returns the target object.
325-
* @param target The target object to copy to.
326-
* @param sources One or more source objects from which to copy properties
327-
*/
328-
assign(target: any, ...sources: any[]): any;
301+
assign<T>(target: Partial<T>, ...sources: Partial<T>[]): T;
329302

330303
/**
331304
* Returns an array of all symbol properties found directly on object o.

lib/lib.es6.d.ts

+2-29
Original file line numberDiff line numberDiff line change
@@ -4474,36 +4474,9 @@ interface ObjectConstructor {
44744474
* Copy the values of all of the enumerable own properties from one or more source objects to a
44754475
* target object. Returns the target object.
44764476
* @param target The target object to copy to.
4477-
* @param source The source object from which to copy properties.
4477+
* @param sources The source objects from which to copy properties.
44784478
*/
4479-
assign<T, U>(target: T, source: U): T & U;
4480-
4481-
/**
4482-
* Copy the values of all of the enumerable own properties from one or more source objects to a
4483-
* target object. Returns the target object.
4484-
* @param target The target object to copy to.
4485-
* @param source1 The first source object from which to copy properties.
4486-
* @param source2 The second source object from which to copy properties.
4487-
*/
4488-
assign<T, U, V>(target: T, source1: U, source2: V): T & U & V;
4489-
4490-
/**
4491-
* Copy the values of all of the enumerable own properties from one or more source objects to a
4492-
* target object. Returns the target object.
4493-
* @param target The target object to copy to.
4494-
* @param source1 The first source object from which to copy properties.
4495-
* @param source2 The second source object from which to copy properties.
4496-
* @param source3 The third source object from which to copy properties.
4497-
*/
4498-
assign<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
4499-
4500-
/**
4501-
* Copy the values of all of the enumerable own properties from one or more source objects to a
4502-
* target object. Returns the target object.
4503-
* @param target The target object to copy to.
4504-
* @param sources One or more source objects from which to copy properties
4505-
*/
4506-
assign(target: any, ...sources: any[]): any;
4479+
assign<T>(target: Partial<T>, ...sources: Partial<T>[]): T;
45074480

45084481
/**
45094482
* Returns an array of all symbol properties found directly on object o.

src/lib/es2015.core.d.ts

+2-29
Original file line numberDiff line numberDiff line change
@@ -276,36 +276,9 @@ interface ObjectConstructor {
276276
* Copy the values of all of the enumerable own properties from one or more source objects to a
277277
* target object. Returns the target object.
278278
* @param target The target object to copy to.
279-
* @param source The source object from which to copy properties.
279+
* @param sources The source objects from which to copy properties.
280280
*/
281-
assign<T, U>(target: T, source: U): T & U;
282-
283-
/**
284-
* Copy the values of all of the enumerable own properties from one or more source objects to a
285-
* target object. Returns the target object.
286-
* @param target The target object to copy to.
287-
* @param source1 The first source object from which to copy properties.
288-
* @param source2 The second source object from which to copy properties.
289-
*/
290-
assign<T, U, V>(target: T, source1: U, source2: V): T & U & V;
291-
292-
/**
293-
* Copy the values of all of the enumerable own properties from one or more source objects to a
294-
* target object. Returns the target object.
295-
* @param target The target object to copy to.
296-
* @param source1 The first source object from which to copy properties.
297-
* @param source2 The second source object from which to copy properties.
298-
* @param source3 The third source object from which to copy properties.
299-
*/
300-
assign<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
301-
302-
/**
303-
* Copy the values of all of the enumerable own properties from one or more source objects to a
304-
* target object. Returns the target object.
305-
* @param target The target object to copy to.
306-
* @param sources One or more source objects from which to copy properties
307-
*/
308-
assign(target: any, ...sources: any[]): any;
281+
assign<T>(target: Partial<T>, ...sources: Partial<T>[]): T;
309282

310283
/**
311284
* Returns an array of all symbol properties found directly on object o.

0 commit comments

Comments
 (0)