mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-07 16:30:12 +08:00
lodash: signatures of the method _.constant changed
This commit is contained in:
+76
-10
@@ -3702,16 +3702,82 @@ result = <string[]>_('fred, barney, & pebbles').words(/[^, ]+/g);
|
||||
}
|
||||
|
||||
// _.constant
|
||||
result = <() => number>_.constant<number>(1);
|
||||
result = <() => string>_.constant<string>('a');
|
||||
result = <() => boolean>_.constant<boolean>(true);
|
||||
result = <() => any[]>_.constant<any[]>([]);
|
||||
result = <() => {}>_.constant<{}>({});
|
||||
result = <() => number>_(1).constant<number>();
|
||||
result = <() => string>_('a').constant<string>();
|
||||
result = <() => boolean>_(true).constant<boolean>();
|
||||
result = <() => any[]>_(['a']).constant<any[]>();
|
||||
result = <() => {}>_({}).constant<{}>();
|
||||
module TestConstant {
|
||||
{
|
||||
let result: () => number;
|
||||
result: _.constant<number>(42);
|
||||
}
|
||||
|
||||
{
|
||||
let result: () => string;
|
||||
result: _.constant<string>('a');
|
||||
}
|
||||
|
||||
{
|
||||
let result: () => boolean;
|
||||
result: _.constant<boolean>(true);
|
||||
}
|
||||
|
||||
{
|
||||
let result: () => string[];
|
||||
result: _.constant<string[]>(['a']);
|
||||
}
|
||||
|
||||
{
|
||||
let result: () => {a: string};
|
||||
result: _.constant<{a: string}>({a: 'a'});
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitObjectWrapper<() => number>;
|
||||
result: _(42).constant<number>();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitObjectWrapper<() => string>;
|
||||
result: _('a').constant<string>();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitObjectWrapper<() => boolean>;
|
||||
result: _(true).constant<boolean>();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitObjectWrapper<() => string[]>;
|
||||
result: _(['a']).constant<string[]>();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitObjectWrapper<() => {a: string}>;
|
||||
result: _({a: 'a'}).constant<{a: string}>();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitObjectWrapper<() => number>;
|
||||
result: _(42).chain().constant<number>();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitObjectWrapper<() => string>;
|
||||
result: _('a').chain().constant<string>();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitObjectWrapper<() => boolean>;
|
||||
result: _(true).chain().constant<boolean>();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitObjectWrapper<() => string[]>;
|
||||
result: _(['a']).chain().constant<string[]>();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitObjectWrapper<() => {a: string}>;
|
||||
result: _({a: 'a'}).chain().constant<{a: string}>();
|
||||
}
|
||||
}
|
||||
|
||||
// _.identity
|
||||
{
|
||||
|
||||
Vendored
+25
-17
@@ -9472,6 +9472,31 @@ declare module _ {
|
||||
callback<TResult>(thisArg?: any): LoDashImplicitObjectWrapper<(...args: any[]) => TResult>;
|
||||
}
|
||||
|
||||
//_.constant
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a function that returns value.
|
||||
*
|
||||
* @param value The value to return from the new function.
|
||||
* @return Returns the new function.
|
||||
*/
|
||||
constant<T>(value: T): () => T;
|
||||
}
|
||||
|
||||
interface LoDashImplicitWrapperBase<T, TWrapper> {
|
||||
/**
|
||||
* @see _.constant
|
||||
*/
|
||||
constant<TResult>(): LoDashImplicitObjectWrapper<() => TResult>;
|
||||
}
|
||||
|
||||
interface LoDashExplicitWrapperBase<T, TWrapper> {
|
||||
/**
|
||||
* @see _.constant
|
||||
*/
|
||||
constant<TResult>(): LoDashExplicitObjectWrapper<() => TResult>;
|
||||
}
|
||||
|
||||
//_.identity
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
@@ -9920,23 +9945,6 @@ declare module _ {
|
||||
uniqueId(): string;
|
||||
}
|
||||
|
||||
//_.constant
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a function that returns value.
|
||||
* @param value The value to return from the new function.
|
||||
* @return Returns the new function.
|
||||
*/
|
||||
constant<T>(value: T): () => T;
|
||||
}
|
||||
|
||||
interface LoDashImplicitWrapperBase<T, TWrapper> {
|
||||
/**
|
||||
* @see _.constant
|
||||
*/
|
||||
constant<TResult>(): () => TResult;
|
||||
}
|
||||
|
||||
interface ListIterator<T, TResult> {
|
||||
(value: T, index: number, collection: List<T>): TResult;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user