@deessejs/type-testing 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/README.md +40 -0
  3. package/dist/api/assert.d.ts +43 -0
  4. package/dist/api/assert.d.ts.map +1 -0
  5. package/dist/api/assert.js +7 -0
  6. package/dist/api/assert.js.map +1 -0
  7. package/dist/api/check.d.ts +138 -0
  8. package/dist/api/check.d.ts.map +1 -0
  9. package/dist/api/check.js +17 -0
  10. package/dist/api/check.js.map +1 -0
  11. package/dist/api/expect.d.ts +35 -0
  12. package/dist/api/expect.d.ts.map +1 -0
  13. package/dist/api/expect.js +21 -0
  14. package/dist/api/expect.js.map +1 -0
  15. package/dist/api/index.d.ts +7 -0
  16. package/dist/api/index.d.ts.map +1 -0
  17. package/dist/api/index.js +7 -0
  18. package/dist/api/index.js.map +1 -0
  19. package/dist/index.d.ts +10 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +14 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/runtime/comparison.d.ts +122 -0
  24. package/dist/runtime/comparison.d.ts.map +1 -0
  25. package/dist/runtime/comparison.js +180 -0
  26. package/dist/runtime/comparison.js.map +1 -0
  27. package/dist/runtime/index.d.ts +5 -0
  28. package/dist/runtime/index.d.ts.map +1 -0
  29. package/dist/runtime/index.js +5 -0
  30. package/dist/runtime/index.js.map +1 -0
  31. package/dist/types/equality.d.ts +30 -0
  32. package/dist/types/equality.d.ts.map +1 -0
  33. package/dist/types/equality.js +5 -0
  34. package/dist/types/equality.js.map +1 -0
  35. package/dist/types/function.d.ts +16 -0
  36. package/dist/types/function.d.ts.map +1 -0
  37. package/dist/types/function.js +5 -0
  38. package/dist/types/function.js.map +1 -0
  39. package/dist/types/index.d.ts +11 -0
  40. package/dist/types/index.d.ts.map +1 -0
  41. package/dist/types/index.js +12 -0
  42. package/dist/types/index.js.map +1 -0
  43. package/dist/types/inhabitation.d.ts +24 -0
  44. package/dist/types/inhabitation.d.ts.map +1 -0
  45. package/dist/types/inhabitation.js +5 -0
  46. package/dist/types/inhabitation.js.map +1 -0
  47. package/dist/types/length.d.ts +8 -0
  48. package/dist/types/length.d.ts.map +1 -0
  49. package/dist/types/length.js +5 -0
  50. package/dist/types/length.js.map +1 -0
  51. package/dist/types/property.d.ts +12 -0
  52. package/dist/types/property.d.ts.map +1 -0
  53. package/dist/types/property.js +5 -0
  54. package/dist/types/property.js.map +1 -0
  55. package/dist/types/special.d.ts +55 -0
  56. package/dist/types/special.d.ts.map +1 -0
  57. package/dist/types/special.js +5 -0
  58. package/dist/types/special.js.map +1 -0
  59. package/dist/types/union.d.ts +34 -0
  60. package/dist/types/union.d.ts.map +1 -0
  61. package/dist/types/union.js +5 -0
  62. package/dist/types/union.js.map +1 -0
  63. package/dist/utils.d.ts +14 -0
  64. package/dist/utils.d.ts.map +1 -0
  65. package/dist/utils.js +5 -0
  66. package/dist/utils.js.map +1 -0
  67. package/package.json +2 -1
package/CHANGELOG.md CHANGED
@@ -1,10 +1,16 @@
1
1
  # @deessejs/type-testing
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add runtime type checking utilities with boolean type guards
8
+
3
9
  ## 0.1.2
4
10
 
5
11
  ### Patch Changes
6
12
 
7
- - Fix ESM exports by adding explicit .js extensions to imports and exports
13
+ - Fix .npmignore to include dist folder in published package
8
14
 
9
15
  ## 0.1.1
10
16
 
package/README.md CHANGED
@@ -164,6 +164,46 @@ Length<['a', 'b', 'c']> // 3
164
164
  Length<[]> // 0
