Skip to content

Commit

Permalink
Add defs to Chai and LRUCache (#3201)
Browse files Browse the repository at this point in the history
* Add matches alias to chai definition

* Add prune to lrucache 4.0.x
Remove use of Object and Function where it caused ambiguity
  • Loading branch information
rifflock authored and AndrewSouthpaw committed Mar 14, 2019
1 parent 5b6789b commit 2ea1923
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
9 changes: 5 additions & 4 deletions definitions/npm/chai_v3.5.x/flow_v0.25.0-/chai_v3.5.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ declare module "chai" {
lengthOf: (value: number) => ExpectChain<T>,

match: (regex: RegExp) => ExpectChain<T>,
matches: (regex: RegExp) => ExpectChain<T>,
string: (string: string) => ExpectChain<T>,

key: (key: string) => ExpectChain<T>,
Expand Down Expand Up @@ -116,11 +117,11 @@ declare module "chai" {
notify: (callback: () => mixed) => ExpectChain<T>,

// chai-subset
containSubset: (obj: Object | Object[]) => ExpectChain<T>,
containSubset: (obj: {} | Array< {} >) => ExpectChain<T>,

// chai-redux-mock-store
dispatchedActions: (
actions: Array<Object | ((action: Object) => any)>
actions: Array<{} | ((action: {}) => any)>
) => ExpectChain<T>,
dispatchedTypes: (actions: Array<string>) => ExpectChain<T>
};
Expand Down Expand Up @@ -192,8 +193,8 @@ declare module "chai" {
static typeOf(val: mixed, type: string, msg?: string): void;
static notTypeOf(val: mixed, type: string, msg?: string): void;

static instanceOf(val: mixed, constructor: Function, msg?: string): void;
static notInstanceOf(val: mixed, constructor: Function, msg?: string): void;
static instanceOf(val: mixed, constructor: Class< * >, msg?: string): void;
static notInstanceOf(val: mixed, constructor: Class< * >, msg?: string): void;

static include(exp: string, inc: mixed, msg?: string): void;
static include<T>(exp: Array<T>, inc: T, msg?: string): void;
Expand Down
1 change: 1 addition & 0 deletions definitions/npm/chai_v3.5.x/test_chai_v3.5.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ expect([1, 2, 3]).to.have.length(3);
expect([1, 2, 3]).to.have.length("three");

expect("abc").to.match(/[a-z]{3}/);
expect("abc").to.be.a("string").that.matches(/[a-z]{3}/);
expect("abc").to.have.string("b");

expect({ a: 1, b: 2 }).to.have.key("a");
Expand Down
10 changes: 6 additions & 4 deletions definitions/npm/chai_v4.x.x/flow_v0.25.0-/chai_v4.x.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ declare module "chai" {
lengthOf: (value: number, message?: string) => ExpectChain<T>,

match: (regex: RegExp, message?: string) => ExpectChain<T>,
matches: (regex: RegExp, message?: string) => ExpectChain<T>,

string: (string: string, message?: string) => ExpectChain<T>,

key: (key: string) => ExpectChain<T>,
Expand Down Expand Up @@ -134,11 +136,11 @@ declare module "chai" {
fulfilled: () => Promise<mixed> & ExpectChain<T>,

// chai-subset
containSubset: (obj: Object | Object[]) => ExpectChain<T>,
containSubset: (obj: {} | Array< {} >) => ExpectChain<T>,

// chai-redux-mock-store
dispatchedActions: (
actions: Array<Object | ((action: Object) => any)>
actions: Array<{} | ((action: {}) => any)>
) => ExpectChain<T>,
dispatchedTypes: (actions: Array<string>) => ExpectChain<T>,

Expand Down Expand Up @@ -227,8 +229,8 @@ declare module "chai" {
static typeOf(val: mixed, type: string, msg?: string): void;
static notTypeOf(val: mixed, type: string, msg?: string): void;

static instanceOf(val: mixed, constructor: Function, msg?: string): void;
static notInstanceOf(val: mixed, constructor: Function, msg?: string): void;
static instanceOf(val: mixed, constructor: Class< * >, msg?: string): void;
static notInstanceOf(val: mixed, constructor: Class< * >, msg?: string): void;

static include(exp: string, inc: mixed, msg?: string): void;
static include<T>(exp: Array<T>, inc: T, msg?: string): void;
Expand Down
1 change: 1 addition & 0 deletions definitions/npm/chai_v4.x.x/test_chai_v4.x.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ expect([1, 2, 3]).to.have.length(3);
expect([1, 2, 3]).to.have.length("three");

expect("abc").to.match(/[a-z]{3}/);
expect("abc").to.be.a("string").that.matches(/[a-z]{3}/);
expect("abc").to.have.string("b");

expect({ a: 1, b: 2 }).to.have.key("a");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ declare module "lru-cache" {
peek: (key: K) => V,
del: (key: K) => void,
reset: () => void,
has: (key: K) => boolean
has: (key: K) => boolean,
prune: () => void
// TODO add the rest of the things documented at https://www.npmjs.com/package/lru-cache
};

Expand Down

0 comments on commit 2ea1923

Please sign in to comment.