Skip to content

Commit 9267116

Browse files
committed
Merge pull request DefinitelyTyped#8574 from chrootsu/lodash-isWeakSet
lodash: added _.isWeakSet
2 parents 2f47c75 + eedec57 commit 9267116

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

lodash/lodash-tests.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7201,6 +7201,37 @@ module TestIsWeakMap {
72017201
}
72027202
}
72037203

7204+
// _.isWeakSet
7205+
module TestIsWeakSet {
7206+
{
7207+
let value: number|WeakSet<string>;
7208+
7209+
if (_.isWeakSet<string>(value)) {
7210+
let result: WeakSet<string> = value;
7211+
}
7212+
else {
7213+
let result: number = value;
7214+
}
7215+
}
7216+
7217+
{
7218+
let result: boolean;
7219+
7220+
result = _.isWeakSet(any);
7221+
result = _(1).isWeakSet();
7222+
result = _<any>([]).isWeakSet();
7223+
result = _({}).isWeakSet();
7224+
}
7225+
7226+
{
7227+
let result: _.LoDashExplicitWrapper<boolean>;
7228+
7229+
result = _(1).chain().isWeakSet();
7230+
result = _<any>([]).chain().isWeakSet();
7231+
result = _({}).chain().isWeakSet();
7232+
}
7233+
}
7234+
72047235
// _.lt
72057236
module TestLt {
72067237
{

lodash/lodash.d.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12292,6 +12292,31 @@ declare module _ {
1229212292
isWeakMap(): LoDashExplicitWrapper<boolean>;
1229312293
}
1229412294

12295+
//_.isWeakSet
12296+
interface LoDashStatic {
12297+
/**
12298+
* Checks if value is classified as a WeakSet object.
12299+
*
12300+
* @param value The value to check.
12301+
* @returns Returns true if value is correctly classified, else false.
12302+
*/
12303+
isWeakSet<T>(value?: any): value is WeakSet<T>;
12304+
}
12305+
12306+
interface LoDashImplicitWrapperBase<T, TWrapper> {
12307+
/**
12308+
* @see _.isWeakSet
12309+
*/
12310+
isWeakSet(): boolean;
12311+
}
12312+
12313+
interface LoDashExplicitWrapperBase<T, TWrapper> {
12314+
/**
12315+
* @see _.isWeakSet
12316+
*/
12317+
isWeakSet(): LoDashExplicitWrapper<boolean>;
12318+
}
12319+
1229512320
//_.lt
1229612321
interface LoDashStatic {
1229712322
/**
@@ -18512,4 +18537,5 @@ declare module "lodash" {
1851218537
// Backward compatibility with --target es5
1851318538
interface Set<T> {}
1851418539
interface Map<K, V> {}
18540+
interface WeakSet<T> {}
1851518541
interface WeakMap<K, V> {}

0 commit comments

Comments
 (0)