lodash: changed _.create() method

This commit is contained in:
Ilya Mochalov
2015-08-13 01:34:13 +05:00
parent da995655d8
commit 9a7dc3c0e2
2 changed files with 38 additions and 10 deletions
+19
View File
@@ -1113,6 +1113,25 @@ result = <_.LoDashObjectWrapper<NameAge>>_({ 'name': 'moe' }).extend({ 'age': 40
return typeof a == 'undefined' ? b : a;
});
// _.create
interface TestCreateProto {
a: number;
}
interface TestCreateProps {
b: string;
}
interface TestCreateTResult extends TestCreateProto, TestCreateProps {}
var testCreateProto: TestCreateProto;
var testCreateProps: TestCreateProps;
result = <{}>_.create(testCreateProto);
result = <{}>_.create(testCreateProto, testCreateProps);
result = <TestCreateProto>_.create<TestCreateProto>(testCreateProto);
result = <TestCreateTResult>_.create<TestCreateTResult>(testCreateProto, testCreateProps);
result = <{}>_(testCreateProto).create().value();
result = <{}>_(testCreateProto).create(testCreateProps).value();
result = <TestCreateProto>_(testCreateProto).create<TestCreateProto>().value();
result = <TestCreateTResult>_(testCreateProto).create<TestCreateTResult>(testCreateProps).value();
result = <IStoogesAge[]>_.clone(stoogesAges);
result = <IStoogesAge[]>_.clone(stoogesAges, true);
result = <any>_.clone(stoogesAges, true, function (value) {
+19 -10
View File
@@ -6104,6 +6104,25 @@ declare module _ {
}
//_.create
interface LoDashStatic {
/**
* Creates an object that inherits from the given prototype object. If a properties object is provided its own
* enumerable properties are assigned to the created object.
* @param prototype The object to inherit from.
* @param properties The properties to assign to the object.
* @return Returns the new object.
*/
create<TResult extends {}>(prototype: Object, properties?: Object): TResult;
}
interface LoDashObjectWrapper<T> {
/**
* @see _.create
*/
create<TResult extends {}>(properties?: Object): LoDashObjectWrapper<TResult>;
}
//_.clone
interface LoDashStatic {
/**
@@ -7391,16 +7410,6 @@ declare module _ {
constant<TResult>(): () => TResult;
}
//_.create
interface LoDashStatic {
/**
* Creates an object that inherits from the given prototype object. If a properties object is provided its own enumerable properties are assigned to the created object.
* @param prototype The object to inherit from.
* @param properties The properties to assign to the object.
*/
create<T>(prototype: Object, properties?: Object): Object;
}
interface ListIterator<T, TResult> {
(value: T, index: number, collection: T[]): TResult;
}