mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Added type def for proclaim (#35041)
This commit is contained in:
parent
cecf36fdde
commit
2ed977bc7e
270
types/proclaim/index.d.ts
vendored
Normal file
270
types/proclaim/index.d.ts
vendored
Normal file
@ -0,0 +1,270 @@
|
||||
// Type definitions for proclaim 3.6
|
||||
// Project: https://github.com/rowanmanning/proclaim
|
||||
// Definitions by: Adam Zerella <https://github.com/adamzerella>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
export {};
|
||||
|
||||
interface AssertionError {
|
||||
msg: string;
|
||||
actual: any;
|
||||
expected: any;
|
||||
operator: string;
|
||||
stackStartFunction: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Throw an assertion error.
|
||||
*/
|
||||
export function fail(actual: any, expected: any, msg: string, operator: string): AssertionError;
|
||||
|
||||
/**
|
||||
* Assert that value is truthy.
|
||||
*/
|
||||
export function ok(value: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that value is falsy.
|
||||
*/
|
||||
export function notOk(value: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that actual == expected.
|
||||
*/
|
||||
export function equal(actual: any, expected: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that actual != expected.
|
||||
*/
|
||||
export function notEqual(actual: any, expected: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that actual === expected.
|
||||
*/
|
||||
export function strictEqual(actual: any, expected: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that actual !== expected.
|
||||
*/
|
||||
export function notStrictEqual(actual: any, expected: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that actual is deeply equal to expected.
|
||||
*/
|
||||
export function deepEqual(actual: any, expected: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that actual is not deeply equal to expected.
|
||||
*/
|
||||
export function notDeepEqual(actual: any, expected: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that actual is deeply equal to expected, as determined by the strict equality operator ===.
|
||||
*/
|
||||
export function deepStrictEqual(actual: any, expected: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that actual is not deeply equal to expected, as determined by the strict not equal operator !==.
|
||||
*/
|
||||
export function notDeepStrictEqual(actual: any, expected: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that fn throws an error.
|
||||
*/
|
||||
export function throws(fn: () => void, expected: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that fn does not throw an error.
|
||||
*/
|
||||
export function doesNotThrow(fn: () => void, expected: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that typeof actual === expected.
|
||||
*/
|
||||
export function isTypeOf(actual: any, expected: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that typeof actual !== expected.
|
||||
*/
|
||||
export function isNotTypeOf(actual: any, expected: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that actual instanceof expected.
|
||||
*/
|
||||
export function isInstanceOf(actual: any, expected: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that !(actual instanceof expected).
|
||||
*/
|
||||
export function isNotInstanceOf(actual: any, expected: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that value is an array.
|
||||
*/
|
||||
export function isArray(value: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that value is not an array.
|
||||
*/
|
||||
export function isNotArray(value: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that value is a boolean.
|
||||
*/
|
||||
export function isBoolean(value: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that value is not a boolean.
|
||||
*/
|
||||
export function isNotBoolean(value: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that value === true.
|
||||
*/
|
||||
export function isTrue(value: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that value === false.
|
||||
*/
|
||||
export function isFalse(value: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that value is a function.
|
||||
*/
|
||||
export function isFunction(value: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that value is not a function.
|
||||
*/
|
||||
export function isNotFunction(value: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that value is NaN.
|
||||
*/
|
||||
export function isNaN(value: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that value is not NaN.
|
||||
*/
|
||||
export function isNotNaN(value: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that value === null.
|
||||
*/
|
||||
export function isNull(value: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that value !== null.
|
||||
*/
|
||||
export function isNotNull(value: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that value is a number.
|
||||
*/
|
||||
export function isNumber(value: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that value is not a number.
|
||||
*/
|
||||
export function isNotNumber(value: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that value is an object.
|
||||
*/
|
||||
export function isObject(value: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that value is not an object.
|
||||
*/
|
||||
export function isNotObject(value: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that value is a string.
|
||||
*/
|
||||
export function isString(value: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that value is not a string.
|
||||
*/
|
||||
export function isNotString(value: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that value === undefined.
|
||||
*/
|
||||
export function isUndefined(value: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that value !== undefined.
|
||||
*/
|
||||
export function isDefined(value: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that actual matches the RegExp in expected.
|
||||
*/
|
||||
export function match(actual: any, expected: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that actual does not match the RegExp in expected.
|
||||
*/
|
||||
export function notMatch(actual: any, expected: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that haystack contains needle.
|
||||
*/
|
||||
export function include(haystack: any, needle: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that haystack does not contain needle.
|
||||
*/
|
||||
export function doesNotInclude(haystack: any, needle: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that value.length === expected.
|
||||
*/
|
||||
export function lengthEquals(actual: any, expected: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that actual < expected.
|
||||
*/
|
||||
export function lessThan(actual: any, expected: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that actual <= expected.
|
||||
*/
|
||||
export function lessThanOrEqual(actual: any, expected: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that actual > expected.
|
||||
*/
|
||||
export function greaterThan(actual: any, expected: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that actual >= expected.
|
||||
*/
|
||||
export function greaterThanOrEqual(actual: any, expected: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that fn.length === expected.
|
||||
*/
|
||||
export function arity(fn: () => void, expected: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that Math.abs(actual - expected) < (0.5 * Math.pow(10, -precision)).
|
||||
*/
|
||||
export function almostEqual(actual: any, expected: any, precision: number, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that obj[property] is not enumerable.
|
||||
*/
|
||||
export function isNotEnumerable(object: object, property: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that obj[property] is enumerable.
|
||||
*/
|
||||
export function isEnumerable(object: object, property: any, msg: string): AssertionError|void;
|
||||
|
||||
/**
|
||||
* Assert that fn.name === expected.
|
||||
*/
|
||||
export function hasName(fn: () => void, expected: any, msg: string): AssertionError|void;
|
||||
54
types/proclaim/proclaim-tests.ts
Normal file
54
types/proclaim/proclaim-tests.ts
Normal file
@ -0,0 +1,54 @@
|
||||
import proclaim = require('proclaim');
|
||||
|
||||
proclaim.fail('foo', 'bar', 'Foo equals bar', '===');
|
||||
proclaim.ok(5, '5 equals true');
|
||||
proclaim.notOk(5, '5 equals false');
|
||||
proclaim.equal('abc', 'bca', 'Foo equals bar');
|
||||
proclaim.notEqual('abc', 'bca', 'Foo equals bar');
|
||||
proclaim.strictEqual('abc', 'bca', 'Foo equals bar');
|
||||
proclaim.notStrictEqual('abc', 'bca', 'Foo equals bar');
|
||||
proclaim.deepEqual('abc', 'bca', 'Foo equals bar');
|
||||
proclaim.notDeepEqual('abc', 'bca', 'Foo equals bar');
|
||||
proclaim.deepStrictEqual('abc', 'bca', 'Foo equals bar');
|
||||
proclaim.notDeepStrictEqual('abc', 'bca', 'Foo equals bar');
|
||||
proclaim.throws(() => {}, {}, 'throws error');
|
||||
proclaim.doesNotThrow(() => {}, {}, 'throws error');
|
||||
proclaim.isTypeOf('same type', 'same type', 'values match');
|
||||
proclaim.isNotTypeOf('same type', 'same type', 'values dont match');
|
||||
proclaim.isInstanceOf('same instance', 'same instance', 'instance match');
|
||||
proclaim.isNotInstanceOf('same instance', 'same instance', 'instance dont match');
|
||||
proclaim.isArray([], 'is array');
|
||||
proclaim.isNotArray([], 'is array');
|
||||
proclaim.isBoolean(true, 'is bool');
|
||||
proclaim.isNotBoolean(true, 'is bool');
|
||||
proclaim.isTrue(true, 'is true');
|
||||
proclaim.isFalse(false, 'is true');
|
||||
proclaim.isFunction('value here', 'value was a thing');
|
||||
proclaim.isNotFunction('value here', 'value was a thing');
|
||||
proclaim.isNaN('value here', 'value was a thing');
|
||||
proclaim.isNotNaN('value here', 'value was a thing');
|
||||
proclaim.isNull('value here', 'value was a thing');
|
||||
proclaim.isNotNull('value here', 'value was a thing');
|
||||
proclaim.isNumber('value here', 'value was a thing');
|
||||
proclaim.isNotNumber('value here', 'value was a thing');
|
||||
proclaim.isObject('value here', 'value was a thing');
|
||||
proclaim.isNotNull('value here', 'value was a thing');
|
||||
proclaim.isNotObject('value here', 'value was a thing');
|
||||
proclaim.isString('value here', 'value was a thing');
|
||||
proclaim.isNotString('value here', 'value was a thing');
|
||||
proclaim.isUndefined('value here', 'value was a thing');
|
||||
proclaim.isDefined('value here', 'value was a thing');
|
||||
proclaim.match('a', 'a', 'match');
|
||||
proclaim.notMatch('a', 'b', 'no match');
|
||||
proclaim.include([1, 2, 3], 5, 'no match');
|
||||
proclaim.doesNotInclude([1, 2, 3], 5, 'no match');
|
||||
proclaim.lengthEquals([1, 2, 3], 3, 'length equals');
|
||||
proclaim.lessThan(5, 10, 'true');
|
||||
proclaim.lessThanOrEqual(5, 10, 'true');
|
||||
proclaim.greaterThan(5, 10, 'false');
|
||||
proclaim.greaterThanOrEqual(5, 10, 'false');
|
||||
proclaim.arity(() => {}, {}, 'no fn length');
|
||||
proclaim.almostEqual(5, 10, 3, 'not almost equal');
|
||||
proclaim.isNotEnumerable({}, {}, 'true');
|
||||
proclaim.isEnumerable({}, {}, 'true');
|
||||
proclaim.hasName(() => {}, 'name here', 'false');
|
||||
23
types/proclaim/tsconfig.json
Normal file
23
types/proclaim/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"proclaim-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/proclaim/tslint.json
Normal file
1
types/proclaim/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user