power-assert: update assert function (#40731)

* power-assert: format

* power-assert: update assert function

* power-assert: update definitions
This commit is contained in:
falsandtru
2019-12-08 07:28:02 +09:00
committed by Ron Buckton
parent da9b4a8b88
commit 017bb09970
6 changed files with 182 additions and 44 deletions

View File

@@ -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 <https://github.com/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;
}

View File

@@ -0,0 +1,11 @@
{
"private": true,
"types": "index",
"typesVersions": {
">=3.7.0-0": {
"*": [
"ts3.7/*"
]
}
}
}

36
types/power-assert/ts3.7/index.d.ts vendored Normal file
View File

@@ -0,0 +1,36 @@
// Type definitions for power-assert 1.5.1
// Project: https://github.com/twada/power-assert
// Definitions by: vvakame <https://github.com/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;
}

View File

@@ -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"
]
}

View File

@@ -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
}
}

View File

@@ -20,4 +20,4 @@
"index.d.ts",
"power-assert-tests.ts"
]
}
}