mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #5098 from chrootsu/lodash-constant
lodash: changed _.constant() method (added to the chainable wrapper, ad…
This commit is contained in:
@@ -1373,6 +1373,18 @@ result = <string[]>_.words('fred, barney, & pebbles', /[^, ]+/g);
|
||||
* Utilities *
|
||||
***********/
|
||||
|
||||
// _.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<{}>();
|
||||
|
||||
result = <string>_.VERSION;
|
||||
result = <_.Support>_.support;
|
||||
result = <_.TemplateSettings>_.templateSettings;
|
||||
|
||||
Vendored
+11
-2
@@ -6990,11 +6990,20 @@ declare module _ {
|
||||
//_.constant
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a function that returns value..
|
||||
**/
|
||||
* 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 LoDashWrapperBase<T, TWrapper> {
|
||||
/**
|
||||
* @see _.constant
|
||||
*/
|
||||
constant<TResult>(): () => TResult;
|
||||
}
|
||||
|
||||
//_.create
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user