lodash: signatures of the method _.times changed

This commit is contained in:
Ilya Mochalov
2015-10-28 22:52:12 +05:00
parent 62eedc3121
commit b93b64bde3
2 changed files with 59 additions and 15 deletions
+44 -15
View File
@@ -4406,6 +4406,50 @@ module TestMixin {
result = _({}).runInContext();
}
// _.times
module TestTimes {
let iteratee: (num: number) => TResult;
{
let result: number[];
result = _.times(42);
}
{
let result: TResult[];
result = _.times(42, iteratee);
result = _.times(42, iteratee, any);
}
{
let result: _.LoDashImplicitArrayWrapper<number>;
result = _(42).times();
}
{
let result: _.LoDashImplicitArrayWrapper<TResult>;
result = _(42).times(iteratee);
result = _(42).times(iteratee, any);
}
{
let result: _.LoDashExplicitArrayWrapper<number>;
result = _(42).chain().times();
}
{
let result: _.LoDashExplicitArrayWrapper<TResult>;
result = _(42).chain().times(iteratee);
result = _(42).chain().times(iteratee, any);
}
}
// _.uniqueId
result = <string>_.uniqueId();
result = <string>_.uniqueId('');
@@ -4415,21 +4459,6 @@ result = <string>_.VERSION;
result = <_.Support>_.support;
result = <_.TemplateSettings>_.templateSettings;
// _.times
{
let result: number[];
result = _.times(42);
result = _(42).times().value();
}
{
let testTimesFn: (num: number) => TResult;
let result: TResult[];
result = _.times(42, testTimesFn);
result = _.times(42, testTimesFn, any);
result = _(42).times(testTimesFn).value();
result = _(42).times(testTimesFn, any).value();
}
// _.partial & _.partialRight
{
function func0(): number {
+15
View File
@@ -10303,6 +10303,21 @@ declare module _ {
times(): LoDashImplicitArrayWrapper<number>;
}
interface LoDashExplicitWrapper<T> {
/**
* @see _.times
*/
times<TResult>(
iteratee: (num: number) => TResult,
thisArgs?: any
): LoDashExplicitArrayWrapper<TResult>;
/**
* @see _.times
*/
times(): LoDashExplicitArrayWrapper<number>;
}
//_.uniqueId
interface LoDashStatic {
/**