DefinitelyTyped/types/chai-things/index.d.ts
Rebecca Turner 12453a8fe1 [chai] Provide type definitions for chai.use (#37451)
* chai: Add types for chai.use and chai.util

Helps developers write Chai plugins; requested in #29922.

Closes #29922.

* Updated dependencies on Chai

- Minimum TS version: 3.0
    - Version bumps to TS 3.0 for the following type definitions which
      depend on chai directly or indirectly:
            bardjs, chai, chai-almost, chai-arrays, chai-as-promised,
            chai-datetime, chai-dom, chai-enzyme, chai-fs, chai-fuzzy,
            chai-jest-snapshot, chai-jquery, chai-json-schema,
            chai-moment, chai-oequal, chai-roughly, chai-spies,
            chai-string, chai-subset, chai-things, chai-uuid,
            chai-webdriverio, chai-xml, d3kit, deep-equal-in-any-order,
            dirty-chai, ember-mocha, hexo, hexo-log, hexo-util,
            jsx-chai, karma-chai, karma-chai-sinon, redux-test-utils,
            and sinon-chai
- Use Chai.ChaiPlugin instead of (chai: any, utils: any) => void

* Factor out pathval types

- Forgot that the pathval types aren't merged yet

* Factor out pathval types

- Forgot that the pathval types aren't merged yet

* Make 'chainingBehavior' non-mandatory
2019-08-08 08:58:47 -07:00

67 lines
1.3 KiB
TypeScript

// Type definitions for chai-things
// Project: https://github.com/chaijs/chai-things
// Definitions by: David Broder-Rodgers <https://github.com/DavidBR-SW/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// TypeScript Version: 3.0
/// <reference types="chai" />
declare namespace Chai {
interface ArrayAssertion {
include: ArrayInclude;
contain: ArrayInclude;
not: ArrayAssertion;
all: Assertion;
}
interface ArrayInclude {
(item: any): any;
a: Item;
an: Item;
one: Something;
some: Something;
something: Something;
any: Anything;
}
interface Include {
(item: any): any;
a: Item;
an: Item;
one: Something;
some: Something;
something: Something;
}
interface Anything extends Assertion {
(): any;
that: Assertion;
with: Assertion;
}
interface Something extends Assertion {
(): any;
that: Assertion;
with: Assertion;
}
interface Item {
item: Something;
thing: Something;
}
interface Deep {
equals: Equal;
}
}
interface Array<T> {
should: Chai.ArrayAssertion;
}
declare module "chai-things" {
const chaiThings: Chai.ChaiPlugin;
namespace chaiThings { }
export = chaiThings;
}