From 017bb099708ad1b04ee2c0faed2209e0852ca79b Mon Sep 17 00:00:00 2001 From: falsandtru Date: Sun, 8 Dec 2019 07:28:02 +0900 Subject: [PATCH] power-assert: update assert function (#40731) * power-assert: format * power-assert: update assert function * power-assert: update definitions --- types/power-assert/index.d.ts | 74 ++++++++++-------------- types/power-assert/package.json | 11 ++++ types/power-assert/ts3.7/index.d.ts | 36 ++++++++++++ types/power-assert/ts3.7/tsconfig.json | 23 ++++++++ types/power-assert/ts3.7/tslint.json | 80 ++++++++++++++++++++++++++ types/power-assert/tsconfig.json | 2 +- 6 files changed, 182 insertions(+), 44 deletions(-) create mode 100644 types/power-assert/package.json create mode 100644 types/power-assert/ts3.7/index.d.ts create mode 100644 types/power-assert/ts3.7/tsconfig.json create mode 100644 types/power-assert/ts3.7/tslint.json diff --git a/types/power-assert/index.d.ts b/types/power-assert/index.d.ts index ab066b28bc..652519945b 100644 --- a/types/power-assert/index.d.ts +++ b/types/power-assert/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for power-assert 1.5.0 +// Type definitions for power-assert 1.5.1 // Project: https://github.com/twada/power-assert // Definitions by: vvakame // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -13,54 +13,42 @@ import * as empower from "empower"; export = assert; export as namespace assert; -declare function assert(value:any, message?:string):void; +declare function assert(value: any, message?: string): void; declare namespace assert { export class AssertionError implements Error { - name:string; - message:string; - actual:any; - expected:any; - operator:string; - generatedMessage:boolean; + name: string; + message: string; + actual: any; + expected: any; + 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; stackStartFunction?: Function }); } - export function fail(actual?:any, expected?:any, message?:string, operator?:string):void; - - 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 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 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 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 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 ifError(value:any):void; + export function ifError(value: any): void; export const strict: typeof assert; @@ -69,5 +57,5 @@ declare namespace assert { output?: powerAssertFormatter.Options; } - export function customize(options:Options):typeof assert; + export function customize(options: Options): typeof assert; } diff --git a/types/power-assert/package.json b/types/power-assert/package.json new file mode 100644 index 0000000000..4060baedd2 --- /dev/null +++ b/types/power-assert/package.json @@ -0,0 +1,11 @@ +{ + "private": true, + "types": "index", + "typesVersions": { + ">=3.7.0-0": { + "*": [ + "ts3.7/*" + ] + } + } +} \ No newline at end of file diff --git a/types/power-assert/ts3.7/index.d.ts b/types/power-assert/ts3.7/index.d.ts new file mode 100644 index 0000000000..224d023b4b --- /dev/null +++ b/types/power-assert/ts3.7/index.d.ts @@ -0,0 +1,36 @@ +// Type definitions for power-assert 1.5.1 +// Project: https://github.com/twada/power-assert +// Definitions by: vvakame +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// copy from assert external module in node.d.ts + +import * as module from "../index"; + +export = assert; +export as namespace assert; + +declare function assert(value: any, message?: string): asserts value; +declare namespace assert { + export import AssertionError = module.AssertionError; + + export import fail = module.fail; + export function ok(value: any, message?: string): asserts value; + export import equal = module.equal; + export import notEqual = module.notEqual; + export import deepEqual = module.deepEqual; + export import notDeepEqual = module.notDeepEqual; + export import strictEqual = module.strictEqual; + export import notStrictEqual = module.notStrictEqual; + export import deepStrictEqual = module.deepStrictEqual; + export import notDeepStrictEqual = module.notDeepStrictEqual; + export import throws = module.throws; + export import doesNotThrow = module.doesNotThrow; + export import ifError = module.ifError; + + export import strict = assert; + + export import Options = module.Options; + + export import customize = module.customize; +} diff --git a/types/power-assert/ts3.7/tsconfig.json b/types/power-assert/ts3.7/tsconfig.json new file mode 100644 index 0000000000..26ac51fe84 --- /dev/null +++ b/types/power-assert/ts3.7/tsconfig.json @@ -0,0 +1,23 @@ +{ + "extends": "../tsconfig", + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts" + ] +} diff --git a/types/power-assert/ts3.7/tslint.json b/types/power-assert/ts3.7/tslint.json new file mode 100644 index 0000000000..3d59f55fda --- /dev/null +++ b/types/power-assert/ts3.7/tslint.json @@ -0,0 +1,80 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "npm-naming": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, + "no-unnecessary-generics": false, + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false + } +} diff --git a/types/power-assert/tsconfig.json b/types/power-assert/tsconfig.json index 9093028de3..6107f86e53 100644 --- a/types/power-assert/tsconfig.json +++ b/types/power-assert/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "power-assert-tests.ts" ] -} \ No newline at end of file +}