Skip to content

Commit 87af974

Browse files
committed
Merge pull request DefinitelyTyped#5794 from chrootsu/lodash-noConflict
lodash: changed _.noConflict() method
2 parents 33d8672 + 0f25d7e commit 87af974

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

lodash/lodash-tests.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,8 +1751,6 @@ var testAttempFn: TestAttemptFn;
17511751
result = <TResult|Error>_.attempt<TResult>(testAttempFn);
17521752
result = <TResult|Error>_(testAttempFn).attempt<TResult>();
17531753

1754-
var lodash = <typeof _>_.noConflict();
1755-
17561754
result = <number>_.random(0, 5);
17571755
result = <number>_.random(5);
17581756
result = <number>_.random(5, true);
@@ -2077,6 +2075,15 @@ result = <number>(_(TestMethodOfObject).methodOf<number>(1, 2).value())(['a', '0
20772075
result = _(testMixinSource).mixin<TResult>(testMixinOptions).value();
20782076
}
20792077

2078+
// _.noConflict
2079+
{
2080+
let result: typeof _;
2081+
result = _.noConflict();
2082+
result = _(42).noConflict();
2083+
result = _<any>([]).noConflict();
2084+
result = _({}).noConflict();
2085+
}
2086+
20802087
// _.uniqueId
20812088
result = <string>_.uniqueId();
20822089
result = <string>_.uniqueId('');

lodash/lodash.d.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8424,9 +8424,17 @@ declare module _ {
84248424
//_.noConflict
84258425
interface LoDashStatic {
84268426
/**
8427-
* Reverts the '_' variable to its previous value and returns a reference to the lodash function.
8428-
* @return The lodash function.
8429-
**/
8427+
* Reverts the _ variable to its previous value and returns a reference to the lodash function.
8428+
*
8429+
* @return Returns the lodash function.
8430+
*/
8431+
noConflict(): typeof _;
8432+
}
8433+
8434+
interface LoDashWrapperBase<T, TWrapper> {
8435+
/**
8436+
* @see _.noConflict
8437+
*/
84308438
noConflict(): typeof _;
84318439
}
84328440

0 commit comments

Comments
 (0)