diff --git a/types/node/index.d.ts b/types/node/index.d.ts index f39dc1dc74a4b9..49fd7364e3da20 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -26,6 +26,7 @@ // Lishude // Andrew Makarov // Zane Hannan AU +// Eugene Y. Q. Shen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** inspector module types */ @@ -6381,7 +6382,7 @@ declare module "util" { } declare module "assert" { - function internal(value: any, message?: string): void; + function internal(value: any, message?: string | Error): void; namespace internal { export class AssertionError implements Error { name: string; @@ -6390,46 +6391,42 @@ declare module "assert" { expected: any; operator: string; generatedMessage: boolean; + code: 'ERR_ASSERTION'; constructor(options?: { message?: string; actual?: any; expected?: any; - operator?: string; stackStartFunction?: Function + operator?: string; stackStartFn?: Function }); } - export function fail(message: string): never; - /** @deprecated since v10.0.0 */ - export function fail(actual: any, expected: any, message?: string, operator?: string): never; - export function ok(value: any, message?: string): void; - /** @deprecated use strictEqual() */ - export function equal(actual: any, expected: any, message?: string): void; - /** @deprecated use notStrictEqual() */ - export function notEqual(actual: any, expected: any, message?: string): void; - /** @deprecated use deepStrictEqual() */ - export function deepEqual(actual: any, expected: any, message?: string): void; - /** @deprecated use notDeepStrictEqual() */ - export function notDeepEqual(acutal: any, expected: any, message?: string): void; - export function strictEqual(actual: any, expected: any, message?: string): void; - export function notStrictEqual(actual: any, expected: any, message?: string): void; - export function deepStrictEqual(actual: any, expected: any, message?: string): void; - export function notDeepStrictEqual(actual: any, expected: any, message?: string): void; - - export function throws(block: Function, message?: string): void; - export function throws(block: Function, error: Function, message?: string): void; - export function throws(block: Function, error: RegExp, message?: string): void; - export function throws(block: Function, error: (err: any) => boolean, message?: string): void; - - export function doesNotThrow(block: Function, message?: string): void; - export function doesNotThrow(block: Function, error: Function, message?: string): void; - export function doesNotThrow(block: Function, error: RegExp, message?: string): void; - export function doesNotThrow(block: Function, error: (err: any) => boolean, message?: string): void; + export function fail(message?: string | Error): never; + /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */ + export function fail(actual: any, expected: any, message?: string | Error, operator?: string, stackStartFn?: Function): never; + export function ok(value: any, message?: string | Error): void; + /** @deprecated since v9.9.0 - use strictEqual() instead. */ + export function equal(actual: any, expected: any, message?: string | Error): void; + /** @deprecated since v9.9.0 - use notStrictEqual() instead. */ + export function notEqual(actual: any, expected: any, message?: string | Error): void; + /** @deprecated since v9.9.0 - use deepStrictEqual() instead. */ + export function deepEqual(actual: any, expected: any, message?: string | Error): void; + /** @deprecated since v9.9.0 - use notDeepStrictEqual() instead. */ + export function notDeepEqual(actual: any, expected: any, message?: string | Error): void; + export function strictEqual(actual: any, expected: any, message?: string | Error): void; + export function notStrictEqual(actual: any, expected: any, message?: string | Error): void; + export function deepStrictEqual(actual: any, expected: any, message?: string | Error): void; + export function notDeepStrictEqual(actual: any, expected: any, message?: string | Error): void; + + export function throws(block: Function, message?: string | Error): void; + export function throws(block: Function, error: RegExp | Function | Object | Error, message?: string | Error): void; + export function doesNotThrow(block: Function, message?: string | Error): void; + export function doesNotThrow(block: Function, error: RegExp | Function, message?: string | Error): void; export function ifError(value: any): void; - export function rejects(block: Function | Promise, message?: string): Promise; - export function rejects(block: Function | Promise, error: Function | RegExp | Object | Error, message?: string): Promise; - export function doesNotReject(block: Function | Promise, message?: string): Promise; - export function doesNotReject(block: Function | Promise, error: Function | RegExp | Object | Error, message?: string): Promise; + export function rejects(block: Function | Promise, message?: string | Error): Promise; + export function rejects(block: Function | Promise, error: RegExp | Function | Object | Error, message?: string | Error): Promise; + export function doesNotReject(block: Function | Promise, message?: string | Error): Promise; + export function doesNotReject(block: Function | Promise, error: RegExp | Function, message?: string | Error): Promise; export var strict: typeof internal; } diff --git a/types/node/v0/index.d.ts b/types/node/v0/index.d.ts index dce2a1a54dea44..3bc1b3ed5dba05 100644 --- a/types/node/v0/index.d.ts +++ b/types/node/v0/index.d.ts @@ -573,42 +573,42 @@ declare module "http" { */ export interface ClientResponse extends IncomingMessage { } - export interface AgentOptions { - /** - * Keep sockets around in a pool to be used by other requests in the future. Default = false - */ - keepAlive?: boolean; - /** - * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000. - * Only relevant if keepAlive is set to true. - */ - keepAliveMsecs?: number; - /** - * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity - */ - maxSockets?: number; - /** - * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256. - */ - maxFreeSockets?: number; - } + export interface AgentOptions { + /** + * Keep sockets around in a pool to be used by other requests in the future. Default = false + */ + keepAlive?: boolean; + /** + * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000. + * Only relevant if keepAlive is set to true. + */ + keepAliveMsecs?: number; + /** + * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity + */ + maxSockets?: number; + /** + * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256. + */ + maxFreeSockets?: number; + } export class Agent { - maxFreeSockets: number; - maxSockets: number; - sockets: any; - requests: any; - - constructor(opts?: AgentOptions); - - /** - * Destroy any sockets that are currently in use by the agent. - * It is usually not necessary to do this. However, if you are using an agent with KeepAlive enabled, - * then it is best to explicitly shut down the agent when you know that it will no longer be used. Otherwise, - * sockets may hang open for quite a long time before the server terminates them. - */ - destroy(): void; - } + maxFreeSockets: number; + maxSockets: number; + sockets: any; + requests: any; + + constructor(opts?: AgentOptions); + + /** + * Destroy any sockets that are currently in use by the agent. + * It is usually not necessary to do this. However, if you are using an agent with KeepAlive enabled, + * then it is best to explicitly shut down the agent when you know that it will no longer be used. Otherwise, + * sockets may hang open for quite a long time before the server terminates them. + */ + destroy(): void; + } export var METHODS: string[]; @@ -1858,7 +1858,7 @@ declare module "util" { } declare module "assert" { - function internal (value: any, message?: string): void; + function internal(value: any, message?: string): void; namespace internal { export class AssertionError implements Error { name: string; @@ -1868,8 +1868,10 @@ declare module "assert" { operator: string; generatedMessage: boolean; - constructor(options?: {message?: string; actual?: any; expected?: any; - operator?: string; stackStartFunction?: Function}); + constructor(options?: { + message?: string; actual?: any; expected?: any; + operator?: string; stackStartFn?: Function + }); } export function fail(actual?: any, expected?: any, message?: string, operator?: string): never; @@ -1877,22 +1879,14 @@ declare module "assert" { export function equal(actual: any, expected: any, message?: string): void; export function notEqual(actual: any, expected: any, message?: string): void; export function deepEqual(actual: any, expected: any, message?: string): void; - export function notDeepEqual(acutal: any, expected: any, message?: string): void; + export function notDeepEqual(actual: any, expected: any, message?: string): void; export function strictEqual(actual: any, expected: any, message?: string): void; export function notStrictEqual(actual: any, expected: any, message?: string): void; - export var throws: { - (block: Function, message?: string): void; - (block: Function, error: Function, message?: string): void; - (block: Function, error: RegExp, message?: string): void; - (block: Function, error: (err: any) => boolean, message?: string): void; - }; - export var doesNotThrow: { - (block: Function, message?: string): void; - (block: Function, error: Function, message?: string): void; - (block: Function, error: RegExp, message?: string): void; - (block: Function, error: (err: any) => boolean, message?: string): void; - }; + export function throws(block: Function, message?: string): void; + export function throws(block: Function, error: RegExp | Function, message?: string): void; + export function doesNotThrow(block: Function, message?: string): void; + export function doesNotThrow(block: Function, error: RegExp | Function, message?: string): void; export function ifError(value: any): void; } diff --git a/types/node/v0/node-tests.ts b/types/node/v0/node-tests.ts index d8e0a406990f5b..37ef4f9e8130e6 100644 --- a/types/node/v0/node-tests.ts +++ b/types/node/v0/node-tests.ts @@ -179,37 +179,37 @@ function stream_readable_pipe_test() { var hmacResult: string = crypto.createHmac('md5', 'hello').update('world').digest('hex'); function crypto_cipher_decipher_string_test() { - var key:Buffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7]); - var clearText:string = "This is the clear text."; - var cipher:crypto.Cipher = crypto.createCipher("aes-128-ecb", key); - var cipherText:string = cipher.update(clearText, "utf8", "hex"); - cipherText += cipher.final("hex"); + var key:Buffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7]); + var clearText:string = "This is the clear text."; + var cipher:crypto.Cipher = crypto.createCipher("aes-128-ecb", key); + var cipherText:string = cipher.update(clearText, "utf8", "hex"); + cipherText += cipher.final("hex"); - var decipher:crypto.Decipher = crypto.createDecipher("aes-128-ecb", key); - var clearText2:string = decipher.update(cipherText, "hex", "utf8"); - clearText2 += decipher.final("utf8"); + var decipher:crypto.Decipher = crypto.createDecipher("aes-128-ecb", key); + var clearText2:string = decipher.update(cipherText, "hex", "utf8"); + clearText2 += decipher.final("utf8"); - assert.equal(clearText2, clearText); + assert.equal(clearText2, clearText); } function crypto_cipher_decipher_buffer_test() { - var key:Buffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7]); - var clearText:Buffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4]); - var cipher:crypto.Cipher = crypto.createCipher("aes-128-ecb", key); - var cipherBuffers:Buffer[] = []; - cipherBuffers.push(cipher.update(clearText)); - cipherBuffers.push(cipher.final()); + var key:Buffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7]); + var clearText:Buffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4]); + var cipher:crypto.Cipher = crypto.createCipher("aes-128-ecb", key); + var cipherBuffers:Buffer[] = []; + cipherBuffers.push(cipher.update(clearText)); + cipherBuffers.push(cipher.final()); - var cipherText:Buffer = Buffer.concat(cipherBuffers); + var cipherText:Buffer = Buffer.concat(cipherBuffers); - var decipher:crypto.Decipher = crypto.createDecipher("aes-128-ecb", key); - var decipherBuffers:Buffer[] = []; - decipherBuffers.push(decipher.update(cipherText)); - decipherBuffers.push(decipher.final()); + var decipher:crypto.Decipher = crypto.createDecipher("aes-128-ecb", key); + var decipherBuffers:Buffer[] = []; + decipherBuffers.push(decipher.update(cipherText)); + decipherBuffers.push(decipher.final()); - var clearText2:Buffer = Buffer.concat(decipherBuffers); + var clearText2:Buffer = Buffer.concat(decipherBuffers); - assert.deepEqual(clearText2, clearText); + assert.deepEqual(clearText2, clearText); } //////////////////////////////////////////////////// @@ -242,14 +242,14 @@ namespace http_tests { var codeMessage = http.STATUS_CODES['400']; var codeMessage = http.STATUS_CODES[400]; - var agent: http.Agent = new http.Agent({ - keepAlive: true, - keepAliveMsecs: 10000, - maxSockets: Infinity, - maxFreeSockets: 256 - }); + var agent: http.Agent = new http.Agent({ + keepAlive: true, + keepAliveMsecs: 10000, + maxSockets: Infinity, + maxFreeSockets: 256 + }); - var agent: http.Agent = http.globalAgent; + var agent: http.Agent = http.globalAgent; http.request('http://www.example.com/xyz'); } diff --git a/types/node/v4/index.d.ts b/types/node/v4/index.d.ts index bdce459efefc6a..a53098f6150d8c 100644 --- a/types/node/v4/index.d.ts +++ b/types/node/v4/index.d.ts @@ -2440,7 +2440,7 @@ declare module "util" { } declare module "assert" { - function internal (value: any, message?: string): void; + function internal(value: any, message?: string): void; namespace internal { export class AssertionError implements Error { name: string; @@ -2450,8 +2450,10 @@ declare module "assert" { operator: string; generatedMessage: boolean; - constructor(options?: {message?: string; actual?: any; expected?: any; - operator?: string; stackStartFunction?: Function}); + constructor(options?: { + message?: string; actual?: any; expected?: any; + operator?: string; stackStartFn?: Function + }); } export function fail(actual: any, expected: any, message?: string, operator?: string): never; @@ -2459,21 +2461,16 @@ declare module "assert" { export function equal(actual: any, expected: any, message?: string): void; export function notEqual(actual: any, expected: any, message?: string): void; export function deepEqual(actual: any, expected: any, message?: string): void; - export function notDeepEqual(acutal: any, expected: any, message?: string): void; + export function notDeepEqual(actual: any, expected: any, message?: string): void; export function strictEqual(actual: any, expected: any, message?: string): void; export function notStrictEqual(actual: any, expected: any, message?: string): void; export function deepStrictEqual(actual: any, expected: any, message?: string): void; export function notDeepStrictEqual(actual: any, expected: any, message?: string): void; export function throws(block: Function, message?: string): void; - export function throws(block: Function, error: Function, message?: string): void; - export function throws(block: Function, error: RegExp, message?: string): void; - export function throws(block: Function, error: (err: any) => boolean, message?: string): void; - + export function throws(block: Function, error: RegExp | Function, message?: string): void; export function doesNotThrow(block: Function, message?: string): void; - export function doesNotThrow(block: Function, error: Function, message?: string): void; - export function doesNotThrow(block: Function, error: RegExp, message?: string): void; - export function doesNotThrow(block: Function, error: (err: any) => boolean, message?: string): void; + export function doesNotThrow(block: Function, error: RegExp | Function, message?: string): void; export function ifError(value: any): void; } diff --git a/types/node/v6/index.d.ts b/types/node/v6/index.d.ts index de1b2802606d49..44083060ee43ce 100644 --- a/types/node/v6/index.d.ts +++ b/types/node/v6/index.d.ts @@ -3944,30 +3944,26 @@ declare module "assert" { constructor(options?: { message?: string; actual?: any; expected?: any; - operator?: string; stackStartFunction?: Function + operator?: string; stackStartFn?: Function }); } - export function fail(actual: any, expected: any, message?: string, operator?: string): never; + export function fail(message?: string): never; + export function fail(actual: any, expected: any, message?: string, operator?: string, stackStartFn?: Function): never; export function ok(value: any, message?: string): void; export function equal(actual: any, expected: any, message?: string): void; export function notEqual(actual: any, expected: any, message?: string): void; export function deepEqual(actual: any, expected: any, message?: string): void; - export function notDeepEqual(acutal: any, expected: any, message?: string): void; + export function notDeepEqual(actual: any, expected: any, message?: string): void; export function strictEqual(actual: any, expected: any, message?: string): void; export function notStrictEqual(actual: any, expected: any, message?: string): void; export function deepStrictEqual(actual: any, expected: any, message?: string): void; export function notDeepStrictEqual(actual: any, expected: any, message?: string): void; export function throws(block: Function, message?: string): void; - export function throws(block: Function, error: Function, message?: string): void; - export function throws(block: Function, error: RegExp, message?: string): void; - export function throws(block: Function, error: (err: any) => boolean, message?: string): void; - + export function throws(block: Function, error: RegExp | Function, message?: string): void; export function doesNotThrow(block: Function, message?: string): void; - export function doesNotThrow(block: Function, error: Function, message?: string): void; - export function doesNotThrow(block: Function, error: RegExp, message?: string): void; - export function doesNotThrow(block: Function, error: (err: any) => boolean, message?: string): void; + export function doesNotThrow(block: Function, error: RegExp | Function, message?: string): void; export function ifError(value: any): void; } diff --git a/types/node/v6/node-tests.ts b/types/node/v6/node-tests.ts index 43441e9840a7aa..5ca32d660ce367 100644 --- a/types/node/v6/node-tests.ts +++ b/types/node/v6/node-tests.ts @@ -786,13 +786,13 @@ namespace crypto_tests { let clearText: string = "This is the clear text."; let cipher: crypto.Cipher = crypto.createCipher("aes-128-ecb", key); let cipherText: string = cipher.update(clearText, "utf8", "hex"); - cipherText += cipher.final("hex"); + cipherText += cipher.final("hex"); let decipher: crypto.Decipher = crypto.createDecipher("aes-128-ecb", key); let clearText2: string = decipher.update(cipherText, "hex", "utf8"); - clearText2 += decipher.final("utf8"); + clearText2 += decipher.final("utf8"); - assert.equal(clearText2, clearText); + assert.equal(clearText2, clearText); } { @@ -801,19 +801,19 @@ namespace crypto_tests { let clearText: Buffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4]); let cipher: crypto.Cipher = crypto.createCipher("aes-128-ecb", key); let cipherBuffers: Buffer[] = []; - cipherBuffers.push(cipher.update(clearText)); - cipherBuffers.push(cipher.final()); + cipherBuffers.push(cipher.update(clearText)); + cipherBuffers.push(cipher.final()); let cipherText: Buffer = Buffer.concat(cipherBuffers); let decipher: crypto.Decipher = crypto.createDecipher("aes-128-ecb", key); let decipherBuffers: Buffer[] = []; - decipherBuffers.push(decipher.update(cipherText)); - decipherBuffers.push(decipher.final()); + decipherBuffers.push(decipher.update(cipherText)); + decipherBuffers.push(decipher.final()); let clearText2: Buffer = Buffer.concat(decipherBuffers); - assert.deepEqual(clearText2, clearText); + assert.deepEqual(clearText2, clearText); } { @@ -839,8 +839,8 @@ namespace tls_tests { var blah = ctx.context; var connOpts: tls.ConnectionOptions = { - host: "127.0.0.1", - port: 55 + host: "127.0.0.1", + port: 55 }; var tlsSocket = tls.connect(connOpts); } @@ -1043,14 +1043,14 @@ namespace http_tests { } { - var agent: http.Agent = new http.Agent({ - keepAlive: true, - keepAliveMsecs: 10000, - maxSockets: Infinity, - maxFreeSockets: 256 - }); + var agent: http.Agent = new http.Agent({ + keepAlive: true, + keepAliveMsecs: 10000, + maxSockets: Infinity, + maxFreeSockets: 256 + }); - var agent: http.Agent = http.globalAgent; + var agent: http.Agent = http.globalAgent; http.request({ agent: false }); http.request({ agent: agent }); diff --git a/types/node/v7/index.d.ts b/types/node/v7/index.d.ts index a40d713dcf01bf..da7c47d68e6907 100644 --- a/types/node/v7/index.d.ts +++ b/types/node/v7/index.d.ts @@ -3988,30 +3988,26 @@ declare module "assert" { constructor(options?: { message?: string; actual?: any; expected?: any; - operator?: string; stackStartFunction?: Function + operator?: string; stackStartFn?: Function }); } - export function fail(actual: any, expected: any, message?: string, operator?: string): never; + export function fail(message?: string): never; + export function fail(actual: any, expected: any, message?: string, operator?: string, stackStartFn?: Function): never; export function ok(value: any, message?: string): void; export function equal(actual: any, expected: any, message?: string): void; export function notEqual(actual: any, expected: any, message?: string): void; export function deepEqual(actual: any, expected: any, message?: string): void; - export function notDeepEqual(acutal: any, expected: any, message?: string): void; + export function notDeepEqual(actual: any, expected: any, message?: string): void; export function strictEqual(actual: any, expected: any, message?: string): void; export function notStrictEqual(actual: any, expected: any, message?: string): void; export function deepStrictEqual(actual: any, expected: any, message?: string): void; export function notDeepStrictEqual(actual: any, expected: any, message?: string): void; export function throws(block: Function, message?: string): void; - export function throws(block: Function, error: Function, message?: string): void; - export function throws(block: Function, error: RegExp, message?: string): void; - export function throws(block: Function, error: (err: any) => boolean, message?: string): void; - + export function throws(block: Function, error: RegExp | Function, message?: string): void; export function doesNotThrow(block: Function, message?: string): void; - export function doesNotThrow(block: Function, error: Function, message?: string): void; - export function doesNotThrow(block: Function, error: RegExp, message?: string): void; - export function doesNotThrow(block: Function, error: (err: any) => boolean, message?: string): void; + export function doesNotThrow(block: Function, error: RegExp | Function, message?: string): void; export function ifError(value: any): void; } diff --git a/types/node/v7/node-tests.ts b/types/node/v7/node-tests.ts index 4549ab7062b414..764dc6e8d01564 100644 --- a/types/node/v7/node-tests.ts +++ b/types/node/v7/node-tests.ts @@ -1025,14 +1025,14 @@ namespace http_tests { } { - var agent: http.Agent = new http.Agent({ - keepAlive: true, - keepAliveMsecs: 10000, - maxSockets: Infinity, - maxFreeSockets: 256 - }); + var agent: http.Agent = new http.Agent({ + keepAlive: true, + keepAliveMsecs: 10000, + maxSockets: Infinity, + maxFreeSockets: 256 + }); - var agent: http.Agent = http.globalAgent; + var agent: http.Agent = http.globalAgent; http.request({ agent: false }); http.request({ agent: agent }); @@ -1056,7 +1056,7 @@ namespace http_tests { request.abort(); } - // http request options + // http request options { const requestOpts: http.RequestOptions = { timeout: 30000 diff --git a/types/node/v8/index.d.ts b/types/node/v8/index.d.ts index 8e6c649d00d474..06283dd1ddc4e0 100644 --- a/types/node/v8/index.d.ts +++ b/types/node/v8/index.d.ts @@ -5634,34 +5634,30 @@ declare module "assert" { expected: any; operator: string; generatedMessage: boolean; + code: 'ERR_ASSERTION'; constructor(options?: { message?: string; actual?: any; expected?: any; - operator?: string; stackStartFunction?: Function + operator?: string; stackStartFn?: Function }); } - export function fail(message: string): never; - export function fail(actual: any, expected: any, message?: string, operator?: string): never; + export function fail(message?: string): never; + export function fail(actual: any, expected: any, message?: string, operator?: string, stackStartFn?: Function): never; export function ok(value: any, message?: string): void; export function equal(actual: any, expected: any, message?: string): void; export function notEqual(actual: any, expected: any, message?: string): void; export function deepEqual(actual: any, expected: any, message?: string): void; - export function notDeepEqual(acutal: any, expected: any, message?: string): void; + export function notDeepEqual(actual: any, expected: any, message?: string): void; export function strictEqual(actual: any, expected: any, message?: string): void; export function notStrictEqual(actual: any, expected: any, message?: string): void; export function deepStrictEqual(actual: any, expected: any, message?: string): void; export function notDeepStrictEqual(actual: any, expected: any, message?: string): void; export function throws(block: Function, message?: string): void; - export function throws(block: Function, error: Function, message?: string): void; - export function throws(block: Function, error: RegExp, message?: string): void; - export function throws(block: Function, error: (err: any) => boolean, message?: string): void; - + export function throws(block: Function, error: RegExp | Function, message?: string): void; export function doesNotThrow(block: Function, message?: string): void; - export function doesNotThrow(block: Function, error: Function, message?: string): void; - export function doesNotThrow(block: Function, error: RegExp, message?: string): void; - export function doesNotThrow(block: Function, error: (err: any) => boolean, message?: string): void; + export function doesNotThrow(block: Function, error: RegExp | Function, message?: string): void; export function ifError(value: any): void; } diff --git a/types/node/v9/index.d.ts b/types/node/v9/index.d.ts index 19259316b8a73b..aed5a0f9a03ea7 100644 --- a/types/node/v9/index.d.ts +++ b/types/node/v9/index.d.ts @@ -25,6 +25,7 @@ // Alexander T. // Lishude // Andrew Makarov +// Eugene Y. Q. Shen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** inspector module types */ @@ -5708,7 +5709,7 @@ declare module "util" { } declare module "assert" { - function internal(value: any, message?: string): void; + function internal(value: any, message?: string | Error): void; namespace internal { export class AssertionError implements Error { name: string; @@ -5717,34 +5718,30 @@ declare module "assert" { expected: any; operator: string; generatedMessage: boolean; + code: 'ERR_ASSERTION'; constructor(options?: { message?: string; actual?: any; expected?: any; - operator?: string; stackStartFunction?: Function + operator?: string; stackStartFn?: Function }); } - export function fail(message: string): never; - export function fail(actual: any, expected: any, message?: string, operator?: string): never; - export function ok(value: any, message?: string): void; - export function equal(actual: any, expected: any, message?: string): void; - export function notEqual(actual: any, expected: any, message?: string): void; - export function deepEqual(actual: any, expected: any, message?: string): void; - export function notDeepEqual(acutal: any, expected: any, message?: string): void; - export function strictEqual(actual: any, expected: any, message?: string): void; - export function notStrictEqual(actual: any, expected: any, message?: string): void; - export function deepStrictEqual(actual: any, expected: any, message?: string): void; - export function notDeepStrictEqual(actual: any, expected: any, message?: string): void; - - export function throws(block: Function, message?: string): void; - export function throws(block: Function, error: Function, message?: string): void; - export function throws(block: Function, error: RegExp, message?: string): void; - export function throws(block: Function, error: (err: any) => boolean, message?: string): void; - - export function doesNotThrow(block: Function, message?: string): void; - export function doesNotThrow(block: Function, error: Function, message?: string): void; - export function doesNotThrow(block: Function, error: RegExp, message?: string): void; - export function doesNotThrow(block: Function, error: (err: any) => boolean, message?: string): void; + export function fail(message?: string | Error): never; + export function fail(actual: any, expected: any, message?: string | Error, operator?: string, stackStartFn?: Function): never; + export function ok(value: any, message?: string | Error): void; + export function equal(actual: any, expected: any, message?: string | Error): void; + export function notEqual(actual: any, expected: any, message?: string | Error): void; + export function deepEqual(actual: any, expected: any, message?: string | Error): void; + export function notDeepEqual(actual: any, expected: any, message?: string | Error): void; + export function strictEqual(actual: any, expected: any, message?: string | Error): void; + export function notStrictEqual(actual: any, expected: any, message?: string | Error): void; + export function deepStrictEqual(actual: any, expected: any, message?: string | Error): void; + export function notDeepStrictEqual(actual: any, expected: any, message?: string | Error): void; + + export function throws(block: Function, message?: string | Error): void; + export function throws(block: Function, error: RegExp | Function, message?: string | Error): void; + export function doesNotThrow(block: Function, message?: string | Error): void; + export function doesNotThrow(block: Function, error: RegExp | Function, message?: string | Error): void; export function ifError(value: any): void; }