From 9a87ce6688807fa0a1222ef7d9fc682848d1d64f Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 10 Feb 2016 21:49:02 +0500 Subject: [PATCH] lodash: changed _.last --- lodash/lodash-3.10-tests.ts | 21 +++++++++++++++++---- lodash/lodash-3.10.d.ts | 18 ++++++++++++++++-- lodash/lodash-tests.ts | 21 +++++++++++++++++---- lodash/lodash.d.ts | 18 ++++++++++++++++-- 4 files changed, 66 insertions(+), 12 deletions(-) diff --git a/lodash/lodash-3.10-tests.ts b/lodash/lodash-3.10-tests.ts index 9459b5eb9..2cfa2c8e6 100644 --- a/lodash/lodash-3.10-tests.ts +++ b/lodash/lodash-3.10-tests.ts @@ -950,6 +950,13 @@ module TestLast { let array: TResult[]; let list: _.List; + { + let result: string; + + result = _.last('abc'); + result = _('abc').last(); + } + { let result: TResult; @@ -961,15 +968,21 @@ module TestLast { } { - let result: _.LoDashExplicitArrayWrapper; + let result: _.LoDashExplicitWrapper; - result = _(array).chain().last(); + result = _('abc').chain().last(); } { - let result: _.LoDashExplicitObjectWrapper<_.List>; + let result: _.LoDashExplicitObjectWrapper; - result = _(list).chain().last<_.List>(); + result = _(array).chain().last<_.LoDashExplicitObjectWrapper>(); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(list).chain().last<_.LoDashExplicitObjectWrapper>(); } } diff --git a/lodash/lodash-3.10.d.ts b/lodash/lodash-3.10.d.ts index f5cfe0754..4e00acaa3 100644 --- a/lodash/lodash-3.10.d.ts +++ b/lodash/lodash-3.10.d.ts @@ -1472,6 +1472,13 @@ declare module _ { last(array: List): T; } + interface LoDashImplicitWrapper { + /** + * @see _.last + */ + last(): string; + } + interface LoDashImplicitArrayWrapper { /** * @see _.last @@ -1486,18 +1493,25 @@ declare module _ { last(): T; } + interface LoDashExplicitWrapper { + /** + * @see _.last + */ + last(): LoDashExplicitWrapper; + } + interface LoDashExplicitArrayWrapper { /** * @see _.last */ - last(): LoDashExplicitArrayWrapper; + last(): T; } interface LoDashExplicitObjectWrapper { /** * @see _.last */ - last(): LoDashExplicitObjectWrapper; + last(): T; } //_.lastIndexOf diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index afbad410d..83257084a 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1167,6 +1167,13 @@ module TestLast { let array: TResult[]; let list: _.List; + { + let result: string; + + result = _.last('abc'); + result = _('abc').last(); + } + { let result: TResult; @@ -1178,15 +1185,21 @@ module TestLast { } { - let result: _.LoDashExplicitArrayWrapper; + let result: _.LoDashExplicitWrapper; - result = _(array).chain().last(); + result = _('abc').chain().last(); } { - let result: _.LoDashExplicitObjectWrapper<_.List>; + let result: _.LoDashExplicitObjectWrapper; - result = _(list).chain().last<_.List>(); + result = _(array).chain().last<_.LoDashExplicitObjectWrapper>(); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(list).chain().last<_.LoDashExplicitObjectWrapper>(); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 02a32583a..8849c149f 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2506,6 +2506,13 @@ declare module _ { last(array: List): T; } + interface LoDashImplicitWrapper { + /** + * @see _.last + */ + last(): string; + } + interface LoDashImplicitArrayWrapper { /** * @see _.last @@ -2520,18 +2527,25 @@ declare module _ { last(): T; } + interface LoDashExplicitWrapper { + /** + * @see _.last + */ + last(): LoDashExplicitWrapper; + } + interface LoDashExplicitArrayWrapper { /** * @see _.last */ - last(): LoDashExplicitArrayWrapper; + last(): T; } interface LoDashExplicitObjectWrapper { /** * @see _.last */ - last(): LoDashExplicitObjectWrapper; + last(): T; } //_.lastIndexOf