165
165
  ```
166
166
 
167
+ ## Runtime Type Checking
168
+
169
+ The library also provides runtime type checking utilities:
170
+
171
+ ```typescript
172
+ import {
173
+ // Type check functions returning TypeCheckResult objects
174
+ isString,
175
+ isNumber,
176
+ isBoolean,
177
+ isObject,
178
+ isArray,
179
+ isNull,
180
+ isUndefined,
181
+
182
+ // Boolean type guards (for use in conditionals)
183
+ isStringGuard,
184
+ isNumberGuard,
185
+ isBooleanGuard,
186
+ isObjectGuard,
187
+ isArrayGuard,
188
+ isNullGuard,
189
+ isUndefinedGuard,
190
+ isSymbolGuard,
191
+ isBigIntGuard,
192
+ isFunctionGuard
193
+ } from '@deessejs/type-testing'
194
+
195
+ // TypeCheckResult objects
196
+ const stringResult = isString('hello')
197
+ stringResult.matches // true
198
+ stringResult.value // 'hello'
199
+ stringResult.typeName // 'string'
200
+
201
+ // Boolean type guards
202
+ if (isStringGuard(value)) {
203
+ // value is narrowed to string here
204
+ }
205
+ ```
206
+
167
207
  ## Chainable API
168
208
 
169
209
  ### check() - Soft type checking
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Assert API - Alternative API that throws at compile time on failure.
3
+ */
4
+ import type { Equal, NotEqual } from '../types/equality.js';
5
+ import type { IsAny, IsNever, IsUnknown, IsVoid, IsUndefined, IsNull, IsNullable, IsOptional } from '../types/special.js';
6
+ import type { IsUnion, IsTuple, IsArray } from '../types/union.js';
7
+ import type { IsInhabited, IsUninhabited } from '../types/inhabitation.js';
8
+ import type { HasProperty } from '../types/property.js';
9
+ import type { Check } from './check.js';
10
+ /**
11
+ * Assert type - alternative API that throws at compile time on failure.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * assert<string>().equals<string>()
16
+ * ```
17
+ */
18
+ export interface Assert<T> {
19
+ equals<U>(): Equal<T, U> extends true ? AssertPass : AssertFail<T, U>;
20
+ notEquals<U>(): NotEqual<T, U> extends true ? AssertPass : AssertFail<T, U>;
21
+ extends<U>(): T extends U ? AssertPass : AssertFail<T, U>;
22
+ hasProperty<K extends keyof T>(): HasProperty<T, K> extends true ? AssertPass : AssertFail<T, {
23
+ missingProperty: K;
24
+ }>;
25
+ property<K extends keyof T>(): Check<T[K]>;
26
+ isAny(): IsAny<T> extends true ? AssertPass : AssertFail<T, 'any'>;
27
+ isNever(): IsNever<T> extends true ? AssertPass : AssertFail<T, 'never'>;
28
+ isUnknown(): IsUnknown<T> extends true ? AssertPass : AssertFail<T, 'unknown'>;
29
+ isVoid(): IsVoid<T> extends true ? AssertPass : AssertFail<T, 'void'>;
30
+ isUndefined(): IsUndefined<T> extends true ? AssertPass : AssertFail<T, 'undefined'>;
31
+ isNull(): IsNull<T> extends true ? AssertPass : AssertFail<T, 'null'>;
32
+ isNullable(): IsNullable<T> extends true ? AssertPass : AssertFail<T, 'not nullable'>;
33
+ isOptional(): IsOptional<T> extends true ? AssertPass : AssertFail<T, 'not optional'>;
34
+ isUnion(): IsUnion<T> extends true ? AssertPass : AssertFail<T, 'not a union'>;
35
+ isTuple(): IsTuple<T> extends true ? AssertPass : AssertFail<T, 'not a tuple'>;
36
+ isArray(): IsArray<T> extends true ? AssertPass : AssertFail<T, 'not an array'>;
37
+ isInhabited(): IsInhabited<T> extends true ? AssertPass : AssertFail<T, 'uninhabited'>;
38
+ isUninhabited(): IsUninhabited<T> extends true ? AssertPass : AssertFail<T, 'inhabited'>;
39
+ }
40
+ export type AssertPass = true;
41
+ export type AssertFail<_T, _Expected> = never;
42
+ export declare function assert<T>(): Assert<T>;
43
+ //# sourceMappingURL=assert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/api/assert.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACzH,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sB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AErC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Assert API - Alternative API that throws at compile time on failure.
3
+ */
4
+ export function assert() {
5
+ return undefined;
6
+ }
7
+ //# sourceMappingURL=assert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert.js","sourceRoot":"","sources":["../../src/api/assert.ts"],"names":[],"mappings":"AAAA;;GAEG;AA0CH,MAAM,UAAU,MAAM;IACpB,OAAO,SAAgB,CAAA;AACzB,CAAC"}
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Check API - Chainable type checker.
3
+ */
4
+ import type { Equal, NotEqual } from '../types/equality.js';
5
+ import type { IsAny, IsNever, IsUnknown, IsVoid, IsUndefined, IsNull, IsNullable, IsOptional } from '../types/special.js';
6
+ import type { IsUnion, IsTuple, IsArray } from '../types/union.js';
7
+ import type { IsInhabited, IsUninhabited } from '../types/inhabitation.js';
8
+ import type { HasProperty } from '../types/property.js';
9
+ import type { Parameters, ReturnType, Parameter } from '../types/function.js';
10
+ import type { Length } from '../types/length.js';
11
+ /**
12
+ * Type representing a passing check.
13
+ */
14
+ export type CheckPass = true;
15
+ /**
16
+ * Type representing a failing check.
17
+ */
18
+ export type CheckFail<_T, _Expected> = never;
19
+ /**
20
+ * Helper to create a Check type.
21
+ */
22
+ export type CheckBuilder<T> = Check<T>;
23
+ /**
24
+ * Chainable type checker for testing TypeScript types.
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * check<string>().equals<string>()
29
+ * check<{ a: string }>().hasProperty('a')
30
+ * ```
31
+ */
32
+ export interface Check<T> {
33
+ /**
34
+ * Tests if this type equals another type.
35
+ */
36
+ equals<U>(): Equal<T, U> extends true ? CheckPass : CheckFail<T, U>;
37
+ /**
38
+ * Tests if this type does not equal another type.
39
+ */
40
+ notEquals<U>(): NotEqual<T, U> extends true ? CheckPass : CheckFail<T, U>;
41
+ /**
42
+ * Tests if this type extends another type (is assignable to).
43
+ */
44
+ extends<U>(): T extends U ? CheckPass : CheckFail<T, U>;
45
+ /**
46
+ * Tests if this type is assignable from another type.
47
+ */
48
+ assignableTo<U>(): U extends T ? CheckPass : CheckFail<T, U>;
49
+ /**
50
+ * Tests if this type has a specific property.
51
+ */
52
+ hasProperty<K extends keyof T>(): HasProperty<T, K> extends true ? CheckPass : CheckFail<T, {
53
+ missingProperty: K;
54
+ }>;
55
+ /**
56
+ * Gets the type of a specific property for further testing.
57
+ */
58
+ property<K extends keyof T>(): Check<T[K]>;
59
+ /**
60
+ * Tests if this type is `any`.
61
+ */
62
+ isAny(): IsAny<T> extends true ? CheckPass : CheckFail<T, 'any'>;
63
+ /**
64
+ * Tests if this type is `never`.
65
+ */
66
+ isNever(): IsNever<T> extends true ? CheckPass : CheckFail<T, 'never'>;
67
+ /**
68
+ * Tests if this type is `unknown`.
69
+ */
70
+ isUnknown(): IsUnknown<T> extends true ? CheckPass : CheckFail<T, 'unknown'>;
71
+ /**
72
+ * Tests if this type is `void`.
73
+ */
74
+ isVoid(): IsVoid<T> extends true ? CheckPass : CheckFail<T, 'void'>;
75
+ /**
76
+ * Tests if this type is `undefined`.
77
+ */
78
+ isUndefined(): IsUndefined<T> extends true ? CheckPass : CheckFail<T, 'undefined'>;
79
+ /**
80
+ * Tests if this type is `null`.
81
+ */
82
+ isNull(): IsNull<T> extends true ? CheckPass : CheckFail<T, 'null'>;
83
+ /**
84
+ * Tests if this type is nullable (null or undefined).
85
+ */
86
+ isNullable(): IsNullable<T> extends true ? CheckPass : CheckFail<T, 'not nullable'>;
87
+ /**
88
+ * Tests if this type is optional (may be undefined).
89
+ */
90
+ isOptional(): IsOptional<T> extends true ? CheckPass : CheckFail<T, 'not optional'>;
91
+ /**
92
+ * Tests if this type is a union.
93
+ */
94
+ isUnion(): IsUnion<T> extends true ? CheckPass : CheckFail<T, 'not a union'>;
95
+ /**
96
+ * Tests if this type is a tuple.
97
+ */
98
+ isTuple(): IsTuple<T> extends true ? CheckPass : CheckFail<T, 'not a tuple'>;
99
+ /**
100
+ * Tests if this type is an array.
101
+ */
102
+ isArray(): IsArray<T> extends true ? CheckPass : CheckFail<T, 'not an array'>;
103
+ /**
104
+ * Tests if this type is inhabited (has values).
105
+ */
106
+ isInhabited(): IsInhabited<T> extends true ? CheckPass : CheckFail<T, 'uninhabited'>;
107
+ /**
108
+ * Tests if this type is uninhabited (has no values).
109
+ */
110
+ isUninhabited(): IsUninhabited<T> extends true ? CheckPass : CheckFail<T, 'inhabited'>;
111
+ /**
112
+ * Gets the parameters of this function type.
113
+ */
114
+ parameters(): T extends (...args: any[]) => any ? Check<Parameters<T>> : Check<never>;
115
+ /**
116
+ * Gets the return type of this function type.
117
+ */
118
+ returnType(): T extends (...args: any[]) => any ? Check<ReturnType<T>> : Check<never>;
119
+ /**
120
+ * Gets the length of this array/tuple type.
121
+ */
122
+ length(): T extends readonly any[] ? Check<Length<T>> : Check<never>;
123
+ /**
124
+ * Gets the parameter at a specific index.
125
+ */
126
+ parameter<N extends number>(): T extends (...args: any[]) => any ? Check<Parameter<T, N>> : Check<never>;
127
+ }
128
+ /**
129
+ * Creates a check for a specific type.
130
+ *
131
+ * @example
132
+ * ```typescript
133
+ * check<string>().equals<string>()
134
+ * check<{ a: string }>().hasProperty('a')
135
+ * ```
136
+ */
137
+ export declare function check<T>(): CheckBuilder<T>;
138
+ //# sourceMappingURL=check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/api/check.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACzH,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,KAAK,EAA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,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAA;CACzG;AAED;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CAAC,CAAC,KAAK,YAAY,CAAC,CAAC,CAAC,CAG1C"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Check API - Chainable type checker.
3
+ */
4
+ /**
5
+ * Creates a check for a specific type.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * check<string>().equals<string>()
10
+ * check<{ a: string }>().hasProperty('a')
11
+ * ```
12
+ */
13
+ export function check() {
14
+ // This function exists only at runtime - the types are all compile-time
15
+ return undefined;
16
+ }
17
+ //# sourceMappingURL=check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/api/check.ts"],"names":[],"mappings":"AAAA;;GAEG;AAuJH;;;;;;;;GAQG;AACH,MAAM,UAAU,KAAK;IACnB,wEAAwE;IACxE,OAAO,SAAgB,CAAA;AACzB,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Expect API - Familiar API similar to testing libraries.
3
+ */
4
+ import type { Equal, NotEqual } from '../types/equality.js';
5
+ /**
6
+ * Expect type - familiar API similar to testing libraries.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * expect<string, string>().toBeEqual()
11
+ * expect<string>().toBeAny()
12
+ * ```
13
+ */
14
+ export interface Expect<T, U = unknown> {
15
+ toBeEqual(): Equal<T, U> extends true ? ExpectPass : ExpectFail<T, U>;
16
+ toBeNotEqual(): NotEqual<T, U> extends true ? ExpectPass : ExpectFail<T, U>;
17
+ toExtend(): T extends U ? ExpectPass : ExpectFail<T, U>;
18
+ toBeAssignableTo(): U extends T ? ExpectPass : ExpectFail<T, U>;
19
+ }
20
+ export type ExpectPass = true;
21
+ export type ExpectFail<_T, _U> = never;
22
+ /**
23
+ * Creates an expectation for a type.
24
+ */
25
+ export declare function expect<T, U = unknown>(): Expect<T, U>;
26
+ /**
27
+ * ExpectFalse - for checking types resolve to false.
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * expectFalse<IsNever<string>>()
32
+ * ```
33
+ */
34
+ export declare function expectFalse<_T extends false>(): void;
35
+ //# sourceMappingURL=expect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expect.d.ts","sourceRoot":"","sources":["../../src/api/expect.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAE3D;;;;;;;;GAQG;AACH,MAAM,WAAW,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO;IACpC,SAAS,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,IAAI,GAAG,UAAU,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IACrE,YAAY,IAAI,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,IAAI,GAAG,UAAU,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAC3E,QAAQ,IAAI,CAAC,SAAS,CAAC,GAAG,UAAU,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IACvD,gBAAgB,IAAI,CAAC,SAAS,CAAC,GAAG,UAAU,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;CAChE;AAED,MAAM,MAAM,UAAU,GAAG,IAAI,CAAA;AAE7B,MAAM,MAAM,UAAU,CAAC,EAAE,EAAE,EAAE,IAAI,KAAK,CAAA;AAEtC;;GAEG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAErD;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,EAAE,SAAS,KAAK,KAAK,IAAI,CAEpD"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Expect API - Familiar API similar to testing libraries.
3
+ */
4
+ /**
5
+ * Creates an expectation for a type.
6
+ */
7
+ export function expect() {
8
+ return undefined;
9
+ }
10
+ /**
11
+ * ExpectFalse - for checking types resolve to false.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * expectFalse<IsNever<string>>()
16
+ * ```
17
+ */
18
+ export function expectFalse() {
19
+ // Compile-time only
20
+ }
21
+ //# sourceMappingURL=expect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expect.js","sourceRoot":"","sources":["../../src/api/expect.ts"],"names":[],"mappings":"AAAA;;GAEG;AAwBH;;GAEG;AACH,MAAM,UAAU,MAAM;IACpB,OAAO,SAAgB,CAAA;AACzB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW;IACzB,oBAAoB;AACtB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * API exports.
3
+ */
4
+ export * from './check.js';
5
+ export * from './assert.js';
6
+ export * from './expect.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * API exports.
3
+ */
4
+ export * from './check.js';
5
+ export * from './assert.js';
6
+ export * from './expect.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Type-testing: A micro library for testing your TypeScript types.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ export * from './types/index.js';
7
+ export * from './api/index.js';
8
+ export * from './utils.js';
9
+ export * from './runtime/index.js';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,kBAAkB,CAAA;AAGhC,cAAc,gBAAgB,CAAA;AAG9B,cAAc,YAAY,CAAA;AAG1B,cAAc,oBAAoB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Type-testing: A micro library for testing your TypeScript types.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ // Re-export all type utilities
7
+ export * from './types/index.js';
8
+ // Re-export API
9
+ export * from './api/index.js';
10
+ // Re-export utilities
11
+ export * from './utils.js';
12
+ // Re-export runtime utilities
13
+ export * from './runtime/index.js';
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,+BAA+B;AAC/B,cAAc,kBAAkB,CAAA;AAEhC,gBAAgB;AAChB,cAAc,gBAAgB,CAAA;AAE9B,sBAAsB;AACtB,cAAc,YAAY,CAAA;AAE1B,8BAA8B;AAC9B,cAAc,oBAAoB,CAAA"}
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Runtime comparison utilities.
3
+ */
4
+ /**
5
+ * Result of checking if a value matches a type.
6
+ */
7
+ export interface TypeCheckResult<T> {
8
+ matches: boolean;
9
+ value: T;
10
+ typeName: string;
11
+ }
12
+ /**
13
+ * Check if a value is a string.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * const result = isString('hello')
18
+ * result.matches // true
19
+ * ```
20
+ */
21
+ export declare function isString(value: unknown): TypeCheckResult<string>;
22
+ /**
23
+ * Check if a value is a number.
24
+ *
25
+ * @example
26
+ * ```typescript
27
+ * const result = isNumber(42)
28
+ * result.matches // true
29
+ * ```
30
+ */
31
+ export declare function isNumber(value: unknown): TypeCheckResult<number>;
32
+ /**
33
+ * Check if a value is a boolean.
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * const result = isBoolean(true)
38
+ * result.matches // true
39
+ * ```
40
+ */
41
+ export declare function isBoolean(value: unknown): TypeCheckResult<boolean>;
42
+ /**
43
+ * Check if a value is an object.
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * const result = isObject({ a: 1 })
48
+ * result.matches // true
49
+ * ```
50
+ */
51
+ export declare function isObject(value: unknown): TypeCheckResult<object>;
52
+ /**
53
+ * Check if a value is an array.
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * const result = isArray([1, 2, 3])
58
+ * result.matches // true
59
+ * ```
60
+ */
61
+ export declare function isArray(value: unknown): TypeCheckResult<unknown[]>;
62
+ /**
63
+ * Check if a value is null.
64
+ *
65
+ * @example
66
+ * ```typescript
67
+ * const result = isNull(null)
68
+ * result.matches // true
69
+ * ```
70
+ */
71
+ export declare function isNull(value: unknown): TypeCheckResult<null>;
72
+ /**
73
+ * Check if a value is undefined.
74
+ *
75
+ * @example
76
+ * ```typescript
77
+ * const result = isUndefined(undefined)
78
+ * result.matches // true
79
+ * ```
80
+ */
81
+ export declare function isUndefined(value: unknown): TypeCheckResult<undefined>;
82
+ /**
83
+ * Type guard that returns true if the value is a string.
84
+ */
85
+ export declare function isStringGuard(value: unknown): value is string;
86
+ /**
87
+ * Type guard that returns true if the value is a number.
88
+ */
89
+ export declare function isNumberGuard(value: unknown): value is number;
90
+ /**
91
+ * Type guard that returns true if the value is a boolean.
92
+ */
93
+ export declare function isBooleanGuard(value: unknown): value is boolean;
94
+ /**
95
+ * Type guard that returns true if the value is an object (not null, not array).
96
+ */
97
+ export declare function isObjectGuard(value: unknown): value is object;
98
+ /**
99
+ * Type guard that returns true if the value is an array.
100
+ */
101
+ export declare function isArrayGuard(value: unknown): value is unknown[];
102
+ /**
103
+ * Type guard that returns true if the value is null.
104
+ */
105
+ export declare function isNullGuard(value: unknown): value is null;
106
+ /**
107
+ * Type guard that returns true if the value is undefined.
108
+ */
109
+ export declare function isUndefinedGuard(value: unknown): value is undefined;
110
+ /**
111
+ * Type guard that returns true if the value is a symbol.
112
+ */
113
+ export declare function isSymbolGuard(value: unknown): value is symbol;
114
+ /**
115
+ * Type guard that returns true if the value is a bigint.
116
+ */
117
+ export declare function isBigIntGuard(value: unknown): value is bigint;
118
+ /**
119
+ * Type guard that returns true if the value is a function.
120
+ */
121
+ export declare function isFunctionGuard(value: unknown): value is Function;
122
+ //# sourceMappingURL=comparison.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comparison.d.ts","sourceRoot":"","sources":["../../src/runtime/comparison.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,CAAC,CAAA;IACR,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAAC,MAAM,CAAC,CAMhE;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAAC,MAAM,CAAC,CAMhE;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC,CAMlE;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAAC,MAAM,CAAC,CAMhE;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAAC,OAAO,EAAE,CAAC,CAMlE;AAED;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAAC,IAAI,CAAC,CAM5D;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAAC,SAAS,CAAC,CAMtE;AAMD;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE7D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE7D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAE/D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE7D;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,EAAE,CAE/D;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,IAAI,CAEzD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAEnE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE7D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE7D;AAED;;GAEG;AAEH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAEjE"}
@@ -0,0 +1,180 @@
1
+ /**
2
+ * Runtime comparison utilities.
3
+ */
4
+ /**
5
+ * Check if a value is a string.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * const result = isString('hello')
10
+ * result.matches // true
11
+ * ```
12
+ */
13
+ export function isString(value) {
14
+ return {
15
+ matches: typeof value === 'string',
16
+ value: value,
17
+ typeName: typeof value,
18
+ };
19
+ }
20
+ /**
21
+ * Check if a value is a number.
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const result = isNumber(42)
26
+ * result.matches // true
27
+ * ```
28
+ */
29
+ export function isNumber(value) {
30
+ return {
31
+ matches: typeof value === 'number',
32
+ value: value,
33
+ typeName: typeof value,
34
+ };
35
+ }
36
+ /**
37
+ * Check if a value is a boolean.
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * const result = isBoolean(true)
42
+ * result.matches // true
43
+ * ```
44
+ */
45
+ export function isBoolean(value) {
46
+ return {
47
+ matches: typeof value === 'boolean',
48
+ value: value,
49
+ typeName: typeof value,
50
+ };
51
+ }
52
+ /**
53
+ * Check if a value is an object.
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * const result = isObject({ a: 1 })
58
+ * result.matches // true
59
+ * ```
60
+ */
61
+ export function isObject(value) {
62
+ return {
63
+ matches: typeof value === 'object' && value !== null,
64
+ value: value,
65
+ typeName: typeof value,
66
+ };
67
+ }
68
+ /**
69
+ * Check if a value is an array.
70
+ *
71
+ * @example
72
+ * ```typescript
73
+ * const result = isArray([1, 2, 3])
74
+ * result.matches // true
75
+ * ```
76
+ */
77
+ export function isArray(value) {
78
+ return {
79
+ matches: Array.isArray(value),
80
+ value: value,
81
+ typeName: Array.isArray(value) ? 'array' : typeof value,
82
+ };
83
+ }
84
+ /**
85
+ * Check if a value is null.
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * const result = isNull(null)
90
+ * result.matches // true
91
+ * ```
92
+ */
93
+ export function isNull(value) {
94
+ return {
95
+ matches: value === null,
96
+ value: value,
97
+ typeName: value === null ? 'null' : typeof value,
98
+ };
99
+ }
100
+ /**
101
+ * Check if a value is undefined.
102
+ *
103
+ * @example
104
+ * ```typescript
105
+ * const result = isUndefined(undefined)
106
+ * result.matches // true
107
+ * ```
108
+ */
109
+ export function isUndefined(value) {
110
+ return {
111
+ matches: value === undefined,
112
+ value: value,
113
+ typeName: value === undefined ? 'undefined' : typeof value,
114
+ };
115
+ }
116
+ // ============================================
117
+ // Simple boolean type guards
118
+ // ============================================
119
+ /**
120
+ * Type guard that returns true if the value is a string.
121
+ */
122
+ export function isStringGuard(value) {
123
+ return typeof value === 'string';
124
+ }
125
+ /**
126
+ * Type guard that returns true if the value is a number.
127
+ */
128
+ export function isNumberGuard(value) {
129
+ return typeof value === 'number';
130
+ }
131
+ /**
132
+ * Type guard that returns true if the value is a boolean.
133
+ */
134
+ export function isBooleanGuard(value) {
135
+ return typeof value === 'boolean';
136
+ }
137
+ /**
138
+ * Type guard that returns true if the value is an object (not null, not array).
139
+ */
140
+ export function isObjectGuard(value) {
141
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
142
+ }
143
+ /**
144
+ * Type guard that returns true if the value is an array.
145
+ */
146
+ export function isArrayGuard(value) {
147
+ return Array.isArray(value);
148
+ }
149
+ /**
150
+ * Type guard that returns true if the value is null.
151
+ */
152
+ export function isNullGuard(value) {
153
+ return value === null;
154
+ }
155
+ /**
156
+ * Type guard that returns true if the value is undefined.
157
+ */
158
+ export function isUndefinedGuard(value) {
159
+ return value === undefined;
160
+ }
161
+ /**
162
+ * Type guard that returns true if the value is a symbol.
163
+ */
164
+ export function isSymbolGuard(value) {
165
+ return typeof value === 'symbol';
166
+ }
167
+ /**
168
+ * Type guard that returns true if the value is a bigint.
169
+ */
170
+ export function isBigIntGuard(value) {
171
+ return typeof value === 'bigint';
172
+ }
173
+ /**
174
+ * Type guard that returns true if the value is a function.
175
+ */
176
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
177
+ export function isFunctionGuard(value) {
178
+ return typeof value === 'function';
179
+ }
180
+ //# sourceMappingURL=comparison.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comparison.js","sourceRoot":"","sources":["../../src/runtime/comparison.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH;;;;;;;;GAQG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO;QACL,OAAO,EAAE,OAAO,KAAK,KAAK,QAAQ;QAClC,KAAK,EAAE,KAAe;QACtB,QAAQ,EAAE,OAAO,KAAK;KACvB,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AC,KAAc;IAC5C,OAAO,OAAO,KAAK,KAAK,UAAU,CAAA;AACpC,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Runtime type testing utilities.
3
+ */
4
+ export * from './comparison.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,iBAAiB,CAAA"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Runtime type testing utilities.
3
+ */
4
+ export * from './comparison.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,iBAAiB,CAAA"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Type equality utilities.
3
+ */
4
+ /**
5
+ * Checks if two types are strictly equal.
6
+ * Uses a technique that compares the structure while handling
7
+ * special types like any, never, and unknown.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * check<string>().equals<string>() // passes
12
+ * check<string>().equals<number>() // fails at compile time
13
+ * ```
14
+ */
15
+ export type Equal<T, U> = (<G>() => G extends T ? 1 : 2) extends (<G>() => G extends U ? 1 : 2) ? true : false;
16
+ /**
17
+ * Checks if two types are not equal.
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * check<string>().notEquals<number>() // passes
22
+ * ```
23
+ */
24
+ export type NotEqual<T, U> = Equal<T, U> extends true ? false : true;
25
+ /**
26
+ * Simple equality check that works in more contexts.
27
+ * Useful for simple type comparisons.
28
+ */
29
+ export type SimpleEqual<T, U> = [T, U] extends [U, T] ? true : false;
30
+ //# sourceMappingURL=equality.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"equality.d.ts","sourceRoot":"","sources":["../../src/types/equality.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC,IACpB,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GACjE,IAAI,GACJ,KAAK,CAAA;AAEX;;;;;;;GAOG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,IAAI,GAAG,KAAK,GAAG,IAAI,CAAA;AAEpE;;;GAGG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,GAAG,KAAK,CAAA"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Type equality utilities.
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=equality.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"equality.js","sourceRoot":"","sources":["../../src/types/equality.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Function type utilities.
3
+ */
4
+ /**
5
+ * Gets the parameters of a function type as a tuple.
6
+ */
7
+ export type Parameters<T extends (...args: any[]) => any> = T extends (...args: infer P) => any ? P : never;
8
+ /**
9
+ * Gets the return type of a function type.
10
+ */
11
+ export type ReturnType<T extends (...args: any[]) => any> = T extends (...args: any[]) => infer R ? R : never;
12
+ /**
13
+ * Gets the parameter type at a specific index.
14
+ */
15
+ export type Parameter<T extends (...args: any[]) => any, N extends number> = Parameters<T>[N];
16
+ //# sourceMappingURL=function.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../src/types/function.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,KAAK,CAAA;AAE3G;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAE7G;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,CAAC,SAAS,MAAM,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Function type utilities.
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=function.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function.js","sourceRoot":"","sources":["../../src/types/function.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Type testing utilities.
3
+ */
4
+ export * from './equality.js';
5
+ export * from './special.js';
6
+ export * from './union.js';
7
+ export * from './inhabitation.js';
8
+ export * from './property.js';
9
+ export * from './function.js';
10
+ export * from './length.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Type testing utilities.
3
+ */
4
+ // Re-export all types
5
+ export * from './equality.js';
6
+ export * from './special.js';
7
+ export * from './union.js';
8
+ export * from './inhabitation.js';
9
+ export * from './property.js';
10
+ export * from './function.js';
11
+ export * from './length.js';
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,sBAAsB;AACtB,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Type inhabitation utilities.
3
+ */
4
+ /**
5
+ * Checks if a type is inhabited (has at least one value).
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * check<string>().isInhabited() // passes
10
+ * check<never>().isInhabited() // fails
11
+ * ```
12
+ */
13
+ export type IsInhabited<T> = [T] extends [never] ? false : true;
14
+ /**
15
+ * Checks if a type is uninhabited (has no values).
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * check<never>().isUninhabited() // passes
20
+ * check<string>().isUninhabited() // fails
21
+ * ```
22
+ */
23
+ export type IsUninhabited<T> = [T] extends [never] ? true : false;
24
+ //# sourceMappingURL=inhabitation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inhabitation.d.ts","sourceRoot":"","sources":["../../src/types/inhabitation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,IAAI,CAAA;AAE/D;;;;;;;;GAQG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,KAAK,CAAA"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Type inhabitation utilities.
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=inhabitation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inhabitation.js","sourceRoot":"","sources":["../../src/types/inhabitation.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Length utility.
3
+ */
4
+ /**
5
+ * Gets the length of an array or tuple type.
6
+ */
7
+ export type Length<T extends readonly any[]> = T['length'];
8
+ //# sourceMappingURL=length.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"length.d.ts","sourceRoot":"","sources":["../../src/types/length.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,SAAS,GAAG,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAA"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Length utility.
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=length.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"length.js","sourceRoot":"","sources":["../../src/types/length.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Property testing utilities.
3
+ */
4
+ /**
5
+ * Checks if a type has a specific property.
6
+ */
7
+ export type HasProperty<T, K extends PropertyKey> = K extends keyof T ? true : false;
8
+ /**
9
+ * Gets the type of a specific property from a type.
10
+ */
11
+ export type PropertyType<T, K extends keyof T> = T[K];
12
+ //# sourceMappingURL=property.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"property.d.ts","sourceRoot":"","sources":["../../src/types/property.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,CAAC,SAAS,WAAW,IAAI,CAAC,SAAS,MAAM,CAAC,GAAG,IAAI,GAAG,KAAK,CAAA;AAEpF;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Property testing utilities.
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=property.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"property.js","sourceRoot":"","sources":["../../src/types/property.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Special type detection utilities.
3
+ */
4
+ import type { Equal } from './equality';
5
+ /**
6
+ * Checks if a type is `any`.
7
+ * Uses the technique: 0 extends (1 & T) ? true : false
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * check<any>().isAny() // passes
12
+ * check<string>().isAny() // fails
13
+ * ```
14
+ */
15
+ export type IsAny<T> = 0 extends (1 & T) ? true : false;
16
+ /**
17
+ * Checks if a type is `never`.
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * check<never>().isNever() // passes
22
+ * check<string>().isNever() // fails
23
+ * ```
24
+ */
25
+ export type IsNever<T> = [T] extends [never] ? true : false;
26
+ /**
27
+ * Checks if a type is `unknown`.
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * check<unknown>().isUnknown() // passes
32
+ * ```
33
+ */
34
+ export type IsUnknown<T> = [unknown] extends [T] ? ([T] extends [unknown] ? true : false) : false;
35
+ /**
36
+ * Checks if a type is `void`.
37
+ */
38
+ export type IsVoid<T> = Equal<T, void>;
39
+ /**
40
+ * Checks if a type is `undefined`.
41
+ */
42
+ export type IsUndefined<T> = Equal<T, undefined>;
43
+ /**
44
+ * Checks if a type is `null`.
45
+ */
46
+ export type IsNull<T> = Equal<T, null>;
47
+ /**
48
+ * Checks if a type is `null` or `undefined`.
49
+ */
50
+ export type IsNullable<T> = [null] extends [T] ? true : ([undefined] extends [T] ? true : false);
51
+ /**
52
+ * Checks if a type is optional (may be undefined).
53
+ */
54
+ export type IsOptional<T> = [undefined] extends [T] ? true : false;
55
+ //# sourceMappingURL=special.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"special.d.ts","sourceRoot":"","sources":["../../src/types/special.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAEvC;;;;;;;;;GASG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,GAAG,KAAK,CAAA;AAEvD;;;;;;;;GAQG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,KAAK,CAAA;AAE3D;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC,GAAG,KAAK,CAAA;AAEjG;;GAEG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;AAEtC;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAA;AAEhD;;GAEG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;AAEtC;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC,CAAA;AAEhG;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,KAAK,CAAA"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Special type detection utilities.
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=special.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"special.js","sourceRoot":"","sources":["../../src/types/special.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Union and tuple detection utilities.
3
+ */
4
+ /**
5
+ * Checks if a type is a union.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * check<'a' | 'b'>().isUnion() // passes
10
+ * check<'a'>().isUnion() // fails
11
+ * ```
12
+ */
13
+ export type IsUnion<T, U = T> = [U] extends [never] ? false : T extends U ? [Exclude<U, never>] extends [T] ? false : true : false;
14
+ /**
15
+ * Checks if a type is a tuple.
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * check<[string, number]>().isTuple() // passes
20
+ * check<string[]>().isTuple() // fails
21
+ * ```
22
+ */
23
+ export type IsTuple<T> = T extends readonly any[] ? (number extends T['length'] ? false : true) : false;
24
+ /**
25
+ * Checks if a type is an array.
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * check<string[]>().isArray() // passes
30
+ * check<[string]>().isArray() // fails
31
+ * ```
32
+ */
33
+ export type IsArray<T> = T extends readonly any[] ? (IsTuple<T> extends true ? false : true) : false;
34
+ //# sourceMappingURL=union.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"union.d.ts","sourceRoot":"","sources":["../../src/types/union.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,CAAA;AAElI;;;;;;;;GAQG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,EAAE,GAAG,CAAC,MAAM,SAAS,CAAC,CAAC,QAAQ,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG,KAAK,CAAA;AAEvG;;;;;;;;GAQG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG,KAAK,CAAA"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Union and tuple detection utilities.
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=union.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"union.js","sourceRoot":"","sources":["../../src/types/union.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Additional utilities.
3
+ */
4
+ import type { Equal } from './types/equality.js';
5
+ /**
6
+ * Type that always resolves to true.
7
+ * Useful for making compile-time assertions.
8
+ */
9
+ export type ExpectTrue<_T extends true> = true;
10
+ /**
11
+ * Type that validates equality and throws if not equal.
12
+ */
13
+ export type ExpectEqual<T, U> = Equal<T, U> extends true ? T : never;
14
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAEhD;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,EAAE,SAAS,IAAI,IAAI,IAAI,CAAA;AAE9C;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,GAAG,KAAK,CAAA"}
package/dist/utils.js ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Additional utilities.
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deessejs/type-testing",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -16,6 +16,7 @@
16
16
  "lint": "eslint src --ext .ts,.tsx",
17
17
  "typecheck": "tsc --noEmit",
18
18
  "test": "vitest run",
19
+ "test:coverage": "vitest run --coverage",
19
20
  "test:watch": "vitest",
20
21
  "clean": "rm -rf dist"
21
22
  },