mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-03 11:41:44 +00:00
Type definitions for http-assert (#13801)
* Type definitions for http-assert * update http-assert
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import * as httpAssert from 'http-assert';
|
||||
import { HttpError } from 'http-errors';
|
||||
|
||||
try {
|
||||
httpAssert.equal('hello', 'hello');
|
||||
httpAssert(false, 401, 'authentication failed');
|
||||
} catch(err) {
|
||||
console.log((<HttpError>err).status);
|
||||
console.log((<HttpError>err).message);
|
||||
console.log((<HttpError>err).expose);
|
||||
}
|
||||
Vendored
+52
@@ -0,0 +1,52 @@
|
||||
// Type definitions for http-assert 1.2
|
||||
// Project: https://github.com/jshttp/http-assert
|
||||
// Definitions by: jKey Lu <https://github.com/jkeylu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* @param {number} [status] the status code
|
||||
* @param {string} [msg] the message of the error, defaulting to node's text for that status code
|
||||
* @param {object} [opts] custom properties to attach to the error object
|
||||
*/
|
||||
declare function assert(value: any, status?: number, msg?: string, opts?: {}): void;
|
||||
|
||||
declare namespace assert {
|
||||
/**
|
||||
* @param {number} [status] the status code
|
||||
* @param {string} [msg] the message of the error, defaulting to node's text for that status code
|
||||
* @param {object} [opts] custom properties to attach to the error object
|
||||
*/
|
||||
function equal<T>(a: T, b: T, status?: number, msg?: string, opts?: {}): void;
|
||||
/**
|
||||
* @param {number} [status] the status code
|
||||
* @param {string} [msg] the message of the error, defaulting to node's text for that status code
|
||||
* @param {object} [opts] custom properties to attach to the error object
|
||||
*/
|
||||
function notEqual<T>(a: T, b: T, status?: number, msg?: string, opts?: {}): void;
|
||||
/**
|
||||
* @param {number} [status] the status code
|
||||
* @param {string} [msg] the message of the error, defaulting to node's text for that status code
|
||||
* @param {object} [opts] custom properties to attach to the error object
|
||||
*/
|
||||
function strictEqual<T>(a: T, b: T, status?: number, msg?: string, opts?: {}): void;
|
||||
/**
|
||||
* @param {number} [status] the status code
|
||||
* @param {string} [msg] the message of the error, defaulting to node's text for that status code
|
||||
* @param {object} [opts] custom properties to attach to the error object
|
||||
*/
|
||||
function notStrictEqual<T>(a: T, b: T, status?: number, msg?: string, opts?: {}): void;
|
||||
/**
|
||||
* @param {number} [status] the status code
|
||||
* @param {string} [msg] the message of the error, defaulting to node's text for that status code
|
||||
* @param {object} [opts] custom properties to attach to the error object
|
||||
*/
|
||||
function deepEqual<T>(a: T, b: T, status?: number, msg?: string, opts?: {}): void;
|
||||
/**
|
||||
* @param {number} [status] the status code
|
||||
* @param {string} [msg] the message of the error, defaulting to node's text for that status code
|
||||
* @param {object} [opts] custom properties to attach to the error object
|
||||
*/
|
||||
function notDeepEqual<T>(a: T, b: T, status?: number, msg?: string, opts?: {}): void;
|
||||
}
|
||||
|
||||
export = assert;
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"http-assert-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Reference in New Issue
Block a user