Skip to content

Commit

Permalink
Merge pull request DefinitelyTyped#8574 from chrootsu/lodash-isWeakSet
Browse files Browse the repository at this point in the history
lodash: added _.isWeakSet
  • Loading branch information
Igorbek committed Mar 17, 2016
2 parents 2f47c75 + eedec57 commit 9267116
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
31 changes: 31 additions & 0 deletions lodash/lodash-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7201,6 +7201,37 @@ module TestIsWeakMap {
}
}

// _.isWeakSet
module TestIsWeakSet {
{
let value: number|WeakSet<string>;

if (_.isWeakSet<string>(value)) {
let result: WeakSet<string> = value;
}
else {
let result: number = value;
}
}

{
let result: boolean;

result = _.isWeakSet(any);
result = _(1).isWeakSet();
result = _<any>([]).isWeakSet();
result = _({}).isWeakSet();
}

{
let result: _.LoDashExplicitWrapper<boolean>;

result = _(1).chain().isWeakSet();
result = _<any>([]).chain().isWeakSet();
result = _({}).chain().isWeakSet();
}
}

// _.lt
module TestLt {
{
Expand Down
26 changes: 26 additions & 0 deletions lodash/lodash.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12292,6 +12292,31 @@ declare module _ {
isWeakMap(): LoDashExplicitWrapper<boolean>;
}

//_.isWeakSet
interface LoDashStatic {
/**
* Checks if value is classified as a WeakSet object.
*
* @param value The value to check.
* @returns Returns true if value is correctly classified, else false.
*/
isWeakSet<T>(value?: any): value is WeakSet<T>;
}

interface LoDashImplicitWrapperBase<T, TWrapper> {
/**
* @see _.isWeakSet
*/
isWeakSet(): boolean;
}

interface LoDashExplicitWrapperBase<T, TWrapper> {
/**
* @see _.isWeakSet
*/
isWeakSet(): LoDashExplicitWrapper<boolean>;
}

//_.lt
interface LoDashStatic {
/**
Expand Down Expand Up @@ -18512,4 +18537,5 @@ declare module "lodash" {
// Backward compatibility with --target es5
interface Set<T> {}
interface Map<K, V> {}
interface WeakSet<T> {}
interface WeakMap<K, V> {}

0 comments on commit 9267116

Please sign in to comment.