UNPKG

2.72 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/http-assert`
3
4# Summary
5This package contains type definitions for http-assert (https://github.com/jshttp/http-assert).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/http-assert.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/http-assert/index.d.ts)
10````ts
11// Type definitions for http-assert 1.5
12// Project: https://github.com/jshttp/http-assert
13// Definitions by: jKey Lu <https://github.com/jkeylu>
14// Peter Squicciarini <https://github.com/stripedpajamas>
15// Alex Bulanov <https://github.com/sapfear>
16// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
17// TypeScript Version: 2.3
18
19/**
20 * @param status the status code
21 * @param msg the message of the error, defaulting to node's text for that status code
22 * @param opts custom properties to attach to the error object
23 */
24declare function assert(value: any, status?: number, msg?: string, opts?: Record<string, any>): asserts value;
25declare function assert(value: any, status?: number, opts?: Record<string, any>): asserts value;
26
27declare namespace assert {
28 /**
29 * @param status the status code
30 * @param msg the message of the error, defaulting to node's text for that status code
31 * @param opts custom properties to attach to the error object
32 */
33 type Assert = <T>(a: T, b: T, status?: number, msg?: string, opts?: Record<string, any>) => void;
34
35 /**
36 * @param status the status code
37 * @param msg the message of the error, defaulting to node's text for that status code
38 * @param opts custom properties to attach to the error object
39 */
40 type AssertOK = (a: any, status?: number, msg?: string, opts?: Record<string, any>) => asserts a;
41
42 /**
43 * @param status the status code
44 * @param msg the message of the error, defaulting to node's text for that status code
45 * @param opts custom properties to attach to the error object
46 */
47 type AssertEqual = (a: any, b: any, status?: number, msg?: string, opts?: Record<string, any>) => void;
48
49 const equal: Assert;
50 const notEqual: Assert;
51 const ok: AssertOK;
52 const strictEqual: AssertEqual;
53 const notStrictEqual: AssertEqual;
54 const deepEqual: AssertEqual;
55 const notDeepEqual: AssertEqual;
56}
57
58export = assert;
59
60````
61
62### Additional Details
63 * Last updated: Thu, 26 Aug 2021 01:01:28 GMT
64 * Dependencies: none
65 * Global values: none
66
67# Credits
68These definitions were written by [jKey Lu](https://github.com/jkeylu), [Peter Squicciarini](https://github.com/stripedpajamas), and [Alex Bulanov](https://github.com/sapfear).
69
\No newline at end of file