diff --git a/types/bardjs/index.d.ts b/types/bardjs/index.d.ts index f701d4c368..8b533a9483 100644 --- a/types/bardjs/index.d.ts +++ b/types/bardjs/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/wardbell/bardjs // Definitions by: Andrew Archibald // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 3.0 /// /// diff --git a/types/chai-almost/index.d.ts b/types/chai-almost/index.d.ts index 2f7a3ffdc7..e5131e2220 100644 --- a/types/chai-almost/index.d.ts +++ b/types/chai-almost/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/nmuldavin/chai-almost#readme // Definitions by: Lennard Schulz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 /// @@ -29,5 +30,5 @@ declare global { } } -declare function chaiAlmost(tolerance?: number): ((chai: any, utils: any) => void); +declare function chaiAlmost(tolerance?: number): Chai.ChaiPlugin; export = chaiAlmost; diff --git a/types/chai-arrays/index.d.ts b/types/chai-arrays/index.d.ts index 1e61eec3ae..bab67e13bd 100644 --- a/types/chai-arrays/index.d.ts +++ b/types/chai-arrays/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/GaneshSPatil/chai-arrays // Definitions by: Clément Prévot // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 /// @@ -27,11 +28,7 @@ declare global { sorted(val: any[], msg?: string): void; } } - - interface Array { - should: Chai.Assertion; - } } -declare function chaiArrays(chai: any, utils: any): void; +declare const chaiArrays: Chai.ChaiPlugin; export = chaiArrays; diff --git a/types/chai-as-promised/index.d.ts b/types/chai-as-promised/index.d.ts index 8a9716806c..e3a19cd761 100644 --- a/types/chai-as-promised/index.d.ts +++ b/types/chai-as-promised/index.d.ts @@ -6,18 +6,17 @@ // Mike Lazer-Walker , // Matt Bishop // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 /// declare module 'chai-as-promised' { - function chaiAsPromised(chai: any, utils: any): void; - - namespace chaiAsPromised { - function transferPromiseness(assertion: Chai.PromisedAssertion, promise: PromiseLike): void; - - function transformAsserterArgs(values: any[]): any; + interface ChaiAsPromised extends Chai.ChaiPlugin { + transferPromiseness(assertion: Chai.PromisedAssertion, promise: PromiseLike): void; + transformAsserterArgs(values: any[]): any; } + const chaiAsPromised: ChaiAsPromised; export = chaiAsPromised; } diff --git a/types/chai-datetime/index.d.ts b/types/chai-datetime/index.d.ts index be623a05d4..d23c7e5d1a 100644 --- a/types/chai-datetime/index.d.ts +++ b/types/chai-datetime/index.d.ts @@ -3,10 +3,11 @@ // Definitions by: Cliff Burger , // Matt Bishop // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 /// -declare function chaiDateTime(chai: any, utils: any): void; +declare const chaiDateTime: Chai.ChaiPlugin; export = chaiDateTime; declare global { diff --git a/types/chai-dom/index.d.ts b/types/chai-dom/index.d.ts index c6ecc75326..5f75de46f8 100644 --- a/types/chai-dom/index.d.ts +++ b/types/chai-dom/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/nathanboktae/chai-dom // Definitions by: Matt Lewis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 /// @@ -56,11 +57,6 @@ declare namespace Chai { } declare module "chai-dom" { - - function chaiDom(chai: any, utils: any): void; - - namespace chaiDom { - } - + const chaiDom: Chai.ChaiPlugin; export = chaiDom; } diff --git a/types/chai-enzyme/index.d.ts b/types/chai-enzyme/index.d.ts index b238b194c5..1056b9f27b 100644 --- a/types/chai-enzyme/index.d.ts +++ b/types/chai-enzyme/index.d.ts @@ -177,7 +177,7 @@ declare module "chai-enzyme" { import { ShallowWrapper, ReactWrapper } from "enzyme"; type DebugWrapper = ShallowWrapper | Cheerio | ReactWrapper; - function chaiEnzyMe(wrapper?: (debugWrapper: DebugWrapper) => string): (chai: any) => void; + function chaiEnzyMe(wrapper?: (debugWrapper: DebugWrapper) => string): Chai.ChaiPlugin; module chaiEnzyMe { } diff --git a/types/chai-fs/index.d.ts b/types/chai-fs/index.d.ts index 3b82eee078..ac0d2654dd 100644 --- a/types/chai-fs/index.d.ts +++ b/types/chai-fs/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/chaijs/chai-fs // Definitions by: Dimitar Danailov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 3.0 /// /// @@ -214,7 +214,7 @@ declare global { } } -declare function chaiFs(chai: any, utils: any): void; +declare const chaiFs: Chai.ChaiPlugin; export = chaiFs; interface Object { diff --git a/types/chai-fuzzy/index.d.ts b/types/chai-fuzzy/index.d.ts index b4f8c1191c..a8deae0842 100644 --- a/types/chai-fuzzy/index.d.ts +++ b/types/chai-fuzzy/index.d.ts @@ -2,6 +2,7 @@ // Project: http://chaijs.com/plugins/chai-fuzzy // Definitions by: Bart van der Schoor // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 /// @@ -71,6 +72,6 @@ declare global { } } -declare function chaiFuzzy(chai: any, utils: any): void; +declare const chaiFuzzy: Chai.ChaiPlugin; export = chaiFuzzy; diff --git a/types/chai-jest-snapshot/index.d.ts b/types/chai-jest-snapshot/index.d.ts index 27ec049b14..4a8a9feaa1 100644 --- a/types/chai-jest-snapshot/index.d.ts +++ b/types/chai-jest-snapshot/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/suchipi/chai-jest-snapshot#readme // Definitions by: Matt Perry // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 3.0 /// /// @@ -17,10 +17,7 @@ declare global { } } -interface ChaiJestSnapshot { - /** Chai bootstrapper */ - (chai: any, utils: any): void; - +interface ChaiJestSnapshot extends Chai.ChaiPlugin { /** Set snapshot file name */ setFilename(filename: string): void; diff --git a/types/chai-jquery/index.d.ts b/types/chai-jquery/index.d.ts index c2827d2e05..841492b20a 100644 --- a/types/chai-jquery/index.d.ts +++ b/types/chai-jquery/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/chaijs/chai-jquery // Definitions by: Kazi Manzur Rashid // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 3.0 /// /// diff --git a/types/chai-json-schema/index.d.ts b/types/chai-json-schema/index.d.ts index 04e841bc91..1456fd8f73 100644 --- a/types/chai-json-schema/index.d.ts +++ b/types/chai-json-schema/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/chaijs/chai-json-schema/, http://chaijs.com // Definitions by: Ulrich Heiniger // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 // // @@ -24,6 +25,6 @@ declare global { } } -declare function chaiJsonSchema(chai: any, utils: any): void; +declare const chaiJsonSchema: Chai.ChaiPlugin; declare namespace chaiJsonSchema { } export = chaiJsonSchema; diff --git a/types/chai-moment/chai-moment-tests.ts b/types/chai-moment/chai-moment-tests.ts index 6354c4796b..18486a6032 100644 --- a/types/chai-moment/chai-moment-tests.ts +++ b/types/chai-moment/chai-moment-tests.ts @@ -3,10 +3,12 @@ import chaiMoment = require('chai-moment'); use(chaiMoment); +const g: ChaiMoment.Granularity = 'month'; + // bdd style expect('2019-03-14').to.be.afterMoment('2019-03-12', 'day'); expect('2019-03-14').to.be.beforeMoment('2019-03-16'); -expect('2019-03-14').to.be.sameMoment('2019-03-14', 'day'); +expect('2019-03-14').to.be.sameMoment('2019-03-14', g); // tdd style assert.afterMoment('2019-03-14', '2019-03-12'); diff --git a/types/chai-moment/index.d.ts b/types/chai-moment/index.d.ts index 0b19b7573f..fc67024319 100644 --- a/types/chai-moment/index.d.ts +++ b/types/chai-moment/index.d.ts @@ -2,24 +2,32 @@ // Project: https://github.com/picardy/chai-moment // Definitions by: Chris Godsey // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 /// declare global { - namespace Chai { - interface Assertion extends LanguageChains, NumericComparison, TypeComparison { - afterMoment(expected: string, granularity?: string): void; - beforeMoment(expected: string, granularity?: string): void; - sameMoment(expected: string, granularity?: string): void; - } + namespace ChaiMoment { + type Granularity = 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second'; + } - interface Assert { - afterMoment(val: any, exp: any, granularity?: any, msg?: any): void; - beforeMoment(val: any, exp: any, granularity?: any, msg?: any): void; - sameMoment(val: any, exp: any, granularity?: any, msg?: any): void; - } - } + namespace Chai { + interface Assertion { + afterMoment(expected: any, granularity?: ChaiMoment.Granularity): void; + beforeMoment(expected: any, granularity?: ChaiMoment.Granularity): void; + sameMoment(expected: any, granularity?: ChaiMoment.Granularity): void; + } + + interface AssertStatic { + afterMoment(val: any, exp: any, granularity: ChaiMoment.Granularity, msg?: string): void; + afterMoment(val: any, exp: any, msg?: string): void; + beforeMoment(val: any, exp: any, granularity?: ChaiMoment.Granularity, msg?: string): void; + beforeMoment(val: any, exp: any, msg?: string): void; + sameMoment(val: any, exp: any, granularity?: ChaiMoment.Granularity, msg?: string): void; + sameMoment(val: any, exp: any, msg?: string): void; + } + } } -declare function chaiMoment(chai: any, utils: any): void; +declare const chaiMoment: Chai.ChaiPlugin; export = chaiMoment; diff --git a/types/chai-oequal/index.d.ts b/types/chai-oequal/index.d.ts index 78160c255e..50253bb773 100644 --- a/types/chai-oequal/index.d.ts +++ b/types/chai-oequal/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/wrwrwr/chai-oequal // Definitions by: Mizunashi Mana // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 /// @@ -22,7 +23,7 @@ declare namespace Chai { } declare module 'chai-oequal' { - function chaiOequal(chai: any, utils: any): void; + const chaiOequal: Chai.ChaiPlugin; namespace chaiOequal {} export = chaiOequal; } diff --git a/types/chai-roughly/index.d.ts b/types/chai-roughly/index.d.ts index c1f162ddb7..f7b8e90f14 100644 --- a/types/chai-roughly/index.d.ts +++ b/types/chai-roughly/index.d.ts @@ -2,6 +2,8 @@ // Project: https://github.com/Turbo87/chai-roughly#readme // Definitions by: Tomasz Nguyen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + /// declare global { @@ -22,6 +24,6 @@ declare global { } } -declare function chaiRoughly(chai: any, utils: any): void; +declare const chaiRoughly: Chai.ChaiPlugin; declare namespace chaiRoughly { } export = chaiRoughly; diff --git a/types/chai-spies/index.d.ts b/types/chai-spies/index.d.ts index bb37fa8cd4..8d485e3854 100644 --- a/types/chai-spies/index.d.ts +++ b/types/chai-spies/index.d.ts @@ -4,6 +4,7 @@ // Harm van der Werf // Jouni Suorsa // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 /// diff --git a/types/chai-string/index.d.ts b/types/chai-string/index.d.ts index fcf0fb9c23..2c1768b916 100644 --- a/types/chai-string/index.d.ts +++ b/types/chai-string/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/onechiporenko/chai-string // Definitions by: Nick Malaguti // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 /// @@ -48,6 +49,6 @@ declare global { } } -declare function chaiString(chai: any, utils: any): void; +declare const chaiString: Chai.ChaiPlugin; declare namespace chaiString { } export = chaiString; diff --git a/types/chai-subset/index.d.ts b/types/chai-subset/index.d.ts index d02efb5844..3e1511caad 100644 --- a/types/chai-subset/index.d.ts +++ b/types/chai-subset/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/debitoor/chai-subset // Definitions by: Sam Noedel , Andrew Brown // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 /// @@ -16,5 +17,5 @@ declare global { } } -declare function chaiSubset(chai: any, utils: any): void; +declare const chaiSubset: Chai.ChaiPlugin; export = chaiSubset; diff --git a/types/chai-things/index.d.ts b/types/chai-things/index.d.ts index e0b3d0f0ec..60b6812dbf 100644 --- a/types/chai-things/index.d.ts +++ b/types/chai-things/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/chaijs/chai-things // Definitions by: David Broder-Rodgers // Definitions: https://github.com/borisyankov/DefinitelyTyped +// TypeScript Version: 3.0 /// @@ -59,7 +60,7 @@ interface Array { } declare module "chai-things" { - function chaiThings(chai: any, utils: any): void; + const chaiThings: Chai.ChaiPlugin; namespace chaiThings { } export = chaiThings; } diff --git a/types/chai-uuid/index.d.ts b/types/chai-uuid/index.d.ts index 23a0b6db92..bdc7cb5061 100644 --- a/types/chai-uuid/index.d.ts +++ b/types/chai-uuid/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/rfrench/chai-uuid // Definitions by: Harm van der Werf // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 3.0 /// /// @@ -23,5 +23,5 @@ declare global { } } -declare function chaiUuid(chai: any, utils: any): void; +declare const chaiUuid: Chai.ChaiPlugin; export = chaiUuid; diff --git a/types/chai-webdriverio/index.d.ts b/types/chai-webdriverio/index.d.ts index d0b958dad5..3ca6f01fde 100644 --- a/types/chai-webdriverio/index.d.ts +++ b/types/chai-webdriverio/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/marcodejongh/chai-webdriverio // Definitions by: Nikolai Orekhov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 /// /// @@ -19,6 +20,6 @@ declare namespace Chai { } declare module 'chai-webdriverio' { - function chaiWebdriverIO(client: WebdriverIO.Client, options?: any): (chai: any, utils: any) => void; + function chaiWebdriverIO(client: WebdriverIO.Client, options?: any): Chai.ChaiPlugin; export = chaiWebdriverIO; } diff --git a/types/chai-xml/index.d.ts b/types/chai-xml/index.d.ts index 7f6a78f653..f54b33a2df 100644 --- a/types/chai-xml/index.d.ts +++ b/types/chai-xml/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/krampstudio/chai-xml // Definitions by: Jeff Goddard // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 /// @@ -34,5 +35,5 @@ declare namespace ChaiXml { } } -declare function chaiXml(chai: any, utils: any): void; +declare const chaiXml: Chai.ChaiPlugin; export = chaiXml; diff --git a/types/chai/chai-tests.ts b/types/chai/chai-tests.ts index 36002d9bfa..228eb7c662 100644 --- a/types/chai/chai-tests.ts +++ b/types/chai/chai-tests.ts @@ -999,17 +999,91 @@ function _throw() { } function use() { - chai.use((_chai) => { - _chai.can.use.any(); - }); + // Modified from: + // https://www.npmjs.com/package/chai-subset + // But with added type annotations and some modifications to make the + // linter whine less, and also a method (chai.assert.containSubset) removed + // because we can't take advantage of namespace-declaration-merging here. + function chaiSubset(chai: Chai.ChaiStatic, utils: Chai.ChaiUtils) { + const Assertion = chai.Assertion; + const assertionPrototype = Assertion.prototype; - const expect = chai - .use((_chai, util) => { - }) - .use((_chai, util) => { - }) - .expect; -} + Assertion.addMethod('containSubset', function(expected: Object) { + const actual = utils.flag(this, 'object'); + const showDiff = chai.config.showDiff; + + assertionPrototype.assert.call( + this, + compare(expected, actual), + 'expected #{act} to contain subset #{exp}', + 'expected #{act} to not contain subset #{exp}', + expected, + actual, + showDiff + ); + }); + + Assertion.addMethod('containSubset', function(expected: Object) { + const actual = utils.flag(this, 'object'); + const showDiff = chai.config.showDiff; + + assertionPrototype.assert.call( + this, + compare(expected, actual), + 'expected #{act} to contain subset #{exp}', + 'expected #{act} to not contain subset #{exp}', + expected, + actual, + showDiff + ); + }); + + function compare(expected: Object, actual: Object): boolean { + if (expected === actual) { + return true; + } + if (typeof actual !== typeof expected) { + return false; + } + if (typeof expected !== 'object' || expected === null) { + return expected === actual; + } + if (!!expected && !actual) { + return false; + } + + if (Array.isArray(expected) && Array.isArray(actual)) { + if (typeof actual.length !== 'number') { + return false; + } + const aa = Array.prototype.slice.call(actual); + return expected.every((exp: Object) => aa.some((act: Object) => compare(exp, act))); + } + + if (expected instanceof Date) { + if (actual instanceof Date) { + return expected.getTime() === actual.getTime(); + } else { + return false; + } + } + + return Object.keys(expected).every((key: string): boolean => { + const eo = (expected as { [key: string]: Object })[key]; + const ao = (actual as { [key: string]: Object })[key]; + if (typeof eo === 'object' && eo !== null && ao !== null) { + return compare(eo, ao); + } + if (typeof eo === 'function') { + return eo(ao); + } + return ao === eo; + }); + } + } + + chai.use(chaiSubset); + } class Klass { val: number; diff --git a/types/chai/index.d.ts b/types/chai/index.d.ts index 5f73803757..1ee59343f1 100644 --- a/types/chai/index.d.ts +++ b/types/chai/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for chai 4.1 +// Type definitions for chai 4.2 // Project: http://chaijs.com/ // Definitions by: Jed Mao , // Bart van der Schoor , @@ -10,31 +10,147 @@ // Gintautas Miselis // Satana Charuwichitratana // Erik Schierboom +// Rebecca Turner // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 declare namespace Chai { + type Message = string | (() => string); + type ObjectProperty = string | symbol | number; + + interface PathInfo { + parent: object; + name: string; + value?: any; + exists: boolean; + } + + interface ErrorConstructor { + new(...args: any[]): Error; + } + + interface ChaiUtils { + addChainableMethod( + // object to define the method on, e.g. chai.Assertion.prototype + ctx: object, + // method name + name: string, + // method itself; any arguments + method: (...args: any[]) => void, + // called when property is accessed + chainingBehavior?: () => void + ): void; + overwriteChainableMethod( + ctx: object, + name: string, + method: (...args: any[]) => void, + chainingBehavior?: () => void + ): void; + addLengthGuard( + fn: Function, + assertionName: string, + isChainable: boolean + ): void; + addMethod(ctx: object, name: string, method: Function): void; + addProperty(ctx: object, name: string, getter: () => any): void; + overwriteMethod(ctx: object, name: string, method: Function): void; + overwriteProperty(ctx: object, name: string, getter: () => any): void; + compareByInspect(a: object, b: object): -1 | 1; + expectTypes(obj: object, types: string[]): void; + flag(obj: object, key: string, value?: any): any; + getActual(obj: object, args: AssertionArgs): any; + getProperties(obj: object): string[]; + getEnumerableProperties(obj: object): string[]; + getOwnEnumerablePropertySymbols(obj: object): symbol[]; + getOwnEnumerableProperties(obj: object): Array; + getMessage(errorLike: Error | string): string; + getMessage(obj: any, args: AssertionArgs): string; + inspect(obj: any, showHidden?: boolean, depth?: number, colors?: boolean): void; + isProxyEnabled(): boolean; + objDisplay(obj: object): void; + proxify(obj: object, nonChainableMethodName: string): object; + test(obj: object, args: AssertionArgs): boolean; + transferFlags(assertion: Assertion, obj: object, includeAll?: boolean): void; + compatibleInstance(thrown: Error, errorLike: Error | ErrorConstructor): boolean; + compatibleConstructor(thrown: Error, errorLike: Error | ErrorConstructor): boolean; + compatibleMessage(thrown: Error, errMatcher: string | RegExp): boolean; + getConstructorName(constructorFn: Function): string; + getFuncName(constructorFn: Function): string | null; + + // Reexports from pathval: + hasProperty(obj: object | undefined | null, name: ObjectProperty): boolean; + getPathInfo(obj: object, path: string): PathInfo; + getPathValue(obj: object, path: string): object | undefined; + } + + type ChaiPlugin = (chai: ChaiStatic, utils: ChaiUtils) => void; + interface ChaiStatic { expect: ExpectStatic; should(): Should; /** * Provides a way to extend the internals of Chai */ - use(fn: (chai: any, utils: any) => void): ChaiStatic; + use(fn: ChaiPlugin): ChaiStatic; + util: ChaiUtils; assert: AssertStatic; config: Config; + Assertion: AssertionStatic; AssertionError: typeof AssertionError; version: string; } - export interface ExpectStatic extends AssertionStatic { + export interface ExpectStatic { + (val: any, message?: string): Assertion; fail(actual?: any, expected?: any, message?: string, operator?: Operator): void; } export interface AssertStatic extends Assert { } - export interface AssertionStatic { - (target: any, message?: string): Assertion; + // chai.Assertion.prototype.assert arguments + type AssertionArgs = [ + // 'expression to be tested' + // This parameter is unused and the docs list its type as + // 'Philosophical', which is mentioned nowhere else in the source. Do + // with that what you will! + any, + Message, // message if value fails + Message, // message if negated value fails + any, // expected value + any?, // actual value + boolean? // showDiff + ]; + + export interface AssertionPrototype { + assert(...args: AssertionArgs): void; + _obj: any; + } + + export interface AssertionStatic extends AssertionPrototype { + prototype: AssertionPrototype; + + new (target: any, message?: string, ssfi?: Function, lockSsfi?: boolean): Assertion; + + // Deprecated properties: + includeStack: boolean; + showDiff: boolean; + + // Partials of functions on ChaiUtils: + addProperty(name: string, getter: (this: AssertionStatic) => any): void; + addMethod(name: string, method: (this: AssertionStatic, ...args: any[]) => any): void; + addChainableMethod( + name: string, + method: (this: AssertionStatic, ...args: any[]) => void, + chainingBehavior?: () => void + ): void; + overwriteProperty(name: string, getter: (this: AssertionStatic) => any): void; + overwriteMethod(name: string, method: (this: AssertionStatic, ...args: any[]) => any): void; + overwriteChainableMethod( + name: string, + method: (this: AssertionStatic, ...args: any[]) => void, + chainingBehavior?: () => void + ): void; } export type Operator = string; // "==" | "===" | ">" | ">=" | "<" | "<=" | "!=" | "!=="; @@ -165,7 +281,7 @@ declare namespace Chai { } interface InstanceOf { - (constructor: Object, message?: string): Assertion; + (constructor: any, message?: string): Assertion; } interface CloseTo { @@ -220,7 +336,7 @@ declare namespace Chai { } interface Include { - (value: Object | string | number, message?: string): Assertion; + (value: any, message?: string): Assertion; keys: Keys; deep: Deep; ordered: Ordered; @@ -1686,6 +1802,16 @@ declare namespace Chai { * Default: 40 */ truncateThreshold: number; + + /** + * Default: true + */ + useProxy: boolean; + + /** + * Default: ['then', 'catch', 'inspect', 'toJSON'] + */ + proxyExcludedKeys: string[]; } export class AssertionError { diff --git a/types/d3kit/v1/index.d.ts b/types/d3kit/v1/index.d.ts index 5da692ef1b..325ba6fe1d 100644 --- a/types/d3kit/v1/index.d.ts +++ b/types/d3kit/v1/index.d.ts @@ -2,6 +2,7 @@ // Project: https://www.npmjs.com/package/d3kit // Definitions by: Morgan Benton // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 import * as d3 from "d3"; diff --git a/types/deep-equal-in-any-order/index.d.ts b/types/deep-equal-in-any-order/index.d.ts index d0e646d64e..9110ce9c56 100644 --- a/types/deep-equal-in-any-order/index.d.ts +++ b/types/deep-equal-in-any-order/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/oprogramador/deep-equal-in-any-order#readme // Definitions by: Bastien Caudan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 declare global { namespace Chai { @@ -11,5 +12,5 @@ declare global { } } -declare function deepEqualInAnyOrder(chai: any, utils: any): void; +declare const deepEqualInAnyOrder: Chai.ChaiPlugin; export = deepEqualInAnyOrder; diff --git a/types/dirty-chai/index.d.ts b/types/dirty-chai/index.d.ts index 24556edd4c..f350ad5c99 100644 --- a/types/dirty-chai/index.d.ts +++ b/types/dirty-chai/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/prodatakey/dirty-chai // Definitions by: Piotr Roszatycki // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 /// /// @@ -24,5 +25,5 @@ declare global { } } -declare function dirtyChai(chai: any, utils: any): void; +declare const dirtyChai: Chai.ChaiPlugin; export = dirtyChai; diff --git a/types/ember-mocha/index.d.ts b/types/ember-mocha/index.d.ts index 69d2202f04..8d53775d9c 100644 --- a/types/ember-mocha/index.d.ts +++ b/types/ember-mocha/index.d.ts @@ -4,7 +4,7 @@ // Simon Ihmig // Mike North // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 3.0 import { TestContext, ModuleCallbacks } from "ember-test-helpers"; import Ember from 'ember'; diff --git a/types/hexo-log/index.d.ts b/types/hexo-log/index.d.ts index 40640a3a36..a877d212c3 100644 --- a/types/hexo-log/index.d.ts +++ b/types/hexo-log/index.d.ts @@ -2,7 +2,7 @@ // Project: http://hexo.io/ // Definitions by: segayuu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 3.0 import bunyan = require('hexo-bunyan'); import streams = require('stream'); diff --git a/types/hexo-util/index.d.ts b/types/hexo-util/index.d.ts index 5a6be7f5a2..ccb993b22b 100644 --- a/types/hexo-util/index.d.ts +++ b/types/hexo-util/index.d.ts @@ -2,7 +2,7 @@ // Project: https://hexo.io/ // Definitions by: sega yuu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 3.0 /// diff --git a/types/hexo/index.d.ts b/types/hexo/index.d.ts index 0f3a9dcc78..3d926cda84 100644 --- a/types/hexo/index.d.ts +++ b/types/hexo/index.d.ts @@ -2,7 +2,7 @@ // Project: https://hexo.io/ // Definitions by: KentarouTakeda // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 3.0 import EventEmitter = require('events'); import moment = require('moment'); diff --git a/types/jsx-chai/index.d.ts b/types/jsx-chai/index.d.ts index 4d76ebf66f..346dd87efa 100644 --- a/types/jsx-chai/index.d.ts +++ b/types/jsx-chai/index.d.ts @@ -2,17 +2,15 @@ // Project: https://github.com/bkonkle/jsx-chai // Definitions by: Philipp Holzer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 /// - interface JsxChaiStatic { jsxChai: jsxChaiFunction; } -interface jsxChaiFunction { - (chai: any, utils: any): void; -} +type jsxChaiFunction = Chai.ChaiPlugin; declare var jsxChai: JsxChaiStatic; diff --git a/types/karma-chai-sinon/index.d.ts b/types/karma-chai-sinon/index.d.ts index 9a14f659e2..0b14373a99 100644 --- a/types/karma-chai-sinon/index.d.ts +++ b/types/karma-chai-sinon/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/tubalmartin/karma-chai-sinon // Definitions by: Václav Ostrožlík // Definitions: https://github.com/borisyankov/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 3.0 /// import Sinon = require('sinon'); diff --git a/types/karma-chai/index.d.ts b/types/karma-chai/index.d.ts index 15c7010071..8b8da8fe99 100644 --- a/types/karma-chai/index.d.ts +++ b/types/karma-chai/index.d.ts @@ -2,6 +2,7 @@ // Project: http://xdissent.github.io/karma-chai // Definitions by: JayAndCatchFire // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 import chai = require('chai'); diff --git a/types/redux-test-utils/index.d.ts b/types/redux-test-utils/index.d.ts index 2c5a36e441..8128dbf78d 100644 --- a/types/redux-test-utils/index.d.ts +++ b/types/redux-test-utils/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/Knegusen/redux-test-utils#readme // Definitions by: Huw Martin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 3.0 import { AnyAction, Store, Dispatch } from 'redux'; diff --git a/types/sinon-chai/index.d.ts b/types/sinon-chai/index.d.ts index ad7c8cb857..5047809295 100644 --- a/types/sinon-chai/index.d.ts +++ b/types/sinon-chai/index.d.ts @@ -4,7 +4,7 @@ // Jed Mao // Eyal Lapid // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 3.0 /// /// @@ -104,6 +104,6 @@ declare global { } } -declare function sinonChai(chai: any, utils: any): void; +declare const sinonChai: Chai.ChaiPlugin; declare namespace sinonChai { } export = sinonChai; diff --git a/types/sinon-chai/v2/index.d.ts b/types/sinon-chai/v2/index.d.ts index cff6d0b3a2..86645121df 100644 --- a/types/sinon-chai/v2/index.d.ts +++ b/types/sinon-chai/v2/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/domenic/sinon-chai // Definitions by: Kazi Manzur Rashid , Jed Mao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 3.0 /// /// @@ -84,6 +84,6 @@ declare global { } } -declare function sinonChai(chai: any, utils: any): void; +declare const sinonChai: Chai.ChaiPlugin; declare namespace sinonChai { } export = sinonChai;