lodash: signatures of the method _.functions have been changed

This commit is contained in:
Ilya Mochalov
2015-11-15 10:15:22 +05:00
parent aed176536a
commit 446ae99855
2 changed files with 85 additions and 20 deletions
+48 -4
View File
@@ -5297,11 +5297,30 @@ result = <_.LoDashImplicitObjectWrapper<ZeroOne>>_({ '0': 'zero', '1': 'one', 'l
console.log(key);
});
result = <string[]>_.functions(_);
result = <string[]>_.methods(_);
// _.functions
module TestFunctions {
type SampleObject = {a: number; b: string; c: boolean;};
result = <_.LoDashImplicitArrayWrapper<string>>_(_).functions();
result = <_.LoDashImplicitArrayWrapper<string>>_(_).methods();
let object: SampleObject;
{
let result: string[];
result = _.functions<SampleObject>(object);
}
{
let result: _.LoDashImplicitArrayWrapper<string>;
result = _(object).functions();
}
{
let result: _.LoDashExplicitArrayWrapper<string>;
result = _(object).chain().functions();
}
}
// _.get
result = <number>_.get<number>({ 'a': [{ 'b': { 'c': 3 } }] }, 'a[0].b.c');
@@ -5444,6 +5463,31 @@ module TestMerge {
result = _({}).merge<TResult>({}, {}, {}, {}, {}, customizer, any).value();
}
// _.methods
module TestFunctions {
type SampleObject = {a: number; b: string; c: boolean;};
let object: SampleObject;
{
let result: string[];
result = _.methods<SampleObject>(object);
}
{
let result: _.LoDashImplicitArrayWrapper<string>;
result = _(object).methods();
}
{
let result: _.LoDashExplicitArrayWrapper<string>;
result = _(object).chain().methods();
}
}
interface HasName {
name: string;
}
+37 -16
View File
@@ -10069,29 +10069,28 @@ declare module _ {
//_.functions
interface LoDashStatic {
/**
* Creates a sorted array of property names of all enumerable properties, own and inherited, of
* object that have function values.
* @param object The object to inspect.
* @return An array of property names that have function values.
**/
functions(object: any): string[];
/**
* @see _functions
**/
methods(object: any): string[];
* Creates an array of function property names from all enumerable properties, own and inherited, of object.
*
* @alias _.methods
*
* @param object The object to inspect.
* @return Returns the new array of property names.
*/
functions<T extends {}>(object: any): string[];
}
interface LoDashImplicitObjectWrapper<T> {
/**
* @see _.functions
**/
* @see _.functions
*/
functions(): _.LoDashImplicitArrayWrapper<string>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.functions
**/
methods(): _.LoDashImplicitArrayWrapper<string>;
* @see _.functions
*/
functions(): _.LoDashExplicitArrayWrapper<string>;
}
//_.get
@@ -10462,6 +10461,28 @@ declare module _ {
): LoDashImplicitObjectWrapper<TResult>;
}
//_.methods
interface LoDashStatic {
/**
* @see _.functions
*/
methods<T extends {}>(object: any): string[];
}
interface LoDashImplicitObjectWrapper<T> {
/**
* @see _.functions
*/
methods(): _.LoDashImplicitArrayWrapper<string>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.functions
*/
methods(): _.LoDashExplicitArrayWrapper<string>;
}
//_.omit
interface LoDashStatic {
/**