forked from tsdjs/tsd
/
assert.ts
80 lines (73 loc) · 2.48 KB
/
assert.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/**
* Check that the type of `value` is identical to type `T`.
*
* @param value - Value that should be identical to type `T`.
*/
// @ts-ignore
export const expectType = <T>(value: T) => { // tslint:disable-line:no-unused
// Do nothing, the TypeScript compiler handles this for us
};
/**
* Check that the type of `value` is not identical to type `T`.
*
* @param value - Value that should be identical to type `T`.
*/
// @ts-ignore
export const expectNotType = <T>(value: any) => { // tslint:disable-line:no-unused
// TODO Use a `not T` type when possible https://github.com/microsoft/TypeScript/pull/29317
// Do nothing, the TypeScript compiler handles this for us
};
/**
* Check that the type of `value` is assignable to type `T`.
*
* @param value - Value that should be assignable to type `T`.
*/
// @ts-ignore
export const expectAssignable = <T>(value: T) => { // tslint:disable-line:no-unused
// Do nothing, the TypeScript compiler handles this for us
};
/**
* Check that the type of `value` is not assignable to type `T`.
*
* @param value - Value that should not be assignable to type `T`.
*/
// @ts-ignore
export const expectNotAssignable = <T>(value: any) => { // tslint:disable-line:no-unused
// Do nothing, the TypeScript compiler handles this for us
};
/**
* Assert the value to throw an argument error.
*
* @param value - Value that should be checked.
*/
// @ts-ignore
export const expectError = <T = any>(value: T) => { // tslint:disable-line:no-unused
// Do nothing, the TypeScript compiler handles this for us
};
/**
* Assert that the `expression` provided is marked as `@deprecated`.
*
* @param expression - Expression that should be marked as `@deprecated`.
*/
// @ts-ignore
export const expectDeprecated = (expression: any) => { // tslint:disable-line:no-unused
// Do nothing, the TypeScript compiler handles this for us
};
/**
* Assert that the `expression` provided is not marked as `@deprecated`.
*
* @param expression - Expression that should not be marked as `@deprecated`.
*/
// @ts-ignore
export const expectNotDeprecated = (expression: any) => { // tslint:disable-line:no-unused
// Do nothing, the TypeScript compiler handles this for us
};
/**
* Will print a warning with the type of the expression passed as argument.
*
* @param expression - Expression whose type should be printed as a warning.
*/
// @ts-ignore
export const printType = (expression: any) => { // tslint:disable-line:no-unused
// Do nothing, the TypeScript compiler handles this for us
};