mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 23:10:29 +00:00
Add types for browserify/commonjs-assert (#29188)
* add types for browserify/commonjs-assert * fix tests and rename to 'assert' * fix some linting errors, checking in to avoid closing of pull request * fixed all lint errors
This commit is contained in:
committed by
Wesley Wigham
parent
e72bee2ba3
commit
7aa3334626
@@ -0,0 +1,10 @@
|
||||
import * as assert from 'assert';
|
||||
|
||||
assert(true, "it's working");
|
||||
|
||||
assert.ok(true, "inner functions work as well");
|
||||
|
||||
assert.throws(() => {});
|
||||
assert.throws(() => {}, () => {}, "works wonderfully");
|
||||
|
||||
assert['fail'](true, true, "works like a charm");
|
||||
Vendored
+45
@@ -0,0 +1,45 @@
|
||||
// Type definitions for commonjs-assert 1.4
|
||||
// Project: https://github.com/browserify/commonjs-assert
|
||||
// Definitions by: Nico Gallinal <https://github.com/nicoabie>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function assert(value: any, message?: string): void;
|
||||
|
||||
declare namespace assert {
|
||||
function fail(actual?: any, expected?: any, message?: string, operator?: string): void;
|
||||
|
||||
function ok(value: any, message?: string): void;
|
||||
|
||||
function equal(actual: any, expected: any, message?: string): void;
|
||||
|
||||
function notEqual(actual: any, expected: any, message?: string): void;
|
||||
|
||||
function deepEqual(actual: any, expected: any, message?: string): void;
|
||||
|
||||
function notDeepEqual(acutal: any, expected: any, message?: string): void;
|
||||
|
||||
function strictEqual(actual: any, expected: any, message?: string): void;
|
||||
|
||||
function notStrictEqual(actual: any, expected: any, message?: string): void;
|
||||
|
||||
function throws(block: () => void, message?: string): void;
|
||||
function throws(block: () => void, error: () => void | ((err: any) => boolean) | RegExp, message?: string): void;
|
||||
|
||||
function doesNotThrow(block: () => void, message?: string): void;
|
||||
function doesNotThrow(block: () => void, error: () => void | ((err: any) => boolean) | RegExp, message?: string): void;
|
||||
|
||||
function ifError(value: any): void;
|
||||
|
||||
class AssertionError implements Error {
|
||||
name: string;
|
||||
message: string;
|
||||
actual: any;
|
||||
expected: any;
|
||||
operator: string;
|
||||
generatedMessage: boolean;
|
||||
|
||||
constructor(options?: { message?: string; actual?: any; expected?: any; operator?: string; stackStartFunction?: () => void });
|
||||
}
|
||||
}
|
||||
|
||||
export = assert;
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"assert-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user