mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-07 09:49:07 +00:00
lodash: changed _.result
This commit is contained in:
@@ -8985,14 +8985,114 @@ namespace TestPick {
|
||||
}
|
||||
|
||||
// _.result
|
||||
{
|
||||
let testResultPath: number|string|boolean|Array<number|string|boolean>;
|
||||
let testResultDefaultValue: TResult;
|
||||
let result: TResult;
|
||||
result = _.result<{}, TResult>({}, testResultPath);
|
||||
result = _.result<{}, TResult>({}, testResultPath, testResultDefaultValue);
|
||||
result = _({}).result<TResult>(testResultPath);
|
||||
result = _({}).result<TResult>(testResultPath, testResultDefaultValue);
|
||||
namespace TestResult {
|
||||
{
|
||||
let result: string;
|
||||
|
||||
result = _.result<string, string>('abc', '0');
|
||||
result = _.result<string, string>('abc', '0', '_');
|
||||
result = _.result<string, string>('abc', '0', () => '_');
|
||||
result = _.result<string, string>('abc', ['0']);
|
||||
result = _.result<string, string>('abc', ['0'], '_');
|
||||
result = _.result<string, string>('abc', ['0'], () => '_');
|
||||
|
||||
result = _.result<string>('abc', '0');
|
||||
result = _.result<string>('abc', '0', '_');
|
||||
result = _.result<string>('abc', '0', () => '_');
|
||||
result = _.result<string>('abc', ['0']);
|
||||
result = _.result<string>('abc', ['0'], '_');
|
||||
result = _.result<string>('abc', ['0'], () => '_');
|
||||
|
||||
result = _('abc').result<string>('0');
|
||||
result = _('abc').result<string>('0', '_');
|
||||
result = _('abc').result<string>('0', () => '_');
|
||||
result = _('abc').result<string>(['0']);
|
||||
result = _('abc').result<string>(['0'], '_');
|
||||
result = _('abc').result<string>(['0'], () => '_');
|
||||
}
|
||||
|
||||
{
|
||||
let result: number;
|
||||
|
||||
result = _.result<number[], number>([42], '0');
|
||||
result = _.result<number[], number>([42], '0', -1);
|
||||
result = _.result<number[], number>([42], '0', () => -1);
|
||||
result = _.result<number[], number>([42], ['0']);
|
||||
result = _.result<number[], number>([42], ['0'], -1);
|
||||
result = _.result<number[], number>([42], ['0'], () => -1);
|
||||
|
||||
result = _.result<number>([42], '0');
|
||||
result = _.result<number>([42], '0', -1);
|
||||
result = _.result<number>([42], '0', () => -1);
|
||||
result = _.result<number>([42], ['0']);
|
||||
result = _.result<number>([42], ['0'], -1);
|
||||
result = _.result<number>([42], ['0'], () => -1);
|
||||
|
||||
result = _([42]).result<number>('0');
|
||||
result = _([42]).result<number>('0', -1);
|
||||
result = _([42]).result<number>('0', () => -1);
|
||||
result = _([42]).result<number>(['0']);
|
||||
result = _([42]).result<number>(['0'], -1);
|
||||
result = _([42]).result<number>(['0'], () => -1);
|
||||
}
|
||||
|
||||
{
|
||||
let result: boolean;
|
||||
|
||||
result = _.result<{a: boolean}, boolean>({a: true}, 'a');
|
||||
result = _.result<{a: boolean}, boolean>({a: true}, 'a', false);
|
||||
result = _.result<{a: boolean}, boolean>({a: true}, 'a', () => false);
|
||||
result = _.result<{a: boolean}, boolean>({a: true}, ['a']);
|
||||
result = _.result<{a: boolean}, boolean>({a: true}, ['a'], false);
|
||||
result = _.result<{a: boolean}, boolean>({a: true}, ['a'], () => false);
|
||||
|
||||
result = _.result<boolean>({a: true}, 'a');
|
||||
result = _.result<boolean>({a: true}, 'a', false);
|
||||
result = _.result<boolean>({a: true}, 'a', () => false);
|
||||
result = _.result<boolean>({a: true}, ['a']);
|
||||
result = _.result<boolean>({a: true}, ['a'], false);
|
||||
result = _.result<boolean>({a: true}, ['a'], () => false);
|
||||
|
||||
result = _({a: true}).result<boolean>('a');
|
||||
result = _({a: true}).result<boolean>('a', false);
|
||||
result = _({a: true}).result<boolean>('a', () => false);
|
||||
result = _({a: true}).result<boolean>(['a']);
|
||||
result = _({a: true}).result<boolean>(['a'], false);
|
||||
result = _({a: true}).result<boolean>(['a'], () => false);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitWrapper<string>;
|
||||
|
||||
result = _('abc').chain().result<_.LoDashExplicitWrapper<string>>('0');
|
||||
result = _('abc').chain().result<_.LoDashExplicitWrapper<string>>('0', '_');
|
||||
result = _('abc').chain().result<_.LoDashExplicitWrapper<string>>('0', '_');
|
||||
result = _('abc').chain().result<_.LoDashExplicitWrapper<string>>(['0']);
|
||||
result = _('abc').chain().result<_.LoDashExplicitWrapper<string>>(['0'], () => '_');
|
||||
result = _('abc').chain().result<_.LoDashExplicitWrapper<string>>(['0'], () => '_');
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitWrapper<number>;
|
||||
|
||||
result = _([42]).chain().result<_.LoDashExplicitWrapper<number>>('0');
|
||||
result = _([42]).chain().result<_.LoDashExplicitWrapper<number>>('0', -1);
|
||||
result = _([42]).chain().result<_.LoDashExplicitWrapper<number>>('0', () => -1);
|
||||
result = _([42]).chain().result<_.LoDashExplicitWrapper<number>>(['0']);
|
||||
result = _([42]).chain().result<_.LoDashExplicitWrapper<number>>(['0'], -1);
|
||||
result = _([42]).chain().result<_.LoDashExplicitWrapper<number>>(['0'], () => -1);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitWrapper<boolean>;
|
||||
|
||||
result = _({a: true}).chain().result<_.LoDashExplicitWrapper<boolean>>('a');
|
||||
result = _({a: true}).chain().result<_.LoDashExplicitWrapper<boolean>>('a', false);
|
||||
result = _({a: true}).chain().result<_.LoDashExplicitWrapper<boolean>>('a', () => false);
|
||||
result = _({a: true}).chain().result<_.LoDashExplicitWrapper<boolean>>(['a']);
|
||||
result = _({a: true}).chain().result<_.LoDashExplicitWrapper<boolean>>(['a'], false);
|
||||
result = _({a: true}).chain().result<_.LoDashExplicitWrapper<boolean>>(['a'], () => false);
|
||||
}
|
||||
}
|
||||
|
||||
// _.set
|
||||
|
||||
71
lodash/lodash-3.10.d.ts
vendored
71
lodash/lodash-3.10.d.ts
vendored
@@ -13833,21 +13833,80 @@ declare module _ {
|
||||
*/
|
||||
result<TObject, TResult>(
|
||||
object: TObject,
|
||||
path: number|string|boolean|Array<number|string|boolean>,
|
||||
defaultValue?: TResult
|
||||
path: StringRepresentable|StringRepresentable[],
|
||||
defaultValue?: TResult|((...args: any[]) => TResult)
|
||||
): TResult;
|
||||
}
|
||||
|
||||
interface LoDashImplicitWrapperBase<T, TWrapper> {
|
||||
/**
|
||||
* @see _.result
|
||||
*/
|
||||
result<TResult>(
|
||||
path: number|string|boolean|Array<number|string|boolean>,
|
||||
defaultValue?: TResult
|
||||
object: any,
|
||||
path: StringRepresentable|StringRepresentable[],
|
||||
defaultValue?: TResult|((...args: any[]) => TResult)
|
||||
): TResult;
|
||||
}
|
||||
|
||||
interface LoDashImplicitWrapper<T> {
|
||||
/**
|
||||
* @see _.result
|
||||
*/
|
||||
result<TResult>(
|
||||
path: StringRepresentable|StringRepresentable[],
|
||||
defaultValue?: TResult|((...args: any[]) => TResult)
|
||||
): TResult;
|
||||
}
|
||||
|
||||
interface LoDashImplicitArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.result
|
||||
*/
|
||||
result<TResult>(
|
||||
path: StringRepresentable|StringRepresentable[],
|
||||
defaultValue?: TResult|((...args: any[]) => TResult)
|
||||
): TResult;
|
||||
}
|
||||
|
||||
interface LoDashImplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.result
|
||||
*/
|
||||
result<TResult>(
|
||||
path: StringRepresentable|StringRepresentable[],
|
||||
defaultValue?: TResult|((...args: any[]) => TResult)
|
||||
): TResult;
|
||||
}
|
||||
|
||||
interface LoDashExplicitWrapper<T> {
|
||||
/**
|
||||
* @see _.result
|
||||
*/
|
||||
result<TResultWrapper>(
|
||||
path: StringRepresentable|StringRepresentable[],
|
||||
defaultValue?: any
|
||||
): TResultWrapper;
|
||||
}
|
||||
|
||||
interface LoDashExplicitArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.result
|
||||
*/
|
||||
result<TResultWrapper>(
|
||||
path: StringRepresentable|StringRepresentable[],
|
||||
defaultValue?: any
|
||||
): TResultWrapper;
|
||||
}
|
||||
|
||||
interface LoDashExplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.result
|
||||
*/
|
||||
result<TResultWrapper>(
|
||||
path: StringRepresentable|StringRepresentable[],
|
||||
defaultValue?: any
|
||||
): TResultWrapper;
|
||||
}
|
||||
|
||||
//_.set
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
@@ -9901,14 +9901,114 @@ namespace TestPickBy {
|
||||
}
|
||||
|
||||
// _.result
|
||||
{
|
||||
let testResultPath: number|string|boolean|Array<number|string|boolean>;
|
||||
let testResultDefaultValue: TResult;
|
||||
let result: TResult;
|
||||
result = _.result<{}, TResult>({}, testResultPath);
|
||||
result = _.result<{}, TResult>({}, testResultPath, testResultDefaultValue);
|
||||
result = _({}).result<TResult>(testResultPath);
|
||||
result = _({}).result<TResult>(testResultPath, testResultDefaultValue);
|
||||
namespace TestResult {
|
||||
{
|
||||
let result: string;
|
||||
|
||||
result = _.result<string, string>('abc', '0');
|
||||
result = _.result<string, string>('abc', '0', '_');
|
||||
result = _.result<string, string>('abc', '0', () => '_');
|
||||
result = _.result<string, string>('abc', ['0']);
|
||||
result = _.result<string, string>('abc', ['0'], '_');
|
||||
result = _.result<string, string>('abc', ['0'], () => '_');
|
||||
|
||||
result = _.result<string>('abc', '0');
|
||||
result = _.result<string>('abc', '0', '_');
|
||||
result = _.result<string>('abc', '0', () => '_');
|
||||
result = _.result<string>('abc', ['0']);
|
||||
result = _.result<string>('abc', ['0'], '_');
|
||||
result = _.result<string>('abc', ['0'], () => '_');
|
||||
|
||||
result = _('abc').result<string>('0');
|
||||
result = _('abc').result<string>('0', '_');
|
||||
result = _('abc').result<string>('0', () => '_');
|
||||
result = _('abc').result<string>(['0']);
|
||||
result = _('abc').result<string>(['0'], '_');
|
||||
result = _('abc').result<string>(['0'], () => '_');
|
||||
}
|
||||
|
||||
{
|
||||
let result: number;
|
||||
|
||||
result = _.result<number[], number>([42], '0');
|
||||
result = _.result<number[], number>([42], '0', -1);
|
||||
result = _.result<number[], number>([42], '0', () => -1);
|
||||
result = _.result<number[], number>([42], ['0']);
|
||||
result = _.result<number[], number>([42], ['0'], -1);
|
||||
result = _.result<number[], number>([42], ['0'], () => -1);
|
||||
|
||||
result = _.result<number>([42], '0');
|
||||
result = _.result<number>([42], '0', -1);
|
||||
result = _.result<number>([42], '0', () => -1);
|
||||
result = _.result<number>([42], ['0']);
|
||||
result = _.result<number>([42], ['0'], -1);
|
||||
result = _.result<number>([42], ['0'], () => -1);
|
||||
|
||||
result = _([42]).result<number>('0');
|
||||
result = _([42]).result<number>('0', -1);
|
||||
result = _([42]).result<number>('0', () => -1);
|
||||
result = _([42]).result<number>(['0']);
|
||||
result = _([42]).result<number>(['0'], -1);
|
||||
result = _([42]).result<number>(['0'], () => -1);
|
||||
}
|
||||
|
||||
{
|
||||
let result: boolean;
|
||||
|
||||
result = _.result<{a: boolean}, boolean>({a: true}, 'a');
|
||||
result = _.result<{a: boolean}, boolean>({a: true}, 'a', false);
|
||||
result = _.result<{a: boolean}, boolean>({a: true}, 'a', () => false);
|
||||
result = _.result<{a: boolean}, boolean>({a: true}, ['a']);
|
||||
result = _.result<{a: boolean}, boolean>({a: true}, ['a'], false);
|
||||
result = _.result<{a: boolean}, boolean>({a: true}, ['a'], () => false);
|
||||
|
||||
result = _.result<boolean>({a: true}, 'a');
|
||||
result = _.result<boolean>({a: true}, 'a', false);
|
||||
result = _.result<boolean>({a: true}, 'a', () => false);
|
||||
result = _.result<boolean>({a: true}, ['a']);
|
||||
result = _.result<boolean>({a: true}, ['a'], false);
|
||||
result = _.result<boolean>({a: true}, ['a'], () => false);
|
||||
|
||||
result = _({a: true}).result<boolean>('a');
|
||||
result = _({a: true}).result<boolean>('a', false);
|
||||
result = _({a: true}).result<boolean>('a', () => false);
|
||||
result = _({a: true}).result<boolean>(['a']);
|
||||
result = _({a: true}).result<boolean>(['a'], false);
|
||||
result = _({a: true}).result<boolean>(['a'], () => false);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitWrapper<string>;
|
||||
|
||||
result = _('abc').chain().result<_.LoDashExplicitWrapper<string>>('0');
|
||||
result = _('abc').chain().result<_.LoDashExplicitWrapper<string>>('0', '_');
|
||||
result = _('abc').chain().result<_.LoDashExplicitWrapper<string>>('0', '_');
|
||||
result = _('abc').chain().result<_.LoDashExplicitWrapper<string>>(['0']);
|
||||
result = _('abc').chain().result<_.LoDashExplicitWrapper<string>>(['0'], () => '_');
|
||||
result = _('abc').chain().result<_.LoDashExplicitWrapper<string>>(['0'], () => '_');
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitWrapper<number>;
|
||||
|
||||
result = _([42]).chain().result<_.LoDashExplicitWrapper<number>>('0');
|
||||
result = _([42]).chain().result<_.LoDashExplicitWrapper<number>>('0', -1);
|
||||
result = _([42]).chain().result<_.LoDashExplicitWrapper<number>>('0', () => -1);
|
||||
result = _([42]).chain().result<_.LoDashExplicitWrapper<number>>(['0']);
|
||||
result = _([42]).chain().result<_.LoDashExplicitWrapper<number>>(['0'], -1);
|
||||
result = _([42]).chain().result<_.LoDashExplicitWrapper<number>>(['0'], () => -1);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitWrapper<boolean>;
|
||||
|
||||
result = _({a: true}).chain().result<_.LoDashExplicitWrapper<boolean>>('a');
|
||||
result = _({a: true}).chain().result<_.LoDashExplicitWrapper<boolean>>('a', false);
|
||||
result = _({a: true}).chain().result<_.LoDashExplicitWrapper<boolean>>('a', () => false);
|
||||
result = _({a: true}).chain().result<_.LoDashExplicitWrapper<boolean>>(['a']);
|
||||
result = _({a: true}).chain().result<_.LoDashExplicitWrapper<boolean>>(['a'], false);
|
||||
result = _({a: true}).chain().result<_.LoDashExplicitWrapper<boolean>>(['a'], () => false);
|
||||
}
|
||||
}
|
||||
|
||||
// _.set
|
||||
|
||||
71
lodash/lodash.d.ts
vendored
71
lodash/lodash.d.ts
vendored
@@ -16522,21 +16522,80 @@ declare module _ {
|
||||
*/
|
||||
result<TObject, TResult>(
|
||||
object: TObject,
|
||||
path: number|string|boolean|Array<number|string|boolean>,
|
||||
defaultValue?: TResult
|
||||
path: StringRepresentable|StringRepresentable[],
|
||||
defaultValue?: TResult|((...args: any[]) => TResult)
|
||||
): TResult;
|
||||
}
|
||||
|
||||
interface LoDashImplicitWrapperBase<T, TWrapper> {
|
||||
/**
|
||||
* @see _.result
|
||||
*/
|
||||
result<TResult>(
|
||||
path: number|string|boolean|Array<number|string|boolean>,
|
||||
defaultValue?: TResult
|
||||
object: any,
|
||||
path: StringRepresentable|StringRepresentable[],
|
||||
defaultValue?: TResult|((...args: any[]) => TResult)
|
||||
): TResult;
|
||||
}
|
||||
|
||||
interface LoDashImplicitWrapper<T> {
|
||||
/**
|
||||
* @see _.result
|
||||
*/
|
||||
result<TResult>(
|
||||
path: StringRepresentable|StringRepresentable[],
|
||||
defaultValue?: TResult|((...args: any[]) => TResult)
|
||||
): TResult;
|
||||
}
|
||||
|
||||
interface LoDashImplicitArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.result
|
||||
*/
|
||||
result<TResult>(
|
||||
path: StringRepresentable|StringRepresentable[],
|
||||
defaultValue?: TResult|((...args: any[]) => TResult)
|
||||
): TResult;
|
||||
}
|
||||
|
||||
interface LoDashImplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.result
|
||||
*/
|
||||
result<TResult>(
|
||||
path: StringRepresentable|StringRepresentable[],
|
||||
defaultValue?: TResult|((...args: any[]) => TResult)
|
||||
): TResult;
|
||||
}
|
||||
|
||||
interface LoDashExplicitWrapper<T> {
|
||||
/**
|
||||
* @see _.result
|
||||
*/
|
||||
result<TResultWrapper>(
|
||||
path: StringRepresentable|StringRepresentable[],
|
||||
defaultValue?: any
|
||||
): TResultWrapper;
|
||||
}
|
||||
|
||||
interface LoDashExplicitArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.result
|
||||
*/
|
||||
result<TResultWrapper>(
|
||||
path: StringRepresentable|StringRepresentable[],
|
||||
defaultValue?: any
|
||||
): TResultWrapper;
|
||||
}
|
||||
|
||||
interface LoDashExplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.result
|
||||
*/
|
||||
result<TResultWrapper>(
|
||||
path: StringRepresentable|StringRepresentable[],
|
||||
defaultValue?: any
|
||||
): TResultWrapper;
|
||||
}
|
||||
|
||||
//_.set
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user