From c140acb6c8779b4279daecbe7b8463c3fa9add9b Mon Sep 17 00:00:00 2001 From: BehindTheMath <9314934+BehindTheMath@users.noreply.github.com> Date: Wed, 6 Nov 2019 19:05:44 -0500 Subject: [PATCH] [lodash] Fix stubTrue for TS v3.1+ (#40110) * [lodash] Fix stubTrue for TS v3.1+ Adds files that were left out of 2ce5aac that are used for TS v3.1+. * Fix errors --- types/lodash/ts3.1/common/util.d.ts | 25 +++++++++++++++++++++++++ types/lodash/ts3.1/lodash-tests.ts | 16 ++++++++-------- types/lodash/ts3.1/stubTrue.d.ts | 2 ++ types/lodash/ts3.1/tsconfig.json | 1 + 4 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 types/lodash/ts3.1/stubTrue.d.ts diff --git a/types/lodash/ts3.1/common/util.d.ts b/types/lodash/ts3.1/common/util.d.ts index 8e7e50a738..6b7c4f57d3 100644 --- a/types/lodash/ts3.1/common/util.d.ts +++ b/types/lodash/ts3.1/common/util.d.ts @@ -1158,4 +1158,29 @@ declare module "../index" { */ uniqueId(): StringChain; } + + // stubTrue + + interface LoDashStatic { + /** + * This method returns true. + * + * @return Returns true. + */ + stubTrue(): true; + } + + interface LoDashImplicitWrapper { + /** + * @see _.stubTrue + */ + stubTrue(): true; + } + + interface LoDashExplicitWrapper { + /** + * @see _.stubTrue + */ + stubTrue(): LoDashExplicitWrapper; + } } diff --git a/types/lodash/ts3.1/lodash-tests.ts b/types/lodash/ts3.1/lodash-tests.ts index 212c5e05cb..1c26667b05 100644 --- a/types/lodash/ts3.1/lodash-tests.ts +++ b/types/lodash/ts3.1/lodash-tests.ts @@ -6991,14 +6991,6 @@ fp.now(); // $ExpectType number fp.stubString(); // $ExpectType string } -// _.stubTrue -{ - _.stubTrue(); // $ExpectType true - _(anything).stubTrue(); // $ExpectType true - _.chain(anything).stubTrue(); // $ExpectType PrimitiveChain - fp.stubTrue(); // $ExpectType true -} - // _.times { const iteratee = (num: number): AbcObject => ({ a: 1, b: "", c: true }); @@ -7093,3 +7085,11 @@ _.templateSettings; // $ExpectType TemplateSettings fp.partialRight(func1)([42]); // $ExpectType Function0 fp.partialRight(func2)([42, fp.partialRight.placeholder]); // $ExpectType Function1 } + +// _.stubTrue +{ + _.stubTrue(); // $ExpectType true + _("").stubTrue(); // $ExpectType true + _.chain("").stubTrue(); // $ExpectType LoDashExplicitWrapper + fp.stubTrue(); // $ExpectType true +} diff --git a/types/lodash/ts3.1/stubTrue.d.ts b/types/lodash/ts3.1/stubTrue.d.ts new file mode 100644 index 0000000000..f2d4cf0997 --- /dev/null +++ b/types/lodash/ts3.1/stubTrue.d.ts @@ -0,0 +1,2 @@ +import { stubTrue } from "./index"; +export = stubTrue; diff --git a/types/lodash/ts3.1/tsconfig.json b/types/lodash/ts3.1/tsconfig.json index 648a04874e..2f4cfd2271 100644 --- a/types/lodash/ts3.1/tsconfig.json +++ b/types/lodash/ts3.1/tsconfig.json @@ -261,6 +261,7 @@ "spread.d.ts", "startCase.d.ts", "startsWith.d.ts", + "stubTrue.d.ts", "subtract.d.ts", "sum.d.ts", "sumBy.d.ts",