[ember] Polyfill: allow assign to take in more than 4 args (#30424)

* [ember] Polyfill: allow assign to take in more than 4 args

* Return type should be object

* Adjust tests in response to modified return type

Co-Authored-By: dorilla <dcmaglasang@gmail.com>

* Change return type back to “any”

In order to facilitate direct property access

* Change return type back to “any”

In order to facilitate direct property access
This commit is contained in:
Dan Maglasang
2018-11-14 17:46:11 -08:00
committed by Pranav Senthilnathan
parent dbe62c60d9
commit 5bf49a7068
2 changed files with 2 additions and 0 deletions
@@ -11,6 +11,7 @@ import { assign, merge } from '@ember/polyfills';
assign({ a: 'hello' }, { b: 6 }, { a: true }).a; // $ExpectType boolean
assign({ a: 'hello' }, '', { a: true }).a; // $ExpectError
assign({ d: ['gobias industries'] }, { a: 'hello' }, { b: 6 }, { a: true }).d; // $ExpectType string[]
assign({}, { a: 0 }, { b: 1 }, { c: 2 }, { d: 3 }).a; // $ExpectType any
})();
(() => { /* merge */
+1
View File
@@ -13,6 +13,7 @@ import { Mix, Mix3, Mix4 } from './types';
export function assign<T extends object, U extends object>(target: T, source: U): Mix<T, U>;
export function assign<T extends object, U extends object, V extends object>(target: T, source1: U, source2: V): Mix3<T, U, V>;
export function assign<T extends object, U extends object, V extends object, W extends object>(target: T, source1: U, source2: V, source3: W): Mix4<T, U, V, W>;
export function assign(target: object, ...sources: object[]): any;
/**
* Merge the contents of two objects together into the first object.