@deessejs/type-testing 0.1.3 → 0.1.5

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 (57) hide show
  1. package/dist/api/assert.d.ts +43 -0
  2. package/dist/api/assert.d.ts.map +1 -0
  3. package/dist/api/assert.js +7 -0
  4. package/dist/api/assert.js.map +1 -0
  5. package/dist/api/check.d.ts +138 -0
  6. package/dist/api/check.d.ts.map +1 -0
  7. package/dist/api/check.js +17 -0
  8. package/dist/api/check.js.map +1 -0
  9. package/dist/api/expect.d.ts +35 -0
  10. package/dist/api/expect.d.ts.map +1 -0
  11. package/dist/api/expect.js +21 -0
  12. package/dist/api/expect.js.map +1 -0
  13. package/dist/api/index.d.ts +7 -0
  14. package/dist/api/index.d.ts.map +1 -0
  15. package/dist/api/index.js +7 -0
  16. package/dist/api/index.js.map +1 -0
  17. package/dist/index.d.ts +9 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +12 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/types/equality.d.ts +30 -0
  22. package/dist/types/equality.d.ts.map +1 -0
  23. package/dist/types/equality.js +5 -0
  24. package/dist/types/equality.js.map +1 -0
  25. package/dist/types/function.d.ts +16 -0
  26. package/dist/types/function.d.ts.map +1 -0
  27. package/dist/types/function.js +5 -0
  28. package/dist/types/function.js.map +1 -0
  29. package/dist/types/index.d.ts +11 -0
  30. package/dist/types/index.d.ts.map +1 -0
  31. package/dist/types/index.js +12 -0
  32. package/dist/types/index.js.map +1 -0
  33. package/dist/types/inhabitation.d.ts +24 -0
  34. package/dist/types/inhabitation.d.ts.map +1 -0
  35. package/dist/types/inhabitation.js +5 -0
  36. package/dist/types/inhabitation.js.map +1 -0
  37. package/dist/types/length.d.ts +8 -0
  38. package/dist/types/length.d.ts.map +1 -0
  39. package/dist/types/length.js +5 -0
  40. package/dist/types/length.js.map +1 -0
  41. package/dist/types/property.d.ts +12 -0
  42. package/dist/types/property.d.ts.map +1 -0
  43. package/dist/types/property.js +5 -0
  44. package/dist/types/property.js.map +1 -0
  45. package/dist/types/special.d.ts +55 -0
  46. package/dist/types/special.d.ts.map +1 -0
  47. package/dist/types/special.js +5 -0
  48. package/dist/types/special.js.map +1 -0
  49. package/dist/types/union.d.ts +34 -0
  50. package/dist/types/union.d.ts.map +1 -0
  51. package/dist/types/union.js +5 -0
  52. package/dist/types/union.js.map +1 -0
  53. package/dist/utils.d.ts +14 -0
  54. package/dist/utils.d.ts.map +1 -0
  55. package/dist/utils.js +5 -0
  56. package/dist/utils.js.map +1 -0
  57. package/package.json +1 -1
@@ -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,sBAAsB,CAAA;AACvD,OAAO,KAAK,EAAE,KAAK,E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ert 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,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,0BAA0B,CA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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,9 @@
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
+ //# 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"}
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
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
+ //# 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"}
@@ -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.3",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",