aboutsummaryrefslogtreecommitdiffstats
path: root/packages/typescript-typings
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-03-26 19:00:56 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-03-27 23:47:04 +0800
commita2e4aaa9a394c359b9bf817ff154572eb33d4fb5 (patch)
treef8a034c2fcec9a83d9f83ed50dfd220b3965e33e /packages/typescript-typings
parent26e9696ddb004759a4a7c5f4a8901dc3255a70f9 (diff)
downloaddexon-sol-tools-a2e4aaa9a394c359b9bf817ff154572eb33d4fb5.tar
dexon-sol-tools-a2e4aaa9a394c359b9bf817ff154572eb33d4fb5.tar.gz
dexon-sol-tools-a2e4aaa9a394c359b9bf817ff154572eb33d4fb5.tar.bz2
dexon-sol-tools-a2e4aaa9a394c359b9bf817ff154572eb33d4fb5.tar.lz
dexon-sol-tools-a2e4aaa9a394c359b9bf817ff154572eb33d4fb5.tar.xz
dexon-sol-tools-a2e4aaa9a394c359b9bf817ff154572eb33d4fb5.tar.zst
dexon-sol-tools-a2e4aaa9a394c359b9bf817ff154572eb33d4fb5.zip
Add clean-state tests
Diffstat (limited to 'packages/typescript-typings')
-rw-r--r--packages/typescript-typings/.npmignore3
-rw-r--r--packages/typescript-typings/CHANGELOG.md3
-rw-r--r--packages/typescript-typings/README.md45
-rw-r--r--packages/typescript-typings/monorepo_scripts/globals.d.ts6
-rw-r--r--packages/typescript-typings/monorepo_scripts/postpublish.ts8
-rw-r--r--packages/typescript-typings/package.json33
-rw-r--r--packages/typescript-typings/tsconfig.json7
-rw-r--r--packages/typescript-typings/tslint.json3
-rw-r--r--packages/typescript-typings/types/chai-as-promised/index.d.ts268
-rw-r--r--packages/typescript-typings/types/chai/index.d.ts1254
-rw-r--r--packages/typescript-typings/types/ethers-contracts/index.d.ts28
-rw-r--r--packages/typescript-typings/types/web3/index.d.ts440
12 files changed, 2098 insertions, 0 deletions
diff --git a/packages/typescript-typings/.npmignore b/packages/typescript-typings/.npmignore
new file mode 100644
index 000000000..104d718ed
--- /dev/null
+++ b/packages/typescript-typings/.npmignore
@@ -0,0 +1,3 @@
+.*
+yarn-error.log
+/scripts/
diff --git a/packages/typescript-typings/CHANGELOG.md b/packages/typescript-typings/CHANGELOG.md
new file mode 100644
index 000000000..8c52570da
--- /dev/null
+++ b/packages/typescript-typings/CHANGELOG.md
@@ -0,0 +1,3 @@
+# CHANGELOG
+
+## v0.x.x - _TBD, 2018_
diff --git a/packages/typescript-typings/README.md b/packages/typescript-typings/README.md
new file mode 100644
index 000000000..9a74739f3
--- /dev/null
+++ b/packages/typescript-typings/README.md
@@ -0,0 +1,45 @@
+## @0xproject/typescript-typings
+
+Type repository for external packages used by 0x. This is like our small version of [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped)
+
+## Installation
+
+```bash
+yarn add -D @0xproject/typescript-typings
+```
+
+## Usage
+
+Add the following line within an `compilerOptions` section of your `tsconfig.json`
+
+```json
+"typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"]
+```
+
+This will allow the TS compiler to first look into that repo and then fallback to DT types.
+
+## Contributing
+
+We strongly encourage that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
+
+Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
+
+### Install Dependencies
+
+If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
+
+```bash
+yarn config set workspaces-experimental true
+```
+
+Then install dependencies
+
+```bash
+yarn install
+```
+
+### Lint
+
+```bash
+yarn lint
+```
diff --git a/packages/typescript-typings/monorepo_scripts/globals.d.ts b/packages/typescript-typings/monorepo_scripts/globals.d.ts
new file mode 100644
index 000000000..94e63a32d
--- /dev/null
+++ b/packages/typescript-typings/monorepo_scripts/globals.d.ts
@@ -0,0 +1,6 @@
+declare module '*.json' {
+ const json: any;
+ /* tslint:disable */
+ export default json;
+ /* tslint:enable */
+}
diff --git a/packages/typescript-typings/monorepo_scripts/postpublish.ts b/packages/typescript-typings/monorepo_scripts/postpublish.ts
new file mode 100644
index 000000000..dcb99d0f7
--- /dev/null
+++ b/packages/typescript-typings/monorepo_scripts/postpublish.ts
@@ -0,0 +1,8 @@
+import { postpublishUtils } from '@0xproject/monorepo-scripts';
+
+import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
+
+const cwd = `${__dirname}/..`;
+// tslint:disable-next-line:no-floating-promises
+postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/typescript-typings/package.json b/packages/typescript-typings/package.json
new file mode 100644
index 000000000..8fce84272
--- /dev/null
+++ b/packages/typescript-typings/package.json
@@ -0,0 +1,33 @@
+{
+ "name": "@0xproject/typescript-typings",
+ "version": "0.0.1",
+ "description": "0x project typescript type definitions",
+ "scripts": {
+ "build": "tsc && copyfiles -u 1 './lib/**/*' ./scripts",
+ "clean": "shx rm -rf scripts"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/0xProject/0x-monorepo.git"
+ },
+ "author": "Fabio Berger",
+ "contributors": [
+ "Leonid Logvinov <logvinov.leon@gmail.com>"
+ ],
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/0x-monorepo/issues"
+ },
+ "homepage": "https://github.com/0xProject/0x-monorepo/packages/typescript-typings#readme",
+ "dependencies": {
+ "bignumber.js": "~4.1.0"
+ },
+ "devDependencies": {
+ "@0xproject/monorepo-scripts": "^0.1.14",
+ "copyfiles": "^1.2.0",
+ "shx": "^0.2.2"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/packages/typescript-typings/tsconfig.json b/packages/typescript-typings/tsconfig.json
new file mode 100644
index 000000000..bc453af4b
--- /dev/null
+++ b/packages/typescript-typings/tsconfig.json
@@ -0,0 +1,7 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib"
+ },
+ "include": ["./monorepo_scripts/**/*"]
+}
diff --git a/packages/typescript-typings/tslint.json b/packages/typescript-typings/tslint.json
new file mode 100644
index 000000000..9a93a1f74
--- /dev/null
+++ b/packages/typescript-typings/tslint.json
@@ -0,0 +1,3 @@
+{
+ "extends": ["tslint-config-0xproject"]
+}
diff --git a/packages/typescript-typings/types/chai-as-promised/index.d.ts b/packages/typescript-typings/types/chai-as-promised/index.d.ts
new file mode 100644
index 000000000..ba6dabdcc
--- /dev/null
+++ b/packages/typescript-typings/types/chai-as-promised/index.d.ts
@@ -0,0 +1,268 @@
+// Type definitions for chai-as-promised
+// Project: https://github.com/domenic/chai-as-promised/
+// Definitions by: jt000 <https://github.com/jt000>, Yuki Kokubun <https://github.com/Kuniwak>
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare module 'chai-as-promised' {
+ function chaiAsPromised(chai: any, utils: any): void;
+ namespace chaiAsPromised {
+
+ }
+ export = chaiAsPromised;
+}
+
+// tslint:disable:no-namespace ban-types member-ordering
+declare namespace Chai {
+ // For BDD API
+ interface Assertion extends LanguageChains, NumericComparison, TypeComparison {
+ eventually: PromisedAssertion;
+ fulfilled: PromisedAssertion;
+ become(expected: any): PromisedAssertion;
+ rejected(): PromisedAssertion;
+ rejectedWith(expected: any, message?: string | RegExp): PromisedAssertion;
+ notify(fn: Function): PromisedAssertion;
+ }
+
+ // Eventually does not have .then(), but PromisedAssertion have.
+ interface Eventually extends PromisedLanguageChains, PromisedNumericComparison, PromisedTypeComparison {
+ // From chai-as-promised
+ become(expected: PromiseLike<any>): PromisedAssertion;
+ fulfilled: PromisedAssertion;
+ rejected: () => PromisedAssertion;
+ rejectedWith(expected: any, message?: string | RegExp): PromisedAssertion;
+ notify(fn: Function): PromisedAssertion;
+
+ // From chai
+ not: PromisedAssertion;
+ deep: PromisedDeep;
+ all: PromisedKeyFilter;
+ a: PromisedTypeComparison;
+ an: PromisedTypeComparison;
+ include: PromisedInclude;
+ contain: PromisedInclude;
+ ok: PromisedAssertion;
+ true: () => PromisedAssertion;
+ false: () => PromisedAssertion;
+ null: PromisedAssertion;
+ undefined: PromisedAssertion;
+ exist: PromisedAssertion;
+ empty: PromisedAssertion;
+ arguments: PromisedAssertion;
+ Arguments: PromisedAssertion;
+ equal: PromisedEqual;
+ equals: PromisedEqual;
+ eq: PromisedEqual;
+ eql: PromisedEqual;
+ eqls: PromisedEqual;
+ property: PromisedProperty;
+ ownProperty: PromisedOwnProperty;
+ haveOwnProperty: PromisedOwnProperty;
+ length: PromisedLength;
+ lengthOf: PromisedLength;
+ match(regexp: RegExp | string, message?: string): PromisedAssertion;
+ string(string: string, message?: string): PromisedAssertion;
+ keys: PromisedKeys;
+ key(string: string): PromisedAssertion;
+ throw: PromisedThrow;
+ throws: PromisedThrow;
+ Throw: PromisedThrow;
+ respondTo(method: string, message?: string): PromisedAssertion;
+ itself: PromisedAssertion;
+ satisfy(matcher: Function, message?: string): PromisedAssertion;
+ closeTo(expected: number, delta: number, message?: string): PromisedAssertion;
+ members: PromisedMembers;
+ }
+
+ interface PromisedAssertion extends Eventually, PromiseLike<any> {}
+
+ interface PromisedLanguageChains {
+ eventually: Eventually;
+
+ // From chai
+ to: PromisedAssertion;
+ be: PromisedAssertion;
+ been: PromisedAssertion;
+ is: PromisedAssertion;
+ that: PromisedAssertion;
+ which: PromisedAssertion;
+ and: PromisedAssertion;
+ has: PromisedAssertion;
+ have: PromisedAssertion;
+ with: PromisedAssertion;
+ at: PromisedAssertion;
+ of: PromisedAssertion;
+ same: PromisedAssertion;
+ }
+
+ interface PromisedNumericComparison {
+ above: PromisedNumberComparer;
+ gt: PromisedNumberComparer;
+ greaterThan: PromisedNumberComparer;
+ least: PromisedNumberComparer;
+ gte: PromisedNumberComparer;
+ below: PromisedNumberComparer;
+ lt: PromisedNumberComparer;
+ lessThan: PromisedNumberComparer;
+ most: PromisedNumberComparer;
+ lte: PromisedNumberComparer;
+ within(start: number, finish: number, message?: string): PromisedAssertion;
+ }
+
+ type PromisedNumberComparer = (value: number, message?: string) => PromisedAssertion;
+
+ interface PromisedTypeComparison {
+ (type: string, message?: string): PromisedAssertion;
+ instanceof: PromisedInstanceOf;
+ instanceOf: PromisedInstanceOf;
+ }
+
+ type PromisedInstanceOf = (constructor: Object, message?: string) => PromisedAssertion;
+
+ interface PromisedDeep {
+ equal: PromisedEqual;
+ include: PromisedInclude;
+ property: PromisedProperty;
+ }
+
+ interface PromisedKeyFilter {
+ keys: PromisedKeys;
+ }
+
+ type PromisedEqual = (value: any, message?: string) => PromisedAssertion;
+
+ type PromisedProperty = (name: string, value?: any, message?: string) => PromisedAssertion;
+
+ type PromisedOwnProperty = (name: string, message?: string) => PromisedAssertion;
+
+ interface PromisedLength extends PromisedLanguageChains, PromisedNumericComparison {
+ (length: number, message?: string): PromisedAssertion;
+ }
+
+ interface PromisedInclude {
+ (value: Object | string | number, message?: string): PromisedAssertion;
+ keys: PromisedKeys;
+ members: PromisedMembers;
+ all: PromisedKeyFilter;
+ }
+
+ interface PromisedKeys {
+ (...keys: string[]): PromisedAssertion;
+ (keys: any[]): PromisedAssertion;
+ }
+
+ interface PromisedThrow {
+ (): PromisedAssertion;
+ (expected: string | RegExp, message?: string): PromisedAssertion;
+ (constructor: Error | Function, expected?: string | RegExp, message?: string): PromisedAssertion;
+ }
+
+ type PromisedMembers = (set: any[], message?: string) => PromisedAssertion;
+
+ // For Assert API
+ interface Assert {
+ eventually: PromisedAssert;
+ isFulfilled(promise: PromiseLike<any>, message?: string): PromiseLike<void>;
+ becomes(promise: PromiseLike<any>, expected: any, message?: string): PromiseLike<void>;
+ doesNotBecome(promise: PromiseLike<any>, expected: any, message?: string): PromiseLike<void>;
+ isRejected(promise: PromiseLike<any>, message?: string): PromiseLike<void>;
+ isRejected(promise: PromiseLike<any>, expected: any | RegExp, message?: string): PromiseLike<void>;
+ notify(fn: Function): PromiseLike<void>;
+ }
+
+ export interface PromisedAssert {
+ fail(actual?: any, expected?: any, msg?: string, operator?: string): PromiseLike<void>;
+
+ ok(val: any, msg?: string): PromiseLike<void>;
+ notOk(val: any, msg?: string): PromiseLike<void>;
+
+ equal(act: any, exp: any, msg?: string): PromiseLike<void>;
+ notEqual(act: any, exp: any, msg?: string): PromiseLike<void>;
+
+ strictEqual(act: any, exp: any, msg?: string): PromiseLike<void>;
+ notStrictEqual(act: any, exp: any, msg?: string): PromiseLike<void>;
+
+ deepEqual(act: any, exp: any, msg?: string): PromiseLike<void>;
+ notDeepEqual(act: any, exp: any, msg?: string): PromiseLike<void>;
+
+ isTrue(val: any, msg?: string): PromiseLike<void>;
+ isFalse(val: any, msg?: string): PromiseLike<void>;
+
+ isNull(val: any, msg?: string): PromiseLike<void>;
+ isNotNull(val: any, msg?: string): PromiseLike<void>;
+
+ isUndefined(val: any, msg?: string): PromiseLike<void>;
+ isDefined(val: any, msg?: string): PromiseLike<void>;
+
+ isFunction(val: any, msg?: string): PromiseLike<void>;
+ isNotFunction(val: any, msg?: string): PromiseLike<void>;
+
+ isObject(val: any, msg?: string): PromiseLike<void>;
+ isNotObject(val: any, msg?: string): PromiseLike<void>;
+
+ isArray(val: any, msg?: string): PromiseLike<void>;
+ isNotArray(val: any, msg?: string): PromiseLike<void>;
+
+ isString(val: any, msg?: string): PromiseLike<void>;
+ isNotString(val: any, msg?: string): PromiseLike<void>;
+
+ isNumber(val: any, msg?: string): PromiseLike<void>;
+ isNotNumber(val: any, msg?: string): PromiseLike<void>;
+
+ isBoolean(val: any, msg?: string): PromiseLike<void>;
+ isNotBoolean(val: any, msg?: string): PromiseLike<void>;
+
+ typeOf(val: any, type: string, msg?: string): PromiseLike<void>;
+ notTypeOf(val: any, type: string, msg?: string): PromiseLike<void>;
+
+ instanceOf(val: any, type: Function, msg?: string): PromiseLike<void>;
+ notInstanceOf(val: any, type: Function, msg?: string): PromiseLike<void>;
+
+ include(exp: string | any[], inc: any, msg?: string): PromiseLike<void>;
+
+ notInclude(exp: string | any[], inc: any, msg?: string): PromiseLike<void>;
+
+ match(exp: any, re: RegExp, msg?: string): PromiseLike<void>;
+ notMatch(exp: any, re: RegExp, msg?: string): PromiseLike<void>;
+
+ property(obj: Object, prop: string, msg?: string): PromiseLike<void>;
+ notProperty(obj: Object, prop: string, msg?: string): PromiseLike<void>;
+ deepProperty(obj: Object, prop: string, msg?: string): PromiseLike<void>;
+ notDeepProperty(obj: Object, prop: string, msg?: string): PromiseLike<void>;
+
+ propertyVal(obj: Object, prop: string, val: any, msg?: string): PromiseLike<void>;
+ propertyNotVal(obj: Object, prop: string, val: any, msg?: string): PromiseLike<void>;
+
+ deepPropertyVal(obj: Object, prop: string, val: any, msg?: string): PromiseLike<void>;
+ deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string): PromiseLike<void>;
+
+ lengthOf(exp: any, len: number, msg?: string): PromiseLike<void>;
+ // alias frenzy
+ throw(fn: Function, msg?: string): PromiseLike<void>;
+ throw(fn: Function, regExp: RegExp): PromiseLike<void>;
+ throw(fn: Function, errType: Function, msg?: string): PromiseLike<void>;
+ throw(fn: Function, errType: Function, regExp: RegExp): PromiseLike<void>;
+
+ throws(fn: Function, msg?: string): PromiseLike<void>;
+ throws(fn: Function, regExp: RegExp): PromiseLike<void>;
+ throws(fn: Function, errType: Function, msg?: string): PromiseLike<void>;
+ throws(fn: Function, errType: Function, regExp: RegExp): PromiseLike<void>;
+
+ Throw(fn: Function, msg?: string): PromiseLike<void>;
+ Throw(fn: Function, regExp: RegExp): PromiseLike<void>;
+ Throw(fn: Function, errType: Function, msg?: string): PromiseLike<void>;
+ Throw(fn: Function, errType: Function, regExp: RegExp): PromiseLike<void>;
+
+ doesNotThrow(fn: Function, msg?: string): PromiseLike<void>;
+ doesNotThrow(fn: Function, regExp: RegExp): PromiseLike<void>;
+ doesNotThrow(fn: Function, errType: Function, msg?: string): PromiseLike<void>;
+ doesNotThrow(fn: Function, errType: Function, regExp: RegExp): PromiseLike<void>;
+
+ operator(val: any, operator: string, val2: any, msg?: string): PromiseLike<void>;
+ closeTo(act: number, exp: number, delta: number, msg?: string): PromiseLike<void>;
+
+ sameMembers(set1: any[], set2: any[], msg?: string): PromiseLike<void>;
+ includeMembers(set1: any[], set2: any[], msg?: string): PromiseLike<void>;
+
+ ifError(val: any, msg?: string): PromiseLike<void>;
+ }
+}
diff --git a/packages/typescript-typings/types/chai/index.d.ts b/packages/typescript-typings/types/chai/index.d.ts
new file mode 100644
index 000000000..8b3e4c079
--- /dev/null
+++ b/packages/typescript-typings/types/chai/index.d.ts
@@ -0,0 +1,1254 @@
+// Type definitions for chai 4.0.0
+// Project: http://chaijs.com/
+// Definitions by: Jed Mao <https://github.com/jedmao/>,
+// Bart van der Schoor <https://github.com/Bartvds>,
+// Andrew Brown <https://github.com/AGBrown>,
+// Olivier Chevet <https://github.com/olivr70>,
+// Matt Wistrand <https://github.com/mwistrand>,
+// Josh Goldberg <https://github.com/joshuakgoldberg>
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+// <reference types="assertion-error"/>
+
+// tslint:disable:no-namespace member-ordering ban-types unified-signatures variable-name callable-types
+declare namespace Chai {
+ interface ChaiStatic {
+ expect: ExpectStatic;
+ should(): Should;
+ /**
+ * Provides a way to extend the internals of Chai
+ */
+ use(fn: (chai: any, utils: any) => void): ChaiStatic;
+ assert: AssertStatic;
+ config: Config;
+ AssertionError: typeof AssertionError;
+ version: string;
+ }
+
+ export interface ExpectStatic extends AssertionStatic {
+ fail(actual?: any, expected?: any, message?: string, operator?: Operator): void;
+ }
+
+ export interface AssertStatic extends Assert {}
+
+ type AssertionStatic = (target: any, message?: string) => Assertion;
+
+ export type Operator = string; // "==" | "===" | ">" | ">=" | "<" | "<=" | "!=" | "!==";
+
+ export type OperatorComparable = boolean | null | number | string | undefined | Date;
+
+ interface ShouldAssertion {
+ equal(value1: any, value2: any, message?: string): void;
+ Throw: ShouldThrow;
+ throw: ShouldThrow;
+ exist(value: any, message?: string): void;
+ }
+
+ interface Should extends ShouldAssertion {
+ not: ShouldAssertion;
+ fail(actual: any, expected: any, message?: string, operator?: Operator): void;
+ }
+
+ interface ShouldThrow {
+ (actual: Function): void;
+ (actual: Function, expected: string | RegExp, message?: string): void;
+ (actual: Function, constructor: Error | Function, expected?: string | RegExp, message?: string): void;
+ }
+
+ interface Assertion extends LanguageChains, NumericComparison, TypeComparison {
+ not: Assertion;
+ deep: Deep;
+ nested: Nested;
+ any: KeyFilter;
+ all: KeyFilter;
+ a: TypeComparison;
+ an: TypeComparison;
+ include: Include;
+ includes: Include;
+ contain: Include;
+ contains: Include;
+ ok: Assertion;
+ true: () => Assertion;
+ false: () => Assertion;
+ null: () => Assertion;
+ undefined: () => Assertion;
+ NaN: Assertion;
+ exist: Assertion;
+ empty: Assertion;
+ arguments: Assertion;
+ Arguments: Assertion;
+ equal: Equal;
+ equals: Equal;
+ eq: Equal;
+ eql: Equal;
+ eqls: Equal;
+ property: Property;
+ ownProperty: OwnProperty;
+ haveOwnProperty: OwnProperty;
+ ownPropertyDescriptor: OwnPropertyDescriptor;
+ haveOwnPropertyDescriptor: OwnPropertyDescriptor;
+ length: Length;
+ lengthOf: Length;
+ match: Match;
+ matches: Match;
+ string(string: string, message?: string): Assertion;
+ keys: Keys;
+ key(string: string): Assertion;
+ throw: (message?: string) => Assertion;
+ throws: Throw;
+ Throw: Throw;
+ respondTo: RespondTo;
+ respondsTo: RespondTo;
+ itself: Assertion;
+ satisfy: Satisfy;
+ satisfies: Satisfy;
+ closeTo: CloseTo;
+ approximately: CloseTo;
+ members: Members;
+ increase: PropertyChange;
+ increases: PropertyChange;
+ decrease: PropertyChange;
+ decreases: PropertyChange;
+ change: PropertyChange;
+ changes: PropertyChange;
+ extensible: Assertion;
+ sealed: Assertion;
+ frozen: Assertion;
+ oneOf(list: any[], message?: string): Assertion;
+ }
+
+ interface LanguageChains {
+ to: Assertion;
+ be: Assertion;
+ been: Assertion;
+ is: Assertion;
+ that: Assertion;
+ which: Assertion;
+ and: Assertion;
+ has: Assertion;
+ have: Assertion;
+ with: Assertion;
+ at: Assertion;
+ of: Assertion;
+ same: Assertion;
+ }
+
+ interface NumericComparison {
+ above: NumberComparer;
+ gt: NumberComparer;
+ greaterThan: NumberComparer;
+ least: NumberComparer;
+ gte: NumberComparer;
+ below: NumberComparer;
+ lt: NumberComparer;
+ lessThan: NumberComparer;
+ most: NumberComparer;
+ lte: NumberComparer;
+ within(start: number, finish: number, message?: string): Assertion;
+ }
+
+ interface NumberComparer {
+ (value: number, message?: string): Assertion;
+ }
+
+ interface TypeComparison {
+ (type: string, message?: string): Assertion;
+ instanceof: InstanceOf;
+ instanceOf: InstanceOf;
+ }
+
+ interface InstanceOf {
+ (constructor: Object, message?: string): Assertion;
+ }
+
+ interface CloseTo {
+ (expected: number, delta: number, message?: string): Assertion;
+ }
+
+ interface Nested {
+ include: Include;
+ property: Property;
+ members: Members;
+ }
+
+ interface Deep {
+ equal: Equal;
+ equals: Equal;
+ eq: Equal;
+ include: Include;
+ property: Property;
+ members: Members;
+ }
+
+ interface KeyFilter {
+ keys: Keys;
+ }
+
+ interface Equal {
+ (value: any, message?: string): Assertion;
+ }
+
+ interface Property {
+ (name: string, value?: any, message?: string): Assertion;
+ }
+
+ interface OwnProperty {
+ (name: string, message?: string): Assertion;
+ }
+
+ interface OwnPropertyDescriptor {
+ (name: string, descriptor: PropertyDescriptor, message?: string): Assertion;
+ (name: string, message?: string): Assertion;
+ }
+
+ interface Length extends LanguageChains, NumericComparison {
+ (length: number, message?: string): Assertion;
+ }
+
+ interface Include {
+ (value: Object | string | number, message?: string): Assertion;
+ keys: Keys;
+ members: Members;
+ any: KeyFilter;
+ all: KeyFilter;
+ }
+
+ interface Match {
+ (regexp: RegExp | string, message?: string): Assertion;
+ }
+
+ interface Keys {
+ (...keys: string[]): Assertion;
+ (keys: any[]): Assertion;
+ (keys: Object): Assertion;
+ }
+
+ interface Throw {
+ (): Assertion;
+ (expected: string, message?: string): Assertion;
+ (expected: RegExp, message?: string): Assertion;
+ (constructor: Error, expected?: string, message?: string): Assertion;
+ (constructor: Error, expected?: RegExp, message?: string): Assertion;
+ (constructor: Function, expected?: string, message?: string): Assertion;
+ (constructor: Function, expected?: RegExp, message?: string): Assertion;
+ }
+
+ interface RespondTo {
+ (method: string, message?: string): Assertion;
+ }
+
+ interface Satisfy {
+ (matcher: Function, message?: string): Assertion;
+ }
+
+ interface Members {
+ (set: any[], message?: string): Assertion;
+ }
+
+ interface PropertyChange {
+ (object: Object, property: string, message?: string): Assertion;
+ }
+
+ export interface Assert {
+ /**
+ * @param expression Expression to test for truthiness.
+ * @param message Message to display on error.
+ */
+ (expression: any, message?: string): void;
+
+ /**
+ * Throws a failure.
+ *
+ * @type T Type of the objects.
+ * @param actual Actual value.
+ * @param expected Potential expected value.
+ * @param message Message to display on error.
+ * @param operator Comparison operator, if not strict equality.
+ * @remarks Node.js assert module-compatible.
+ */
+ fail<T>(actual?: T, expected?: T, message?: string, operator?: Operator): void;
+
+ /**
+ * Asserts that object is truthy.
+ *
+ * @type T Type of object.
+ * @param object Object to test.
+ * @param message Message to display on error.
+ */
+ isOk<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that object is truthy.
+ *
+ * @type T Type of object.
+ * @param object Object to test.
+ * @param message Message to display on error.
+ */
+ ok<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that object is falsy.
+ *
+ * @type T Type of object.
+ * @param object Object to test.
+ * @param message Message to display on error.
+ */
+ isNotOk<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that object is falsy.
+ *
+ * @type T Type of object.
+ * @param object Object to test.
+ * @param message Message to display on error.
+ */
+ notOk<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts non-strict equality (==) of actual and expected.
+ *
+ * @type T Type of the objects.
+ * @param actual Actual value.
+ * @param expected Potential expected value.
+ * @param message Message to display on error.
+ */
+ equal<T>(actual: T, expected: T, message?: string): void;
+
+ /**
+ * Asserts non-strict inequality (==) of actual and expected.
+ *
+ * @type T Type of the objects.
+ * @param actual Actual value.
+ * @param expected Potential expected value.
+ * @param message Message to display on error.
+ */
+ notEqual<T>(actual: T, expected: T, message?: string): void;
+
+ /**
+ * Asserts strict equality (===) of actual and expected.
+ *
+ * @type T Type of the objects.
+ * @param actual Actual value.
+ * @param expected Potential expected value.
+ * @param message Message to display on error.
+ */
+ strictEqual<T>(actual: T, expected: T, message?: string): void;
+
+ /**
+ * Asserts strict inequality (==) of actual and expected.
+ *
+ * @type T Type of the objects.
+ * @param actual Actual value.
+ * @param expected Potential expected value.
+ * @param message Message to display on error.
+ */
+ notStrictEqual<T>(actual: T, expected: T, message?: string): void;
+
+ /**
+ * Asserts that actual is deeply equal to expected.
+ *
+ * @type T Type of the objects.
+ * @param actual Actual value.
+ * @param expected Potential expected value.
+ * @param message Message to display on error.
+ */
+ deepEqual<T>(actual: T, expected: T, message?: string): void;
+
+ /**
+ * Asserts that actual is not deeply equal to expected.
+ *
+ * @type T Type of the objects.
+ * @param actual Actual value.
+ * @param expected Potential expected value.
+ * @param message Message to display on error.
+ */
+ notDeepEqual<T>(actual: T, expected: T, message?: string): void;
+
+ /**
+ * Asserts valueToCheck is strictly greater than (>) valueToBeAbove.
+ *
+ * @param valueToCheck Actual value.
+ * @param valueToBeAbove Minimum Potential expected value.
+ * @param message Message to display on error.
+ */
+ isAbove(valueToCheck: number, valueToBeAbove: number, message?: string): void;
+
+ /**
+ * Asserts valueToCheck is greater than or equal to (>=) valueToBeAtLeast.
+ *
+ * @param valueToCheck Actual value.
+ * @param valueToBeAtLeast Minimum Potential expected value.
+ * @param message Message to display on error.
+ */
+ isAtLeast(valueToCheck: number, valueToBeAtLeast: number, message?: string): void;
+
+ /**
+ * Asserts valueToCheck is strictly less than (<) valueToBeBelow.
+ *
+ * @param valueToCheck Actual value.
+ * @param valueToBeBelow Minimum Potential expected value.
+ * @param message Message to display on error.
+ */
+ isBelow(valueToCheck: number, valueToBeBelow: number, message?: string): void;
+
+ /**
+ * Asserts valueToCheck is greater than or equal to (>=) valueToBeAtMost.
+ *
+ * @param valueToCheck Actual value.
+ * @param valueToBeAtMost Minimum Potential expected value.
+ * @param message Message to display on error.
+ */
+ isAtMost(valueToCheck: number, valueToBeAtMost: number, message?: string): void;
+
+ /**
+ * Asserts that value is true.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param message Message to display on error.
+ */
+ isTrue<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that value is false.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param message Message to display on error.
+ */
+ isFalse<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that value is not true.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param message Message to display on error.
+ */
+ isNotTrue<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that value is not false.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param message Message to display on error.
+ */
+ isNotFalse<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that value is null.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param message Message to display on error.
+ */
+ isNull<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that value is not null.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param message Message to display on error.
+ */
+ isNotNull<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that value is not null.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param message Message to display on error.
+ */
+ isNaN<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that value is not null.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param message Message to display on error.
+ */
+ isNotNaN<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that value is undefined.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param message Message to display on error.
+ */
+ isUndefined<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that value is not undefined.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param message Message to display on error.
+ */
+ isDefined<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that value is a function.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param message Message to display on error.
+ */
+ isFunction<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that value is not a function.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param message Message to display on error.
+ */
+ isNotFunction<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that value is an object of type 'Object'
+ * (as revealed by Object.prototype.toString).
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param message Message to display on error.
+ * @remarks The assertion does not match subclassed objects.
+ */
+ isObject<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that value is not an object of type 'Object'
+ * (as revealed by Object.prototype.toString).
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param message Message to display on error.
+ */
+ isNotObject<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that value is an array.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param message Message to display on error.
+ */
+ isArray<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that value is not an array.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param message Message to display on error.
+ */
+ isNotArray<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that value is a string.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param message Message to display on error.
+ */
+ isString<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that value is not a string.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param message Message to display on error.
+ */
+ isNotString<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that value is a number.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param message Message to display on error.
+ */
+ isNumber<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that value is not a number.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param message Message to display on error.
+ */
+ isNotNumber<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that value is a boolean.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param message Message to display on error.
+ */
+ isBoolean<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that value is not a boolean.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param message Message to display on error.
+ */
+ isNotBoolean<T>(value: T, message?: string): void;
+
+ /**
+ * Asserts that value's type is name, as determined by Object.prototype.toString.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param name Potential expected type name of value.
+ * @param message Message to display on error.
+ */
+ typeOf<T>(value: T, name: string, message?: string): void;
+
+ /**
+ * Asserts that value's type is not name, as determined by Object.prototype.toString.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param name Potential expected type name of value.
+ * @param message Message to display on error.
+ */
+ notTypeOf<T>(value: T, name: string, message?: string): void;
+
+ /**
+ * Asserts that value is an instance of constructor.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param constructor Potential expected contructor of value.
+ * @param message Message to display on error.
+ */
+ instanceOf<T>(value: T, constructor: Function, message?: string): void;
+
+ /**
+ * Asserts that value is not an instance of constructor.
+ *
+ * @type T Type of value.
+ * @param value Actual value.
+ * @param constructor Potential expected contructor of value.
+ * @param message Message to display on error.
+ */
+ notInstanceOf<T>(value: T, type: Function, message?: string): void;
+
+ /**
+ * Asserts that haystack includes needle.
+ *
+ * @param haystack Container string.
+ * @param needle Potential expected substring of haystack.
+ * @param message Message to display on error.
+ */
+ include(haystack: string, needle: string, message?: string): void;
+
+ /**
+ * Asserts that haystack includes needle.
+ *
+ * @type T Type of values in haystack.
+ * @param haystack Container array.
+ * @param needle Potential value contained in haystack.
+ * @param message Message to display on error.
+ */
+ include<T>(haystack: T[], needle: T, message?: string): void;
+
+ /**
+ * Asserts that haystack does not include needle.
+ *
+ * @param haystack Container string.
+ * @param needle Potential expected substring of haystack.
+ * @param message Message to display on error.
+ */
+ notInclude(haystack: string, needle: any, message?: string): void;
+
+ /**
+ * Asserts that haystack does not include needle.
+ *
+ * @type T Type of values in haystack.
+ * @param haystack Container array.
+ * @param needle Potential value contained in haystack.
+ * @param message Message to display on error.
+ */
+ notInclude(haystack: any[], needle: any, message?: string): void;
+
+ /**
+ * Asserts that value matches the regular expression regexp.
+ *
+ * @param value Actual value.
+ * @param regexp Potential match of value.
+ * @param message Message to display on error.
+ */
+ match(value: string, regexp: RegExp, message?: string): void;
+
+ /**
+ * Asserts that value does not match the regular expression regexp.
+ *
+ * @param value Actual value.
+ * @param regexp Potential match of value.
+ * @param message Message to display on error.
+ */
+ notMatch(expected: any, regexp: RegExp, message?: string): void;
+
+ /**
+ * Asserts that object has a property named by property.
+ *
+ * @type T Type of object.
+ * @param object Container object.
+ * @param property Potential contained property of object.
+ * @param message Message to display on error.
+ */
+ property<T>(object: T, property: string /* keyof T */, message?: string): void;
+
+ /**
+ * Asserts that object has a property named by property.
+ *
+ * @type T Type of object.
+ * @param object Container object.
+ * @param property Potential contained property of object.
+ * @param message Message to display on error.
+ */
+ notProperty<T>(object: T, property: string /* keyof T */, message?: string): void;
+
+ /**
+ * Asserts that object has a property named by property, which can be a string
+ * using dot- and bracket-notation for deep reference.
+ *
+ * @type T Type of object.
+ * @param object Container object.
+ * @param property Potential contained property of object.
+ * @param message Message to display on error.
+ */
+ deepProperty<T>(object: T, property: string, message?: string): void;
+
+ /**
+ * Asserts that object does not have a property named by property, which can be a
+ * string using dot- and bracket-notation for deep reference.
+ *
+ * @type T Type of object.
+ * @param object Container object.
+ * @param property Potential contained property of object.
+ * @param message Message to display on error.
+ */
+ notDeepProperty<T>(object: T, property: string, message?: string): void;
+
+ /**
+ * Asserts that object has a property named by property with value given by value.
+ *
+ * @type T Type of object.
+ * @type V Type of value.
+ * @param object Container object.
+ * @param property Potential contained property of object.
+ * @param value Potential expected property value.
+ * @param message Message to display on error.
+ */
+ propertyVal<T, V>(object: T, property: string /* keyof T */, value: V, message?: string): void;
+
+ /**
+ * Asserts that object has a property named by property with value given by value.
+ *
+ * @type T Type of object.
+ * @type V Type of value.
+ * @param object Container object.
+ * @param property Potential contained property of object.
+ * @param value Potential expected property value.
+ * @param message Message to display on error.
+ */
+ propertyNotVal<T, V>(object: T, property: string /* keyof T */, value: V, message?: string): void;
+
+ /**
+ * Asserts that object has a property named by property, which can be a string
+ * using dot- and bracket-notation for deep reference.
+ *
+ * @type T Type of object.
+ * @type V Type of value.
+ * @param object Container object.
+ * @param property Potential contained property of object.
+ * @param value Potential expected property value.
+ * @param message Message to display on error.
+ */
+ deepPropertyVal<T, V>(object: T, property: string, value: V, message?: string): void;
+
+ /**
+ * Asserts that object does not have a property named by property, which can be a
+ * string using dot- and bracket-notation for deep reference.
+ *
+ * @type T Type of object.
+ * @type V Type of value.
+ * @param object Container object.
+ * @param property Potential contained property of object.
+ * @param value Potential expected property value.
+ * @param message Message to display on error.
+ */
+ deepPropertyNotVal<T, V>(object: T, property: string, value: V, message?: string): void;
+
+ /**
+ * Asserts that object has a length property with the expected value.
+ *
+ * @type T Type of object.
+ * @param object Container object.
+ * @param length Potential expected length of object.
+ * @param message Message to display on error.
+ */
+ lengthOf<T extends { readonly length?: number }>(object: T, length: number, message?: string): void;
+
+ /**
+ * Asserts that fn will throw an error.
+ *
+ * @param fn Function that may throw.
+ * @param message Message to display on error.
+ */
+ throw(fn: Function, message?: string): void;
+
+ /**
+ * Asserts that function will throw an error with message matching regexp.
+ *
+ * @param fn Function that may throw.
+ * @param regExp Potential expected message match.
+ * @param message Message to display on error.
+ */
+ throw(fn: Function, regExp: RegExp): void;
+
+ /**
+ * Asserts that function will throw an error that is an instance of constructor.
+ *
+ * @param fn Function that may throw.
+ * @param constructor Potential expected error constructor.
+ * @param message Message to display on error.
+ */
+ throw(fn: Function, constructor: Function, message?: string): void;
+
+ /**
+ * Asserts that function will throw an error that is an instance of constructor
+ * and an error with message matching regexp.
+ *
+ * @param fn Function that may throw.
+ * @param constructor Potential expected error constructor.
+ * @param message Message to display on error.
+ */
+ throw(fn: Function, constructor: Function, regExp: RegExp): void;
+
+ /**
+ * Asserts that fn will throw an error.
+ *
+ * @param fn Function that may throw.
+ * @param message Message to display on error.
+ */
+ throws(fn: Function, message?: string): void;
+
+ /**
+ * Asserts that function will throw an error with message matching regexp.
+ *
+ * @param fn Function that may throw.
+ * @param regExp Potential expected message match.
+ * @param message Message to display on error.
+ */
+ throws(fn: Function, regExp: RegExp, message?: string): void;
+
+ /**
+ * Asserts that function will throw an error that is an instance of constructor.
+ *
+ * @param fn Function that may throw.
+ * @param constructor Potential expected error constructor.
+ * @param message Message to display on error.
+ */
+ throws(fn: Function, errType: Function, message?: string): void;
+
+ /**
+ * Asserts that function will throw an error that is an instance of constructor
+ * and an error with message matching regexp.
+ *
+ * @param fn Function that may throw.
+ * @param constructor Potential expected error constructor.
+ * @param message Message to display on error.
+ */
+ throws(fn: Function, errType: Function, regExp: RegExp): void;
+
+ /**
+ * Asserts that fn will throw an error.
+ *
+ * @param fn Function that may throw.
+ * @param message Message to display on error.
+ */
+ Throw(fn: Function, message?: string): void;
+
+ /**
+ * Asserts that function will throw an error with message matching regexp.
+ *
+ * @param fn Function that may throw.
+ * @param regExp Potential expected message match.
+ * @param message Message to display on error.
+ */
+ Throw(fn: Function, regExp: RegExp): void;
+
+ /**
+ * Asserts that function will throw an error that is an instance of constructor.
+ *
+ * @param fn Function that may throw.
+ * @param constructor Potential expected error constructor.
+ * @param message Message to display on error.
+ */
+ Throw(fn: Function, errType: Function, message?: string): void;
+
+ /**
+ * Asserts that function will throw an error that is an instance of constructor
+ * and an error with message matching regexp.
+ *
+ * @param fn Function that may throw.
+ * @param constructor Potential expected error constructor.
+ * @param message Message to display on error.
+ */
+ Throw(fn: Function, errType: Function, regExp: RegExp): void;
+
+ /**
+ * Asserts that fn will not throw an error.
+ *
+ * @param fn Function that may throw.
+ * @param message Message to display on error.
+ */
+ doesNotThrow(fn: Function, message?: string): void;
+
+ /**
+ * Asserts that function will throw an error with message matching regexp.
+ *
+ * @param fn Function that may throw.
+ * @param regExp Potential expected message match.
+ * @param message Message to display on error.
+ */
+ doesNotThrow(fn: Function, regExp: RegExp): void;
+
+ /**
+ * Asserts that function will throw an error that is an instance of constructor.
+ *
+ * @param fn Function that may throw.
+ * @param constructor Potential expected error constructor.
+ * @param message Message to display on error.
+ */
+ doesNotThrow(fn: Function, errType: Function, message?: string): void;
+
+ /**
+ * Asserts that function will throw an error that is an instance of constructor
+ * and an error with message matching regexp.
+ *
+ * @param fn Function that may throw.
+ * @param constructor Potential expected error constructor.
+ * @param message Message to display on error.
+ */
+ doesNotThrow(fn: Function, errType: Function, regExp: RegExp): void;
+
+ /**
+ * Compares two values using operator.
+ *
+ * @param val1 Left value during comparison.
+ * @param operator Comparison operator.
+ * @param val2 Right value during comparison.
+ * @param message Message to display on error.
+ */
+ operator(val1: OperatorComparable, operator: Operator, val2: OperatorComparable, message?: string): void;
+
+ /**
+ * Asserts that the target is equal to expected, to within a +/- delta range.
+ *
+ * @param actual Actual value
+ * @param expected Potential expected value.
+ * @param delta Maximum differenced between values.
+ * @param message Message to display on error.
+ */
+ closeTo(actual: number, expected: number, delta: number, message?: string): void;
+
+ /**
+ * Asserts that the target is equal to expected, to within a +/- delta range.
+ *
+ * @param actual Actual value
+ * @param expected Potential expected value.
+ * @param delta Maximum differenced between values.
+ * @param message Message to display on error.
+ */
+ approximately(act: number, exp: number, delta: number, message?: string): void;
+
+ /**
+ * Asserts that set1 and set2 have the same members. Order is not take into account.
+ *
+ * @type T Type of set values.
+ * @param set1 Actual set of values.
+ * @param set2 Potential expected set of values.
+ * @param message Message to display on error.
+ */
+ sameMembers<T>(set1: T[], set2: T[], message?: string): void;
+
+ /**
+ * Asserts that set1 and set2 have the same members using deep equality checking.
+ * Order is not take into account.
+ *
+ * @type T Type of set values.
+ * @param set1 Actual set of values.
+ * @param set2 Potential expected set of values.
+ * @param message Message to display on error.
+ */
+ sameDeepMembers<T>(set1: T[], set2: T[], message?: string): void;
+
+ /**
+ * Asserts that subset is included in superset. Order is not take into account.
+ *
+ * @type T Type of set values.
+ * @param superset Actual set of values.
+ * @param subset Potential contained set of values.
+ * @param message Message to display on error.
+ */
+ includeMembers<T>(superset: T[], subset: T[], message?: string): void;
+
+ /**
+ * Asserts that subset is included in superset using deep equality checking.
+ * Order is not take into account.
+ *
+ * @type T Type of set values.
+ * @param superset Actual set of values.
+ * @param subset Potential contained set of values.
+ * @param message Message to display on error.
+ */
+ includeDeepMembers<T>(superset: T[], subset: T[], message?: string): void;
+
+ /**
+ * Asserts that non-object, non-array value inList appears in the flat array list.
+ *
+ * @type T Type of list values.
+ * @param inList Value expected to be in the list.
+ * @param list List of values.
+ * @param message Message to display on error.
+ */
+ oneOf<T>(inList: T, list: T[], message?: string): void;
+
+ /**
+ * Asserts that a function changes the value of a property.
+ *
+ * @type T Type of object.
+ * @param modifier Function to run.
+ * @param object Container object.
+ * @param property Property of object expected to be modified.
+ * @param message Message to display on error.
+ */
+ changes<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void;
+
+ /**
+ * Asserts that a function does not change the value of a property.
+ *
+ * @type T Type of object.
+ * @param modifier Function to run.
+ * @param object Container object.
+ * @param property Property of object expected not to be modified.
+ * @param message Message to display on error.
+ */
+ doesNotChange<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void;
+
+ /**
+ * Asserts that a function increases an object property.
+ *
+ * @type T Type of object.
+ * @param modifier Function to run.
+ * @param object Container object.
+ * @param property Property of object expected to be increased.
+ * @param message Message to display on error.
+ */
+ increases<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void;
+
+ /**
+ * Asserts that a function does not increase an object property.
+ *
+ * @type T Type of object.
+ * @param modifier Function to run.
+ * @param object Container object.
+ * @param property Property of object expected not to be increased.
+ * @param message Message to display on error.
+ */
+ doesNotIncrease<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void;
+
+ /**
+ * Asserts that a function decreases an object property.
+ *
+ * @type T Type of object.
+ * @param modifier Function to run.
+ * @param object Container object.
+ * @param property Property of object expected to be decreased.
+ * @param message Message to display on error.
+ */
+ decreases<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void;
+
+ /**
+ * Asserts that a function does not decrease an object property.
+ *
+ * @type T Type of object.
+ * @param modifier Function to run.
+ * @param object Container object.
+ * @param property Property of object expected not to be decreased.
+ * @param message Message to display on error.
+ */
+ doesNotDecrease<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void;
+
+ /**
+ * Asserts if value is not a false value, and throws if it is a true value.
+ *
+ * @type T Type of object.
+ * @param object Actual value.
+ * @param message Message to display on error.
+ * @remarks This is added to allow for chai to be a drop-in replacement for
+ * Node’s assert class.
+ */
+ ifError<T>(object: T, message?: string): void;
+
+ /**
+ * Asserts that object is extensible (can have new properties added to it).
+ *
+ * @type T Type of object
+ * @param object Actual value.
+ * @param message Message to display on error.
+ */
+ isExtensible<T>(object: T, message?: string): void;
+
+ /**
+ * Asserts that object is extensible (can have new properties added to it).
+ *
+ * @type T Type of object
+ * @param object Actual value.
+ * @param message Message to display on error.
+ */
+ extensible<T>(object: T, message?: string): void;
+
+ /**
+ * Asserts that object is not extensible.
+ *
+ * @type T Type of object
+ * @param object Actual value.
+ * @param message Message to display on error.
+ */
+ isNotExtensible<T>(object: T, message?: string): void;
+
+ /**
+ * Asserts that object is not extensible.
+ *
+ * @type T Type of object
+ * @param object Actual value.
+ * @param message Message to display on error.
+ */
+ notExtensible<T>(object: T, message?: string): void;
+
+ /**
+ * Asserts that object is sealed (can have new properties added to it
+ * and its existing properties cannot be removed).
+ *
+ * @type T Type of object
+ * @param object Actual value.
+ * @param message Message to display on error.
+ */
+ isSealed<T>(object: T, message?: string): void;
+
+ /**
+ * Asserts that object is sealed (can have new properties added to it
+ * and its existing properties cannot be removed).
+ *
+ * @type T Type of object
+ * @param object Actual value.
+ * @param message Message to display on error.
+ */
+ sealed<T>(object: T, message?: string): void;
+
+ /**
+ * Asserts that object is not sealed.
+ *
+ * @type T Type of object
+ * @param object Actual value.
+ * @param message Message to display on error.
+ */
+ isNotSealed<T>(object: T, message?: string): void;
+
+ /**
+ * Asserts that object is not sealed.
+ *
+ * @type T Type of object
+ * @param object Actual value.
+ * @param message Message to display on error.
+ */
+ notSealed<T>(object: T, message?: string): void;
+
+ /**
+ * Asserts that object is frozen (cannot have new properties added to it
+ * and its existing properties cannot be removed).
+ *
+ * @type T Type of object
+ * @param object Actual value.
+ * @param message Message to display on error.
+ */
+ isFrozen<T>(object: T, message?: string): void;
+
+ /**
+ * Asserts that object is frozen (cannot have new properties added to it
+ * and its existing properties cannot be removed).
+ *
+ * @type T Type of object
+ * @param object Actual value.
+ * @param message Message to display on error.
+ */
+ frozen<T>(object: T, message?: string): void;
+
+ /**
+ * Asserts that object is not frozen (cannot have new properties added to it
+ * and its existing properties cannot be removed).
+ *
+ * @type T Type of object
+ * @param object Actual value.
+ * @param message Message to display on error.
+ */
+ isNotFrozen<T>(object: T, message?: string): void;
+
+ /**
+ * Asserts that object is not frozen (cannot have new properties added to it
+ * and its existing properties cannot be removed).
+ *
+ * @type T Type of object
+ * @param object Actual value.
+ * @param message Message to display on error.
+ */
+ notFrozen<T>(object: T, message?: string): void;
+ }
+
+ export interface Config {
+ /**
+ * Default: false
+ */
+ includeStack: boolean;
+
+ /**
+ * Default: true
+ */
+ showDiff: boolean;
+
+ /**
+ * Default: 40
+ */
+ truncateThreshold: number;
+ }
+
+ export class AssertionError {
+ constructor(message: string, _props?: any, ssf?: Function);
+ public name: string;
+ public message: string;
+ public showDiff: boolean;
+ public stack: string;
+ }
+}
+
+declare const chai: Chai.ChaiStatic;
+
+declare module 'chai' {
+ export = chai;
+}
+
+interface Object {
+ should: Chai.Assertion;
+}
diff --git a/packages/typescript-typings/types/ethers-contracts/index.d.ts b/packages/typescript-typings/types/ethers-contracts/index.d.ts
new file mode 100644
index 000000000..e5d38819e
--- /dev/null
+++ b/packages/typescript-typings/types/ethers-contracts/index.d.ts
@@ -0,0 +1,28 @@
+declare module 'ethers-contracts' {
+ export interface TransactionDescription {
+ name: string;
+ signature: string;
+ sighash: string;
+ data: string;
+ }
+ export interface CallDescription extends TransactionDescription {
+ parse: (...args: any[]) => any;
+ }
+ export interface FunctionDescription {
+ (...params: any[]): TransactionDescription | CallDescription;
+ inputs: { names: string[]; types: string[] };
+ outputs: { names: string[]; types: string[] };
+ }
+ export interface EventDescription {
+ parse: (...args: any[]) => any;
+ inputs: { names: string[]; types: string[] };
+ signature: string;
+ topic: string;
+ }
+ export class Interface {
+ public functions: { [functionName: string]: FunctionDescription };
+ public events: { [eventName: string]: EventDescription };
+ public static decodeParams(types: string[], data: string): any[];
+ constructor(abi: any);
+ }
+}
diff --git a/packages/typescript-typings/types/web3/index.d.ts b/packages/typescript-typings/types/web3/index.d.ts
new file mode 100644
index 000000000..cbe067b37
--- /dev/null
+++ b/packages/typescript-typings/types/web3/index.d.ts
@@ -0,0 +1,440 @@
+declare module 'web3' {
+ import * as BigNumber from 'bignumber.js';
+
+ type MixedData = string | number | object | any[] | BigNumber.BigNumber;
+
+ class Web3 {
+ public static providers: typeof providers;
+ public currentProvider: Web3.Provider;
+
+ public eth: Web3.EthApi;
+ public personal: Web3.PersonalApi | undefined;
+ public version: Web3.VersionApi;
+ public net: Web3.NetApi;
+
+ public constructor(provider?: Web3.Provider);
+
+ public isConnected(): boolean;
+ public setProvider(provider: Web3.Provider): void;
+ public reset(keepIsSyncing: boolean): void;
+ public toHex(data: MixedData): string;
+ public toAscii(hex: string): string;
+ public fromAscii(ascii: string, padding?: number): string;
+ public toDecimal(hex: string): number;
+ public fromDecimal(value: number | string): string;
+ public fromWei(value: number | string, unit: Web3.Unit): string;
+ public fromWei(value: BigNumber.BigNumber, unit: Web3.Unit): BigNumber.BigNumber;
+ public toWei(amount: number | string, unit: Web3.Unit): string;
+ public toWei(amount: BigNumber.BigNumber, unit: Web3.Unit): BigNumber.BigNumber;
+ public toBigNumber(value: number | string): BigNumber.BigNumber;
+ public isAddress(address: string): boolean;
+ public isChecksumAddress(address: string): boolean;
+ public sha3(value: string, options?: Web3.Sha3Options): string;
+ }
+
+ namespace providers {
+ class HttpProvider implements Web3.Provider {
+ constructor(url?: string, timeout?: number, username?: string, password?: string);
+ public sendAsync(
+ payload: Web3.JSONRPCRequestPayload,
+ callback: (err: Error, result: Web3.JSONRPCResponsePayload) => void,
+ ): void;
+ }
+ }
+
+ namespace Web3 {
+ type ContractAbi = AbiDefinition[];
+
+ type AbiDefinition = FunctionAbi | EventAbi;
+
+ type FunctionAbi = MethodAbi | ConstructorAbi | FallbackAbi;
+
+ enum AbiType {
+ Function = 'function',
+ Constructor = 'constructor',
+ Event = 'event',
+ Fallback = 'fallback',
+ }
+
+ type ConstructorStateMutability = 'nonpayable' | 'payable';
+ type StateMutability = 'pure' | 'view' | ConstructorStateMutability;
+
+ interface MethodAbi {
+ type: AbiType.Function;
+ name: string;
+ inputs: DataItem[];
+ outputs: DataItem[];
+ constant: boolean;
+ stateMutability: StateMutability;
+ payable: boolean;
+ }
+
+ interface ConstructorAbi {
+ type: AbiType.Constructor;
+ inputs: DataItem[];
+ payable: boolean;
+ stateMutability: ConstructorStateMutability;
+ }
+
+ interface FallbackAbi {
+ type: AbiType.Fallback;
+ payable: boolean;
+ }
+
+ interface EventParameter extends DataItem {
+ indexed: boolean;
+ }
+
+ interface EventAbi {
+ type: AbiType.Event;
+ name: string;
+ inputs: EventParameter[];
+ anonymous: boolean;
+ }
+
+ interface DataItem {
+ name: string;
+ type: string;
+ components: DataItem[];
+ }
+
+ interface ContractInstance {
+ address: string;
+ abi: Web3.ContractAbi;
+ [name: string]: any;
+ }
+
+ interface Contract<A extends ContractInstance> {
+ at(address: string): A;
+ getData(...args: any[]): string;
+ 'new'(...args: any[]): A;
+ }
+
+ interface FilterObject {
+ fromBlock?: number | string;
+ toBlock?: number | string;
+ address?: string;
+ topics?: LogTopic[];
+ }
+
+ type LogTopic = null | string | string[];
+
+ interface DecodedLogEntry<A> extends LogEntry {
+ event: string;
+ args: A;
+ }
+
+ interface DecodedLogEntryEvent<A> extends DecodedLogEntry<A> {
+ removed: boolean;
+ }
+
+ interface LogEntryEvent extends LogEntry {
+ removed: boolean;
+ }
+
+ interface FilterResult {
+ get(callback: () => void): void;
+ watch(callback: (err: Error, result: LogEntryEvent) => void): void;
+ stopWatching(callback?: () => void): void;
+ }
+
+ export interface JSONRPCRequestPayload {
+ params: any[];
+ method: string;
+ id: number;
+ jsonrpc: string;
+ }
+
+ export interface JSONRPCResponsePayload {
+ result: any;
+ id: number;
+ jsonrpc: string;
+ }
+
+ export type OpCode = string;
+
+ export interface StructLog {
+ depth: number;
+ error: string;
+ gas: number;
+ gasCost: number;
+ memory: string[];
+ op: OpCode;
+ pc: number;
+ stack: string[];
+ storage: { [location: string]: string };
+ }
+ export interface TransactionTrace {
+ gas: number;
+ returnValue: any;
+ structLogs: StructLog[];
+ }
+
+ interface Provider {
+ sendAsync(
+ payload: JSONRPCRequestPayload,
+ callback: (err: Error, result: JSONRPCResponsePayload) => void,
+ ): void;
+ }
+
+ interface Sha3Options {
+ encoding: 'hex';
+ }
+
+ interface EthApi {
+ coinbase: string;
+ mining: boolean;
+ hashrate: number;
+ gasPrice: BigNumber.BigNumber;
+ accounts: string[];
+ blockNumber: number;
+ defaultAccount?: string;
+ defaultBlock: Web3.BlockParam;
+ syncing: Web3.SyncingResult;
+ compile: {
+ solidity(sourceString: string, cb?: (err: Error, result: any) => void): object;
+ };
+ getMining(cd: (err: Error, mining: boolean) => void): void;
+ getHashrate(cd: (err: Error, hashrate: number) => void): void;
+ getGasPrice(cd: (err: Error, gasPrice: BigNumber.BigNumber) => void): void;
+ getAccounts(cd: (err: Error, accounts: string[]) => void): void;
+ getBlockNumber(callback: (err: Error, blockNumber: number) => void): void;
+ getSyncing(cd: (err: Error, syncing: Web3.SyncingResult) => void): void;
+ isSyncing(cb: (err: Error, isSyncing: boolean, syncingState: Web3.SyncingState) => void): Web3.IsSyncing;
+
+ getBlock(hashStringOrBlockNumber: string | Web3.BlockParam): Web3.BlockWithoutTransactionData;
+ getBlock(
+ hashStringOrBlockNumber: string | Web3.BlockParam,
+ callback: (err: Error, blockObj: Web3.BlockWithoutTransactionData) => void,
+ ): void;
+ getBlock(
+ hashStringOrBlockNumber: string | Web3.BlockParam,
+ returnTransactionObjects: true,
+ ): Web3.BlockWithTransactionData;
+ getBlock(
+ hashStringOrBlockNumber: string | Web3.BlockParam,
+ returnTransactionObjects: true,
+ callback: (err: Error, blockObj: Web3.BlockWithTransactionData) => void,
+ ): void;
+
+ getBlockTransactionCount(hashStringOrBlockNumber: string | Web3.BlockParam): number;
+ getBlockTransactionCount(
+ hashStringOrBlockNumber: string | Web3.BlockParam,
+ callback: (err: Error, blockTransactionCount: number) => void,
+ ): void;
+
+ // TODO returnTransactionObjects
+ getUncle(
+ hashStringOrBlockNumber: string | Web3.BlockParam,
+ uncleNumber: number,
+ ): Web3.BlockWithoutTransactionData;
+ getUncle(
+ hashStringOrBlockNumber: string | Web3.BlockParam,
+ uncleNumber: number,
+ callback: (err: Error, uncle: Web3.BlockWithoutTransactionData) => void,
+ ): void;
+
+ getTransaction(transactionHash: string): Web3.Transaction;
+ getTransaction(
+ transactionHash: string,
+ callback: (err: Error, transaction: Web3.Transaction) => void,
+ ): void;
+
+ getTransactionFromBlock(
+ hashStringOrBlockNumber: string | Web3.BlockParam,
+ indexNumber: number,
+ ): Web3.Transaction;
+ getTransactionFromBlock(
+ hashStringOrBlockNumber: string | Web3.BlockParam,
+ indexNumber: number,
+ callback: (err: Error, transaction: Web3.Transaction) => void,
+ ): void;
+
+ contract(abi: Web3.AbiDefinition[]): Web3.Contract<any>;
+
+ // TODO block param
+ getBalance(addressHexString: string): BigNumber.BigNumber;
+ getBalance(addressHexString: string, callback: (err: Error, result: BigNumber.BigNumber) => void): void;
+
+ // TODO block param
+ getStorageAt(address: string, position: number): string;
+ getStorageAt(address: string, position: number, callback: (err: Error, storage: string) => void): void;
+
+ // TODO block param
+ getCode(addressHexString: string): string;
+ getCode(addressHexString: string, callback: (err: Error, code: string) => void): void;
+
+ filter(value: string | Web3.FilterObject): Web3.FilterResult;
+
+ sendTransaction(txData: Web3.TxData): string;
+ sendTransaction(txData: Web3.TxData, callback: (err: Error, value: string) => void): void;
+
+ sendRawTransaction(rawTxData: string): string;
+ sendRawTransaction(rawTxData: string, callback: (err: Error, value: string) => void): void;
+
+ sign(address: string, data: string): string;
+ sign(address: string, data: string, callback: (err: Error, signature: string) => void): void;
+
+ getTransactionReceipt(txHash: string): Web3.TransactionReceipt | null;
+ getTransactionReceipt(
+ txHash: string,
+ callback: (err: Error, receipt: Web3.TransactionReceipt | null) => void,
+ ): void;
+
+ // TODO block param
+ call(callData: Web3.CallData): string;
+ call(callData: Web3.CallData, callback: (err: Error, result: string) => void): void;
+
+ estimateGas(callData: Web3.CallData): number;
+ estimateGas(callData: Web3.CallData, callback: (err: Error, gas: number) => void): void;
+
+ // TODO defaultBlock
+ getTransactionCount(address: string): number;
+ getTransactionCount(address: string, callback: (err: Error, count: number) => void): void;
+ }
+
+ interface VersionApi {
+ api: string;
+ network: string;
+ node: string;
+ ethereum: string;
+ whisper: string;
+ getNetwork(cd: (err: Error, networkId: string) => void): void;
+ getNode(cd: (err: Error, nodeVersion: string) => void): void;
+ getEthereum(cd: (err: Error, ethereum: string) => void): void;
+ getWhisper(cd: (err: Error, whisper: string) => void): void;
+ }
+
+ interface PersonalApi {
+ listAccounts: string[] | undefined;
+ newAccount(password?: string): string;
+ unlockAccount(address: string, password?: string, duration?: number): boolean;
+ lockAccount(address: string): boolean;
+ sign(message: string, account: string, password: string): string;
+ sign(hexMessage: string, account: string, callback: (error: Error, signature: string) => void): void;
+ }
+
+ interface NetApi {
+ listening: boolean;
+ peerCount: number;
+ getListening(cd: (err: Error, listening: boolean) => void): void;
+ getPeerCount(cd: (err: Error, peerCount: number) => void): void;
+ }
+
+ type BlockParam = number | 'earliest' | 'latest' | 'pending';
+
+ type Unit =
+ | 'kwei'
+ | 'ada'
+ | 'mwei'
+ | 'babbage'
+ | 'gwei'
+ | 'shannon'
+ | 'szabo'
+ | 'finney'
+ | 'ether'
+ | 'kether'
+ | 'grand'
+ | 'einstein'
+ | 'mether'
+ | 'gether'
+ | 'tether';
+
+ interface SyncingState {
+ startingBlock: number;
+ currentBlock: number;
+ highestBlock: number;
+ }
+ type SyncingResult = false | SyncingState;
+
+ interface IsSyncing {
+ addCallback(cb: (err: Error, isSyncing: boolean, syncingState: SyncingState) => void): void;
+ stopWatching(): void;
+ }
+
+ interface AbstractBlock {
+ number: number | null;
+ hash: string | null;
+ parentHash: string;
+ nonce: string | null;
+ sha3Uncles: string;
+ logsBloom: string | null;
+ transactionsRoot: string;
+ stateRoot: string;
+ miner: string;
+ difficulty: BigNumber.BigNumber;
+ totalDifficulty: BigNumber.BigNumber;
+ extraData: string;
+ size: number;
+ gasLimit: number;
+ gasUsed: number;
+ timestamp: number;
+ uncles: string[];
+ }
+ interface BlockWithoutTransactionData extends AbstractBlock {
+ transactions: string[];
+ }
+ interface BlockWithTransactionData extends AbstractBlock {
+ transactions: Transaction[];
+ }
+
+ interface Transaction {
+ hash: string;
+ nonce: number;
+ blockHash: string | null;
+ blockNumber: number | null;
+ transactionIndex: number | null;
+ from: string;
+ to: string | null;
+ value: BigNumber.BigNumber;
+ gasPrice: BigNumber.BigNumber;
+ gas: number;
+ input: string;
+ }
+
+ interface CallTxDataBase {
+ to?: string;
+ value?: number | string | BigNumber.BigNumber;
+ gas?: number | string | BigNumber.BigNumber;
+ gasPrice?: number | string | BigNumber.BigNumber;
+ data?: string;
+ nonce?: number;
+ }
+
+ interface TxData extends CallTxDataBase {
+ from: string;
+ }
+
+ interface CallData extends CallTxDataBase {
+ from?: string;
+ }
+
+ interface TransactionReceipt {
+ blockHash: string;
+ blockNumber: number;
+ transactionHash: string;
+ transactionIndex: number;
+ from: string;
+ to: string;
+ status: null | string | 0 | 1;
+ cumulativeGasUsed: number;
+ gasUsed: number;
+ contractAddress: string | null;
+ logs: LogEntry[];
+ }
+
+ interface LogEntry {
+ logIndex: number | null;
+ transactionIndex: number | null;
+ transactionHash: string;
+ blockHash: string | null;
+ blockNumber: number | null;
+ address: string;
+ data: string;
+ topics: string[];
+ }
+ }
+ /* tslint:disable */
+ export = Web3;
+ /* tslint:enable */
+}