mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-04 16:04:45 +08:00
lodash: changed _.create() method
This commit is contained in:
@@ -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) {
|
||||
|
||||
Vendored
+19
-10
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user