DefinitelyTyped/types/chai-datetime/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

50 lines
2.1 KiB
TypeScript

// Type definitions for chai-datetime
// Project: https://github.com/gaslight/chai-datetime.git
// Definitions by: Cliff Burger <https://github.com/cliffburger>,
// Matt Bishop <https://github.com/mattbishop>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
/// <reference types="chai" />
declare const chaiDateTime: Chai.ChaiPlugin;
export = chaiDateTime;
declare global {
namespace Chai {
interface Assertion {
afterDate(date: Date): Assertion;
beforeDate(date: Date): Assertion;
equalDate(date: Date): Assertion;
withinDate(dateFrom: Date, dateTo: Date): Assertion;
afterTime(date: Date): Assertion;
beforeTime(date: Date): Assertion;
equalTime(date: Date): Assertion;
withinTime(dateFrom: Date, dateTo: Date): Assertion;
}
interface Assert {
equalTime(val: Date, exp: Date, msg?: string): void;
notEqualTime(val: Date, exp: Date, msg?: string): void;
beforeTime(val: Date, exp: Date, msg?: string): void;
notBeforeTime(val: Date, exp: Date, msg?: string): void;
afterTime(val: Date, exp: Date, msg?: string): void;
notAfterTime(val: Date, exp: Date, msg?: string): void;
withinTime(val: Date, expFrom: Date, expTo: Date, msg?: string): void;
notWithinTime(val: Date, expFrom: Date, expTo: Date, msg?: string): void;
equalDate(val: Date, exp: Date, msg?: string): void;
notEqualDate(val: Date, exp: Date, msg?: string): void;
beforeDate(val: Date, exp: Date, msg?: string): void;
notBeforeDate(val: Date, exp: Date, msg?: string): void;
afterDate(val: Date, exp: Date, msg?: string): void;
notAfterDate(val: Date, exp: Date, msg?: string): void;
withinDate(val: Date, expFrom: Date, expTo: Date, msg?: string): void;
notWithinDate(val: Date, expFrom: Date, expTo: Date, msg?: string): void;
}
}
interface Date {
should: Chai.Assertion;
}
}