lay-sing 0.1.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 (125) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +151 -0
  3. package/esm/main/array.d.ts +48 -0
  4. package/esm/main/array.d.ts.map +1 -0
  5. package/esm/main/array.js +2 -0
  6. package/esm/main/array.js.map +1 -0
  7. package/esm/main/async.d.ts +5 -0
  8. package/esm/main/async.d.ts.map +1 -0
  9. package/esm/main/async.js +2 -0
  10. package/esm/main/async.js.map +1 -0
  11. package/esm/main/boolean.d.ts +36 -0
  12. package/esm/main/boolean.d.ts.map +1 -0
  13. package/esm/main/boolean.js +2 -0
  14. package/esm/main/boolean.js.map +1 -0
  15. package/esm/main/control.d.ts +88 -0
  16. package/esm/main/control.d.ts.map +1 -0
  17. package/esm/main/control.js +2 -0
  18. package/esm/main/control.js.map +1 -0
  19. package/esm/main/doc.d.ts +30 -0
  20. package/esm/main/doc.d.ts.map +1 -0
  21. package/esm/main/doc.js +2 -0
  22. package/esm/main/doc.js.map +1 -0
  23. package/esm/main/function.d.ts +21 -0
  24. package/esm/main/function.d.ts.map +1 -0
  25. package/esm/main/function.js +3 -0
  26. package/esm/main/function.js.map +1 -0
  27. package/esm/main/index.d.ts +12 -0
  28. package/esm/main/index.d.ts.map +1 -0
  29. package/esm/main/index.js +12 -0
  30. package/esm/main/index.js.map +1 -0
  31. package/esm/main/json.d.ts +44 -0
  32. package/esm/main/json.d.ts.map +1 -0
  33. package/esm/main/json.js +2 -0
  34. package/esm/main/json.js.map +1 -0
  35. package/esm/main/key.d.ts +26 -0
  36. package/esm/main/key.d.ts.map +1 -0
  37. package/esm/main/key.js +2 -0
  38. package/esm/main/key.js.map +1 -0
  39. package/esm/main/object.d.ts +81 -0
  40. package/esm/main/object.d.ts.map +1 -0
  41. package/esm/main/object.js +2 -0
  42. package/esm/main/object.js.map +1 -0
  43. package/esm/main/type/compare.d.ts +79 -0
  44. package/esm/main/type/compare.d.ts.map +1 -0
  45. package/esm/main/type/compare.js +2 -0
  46. package/esm/main/type/compare.js.map +1 -0
  47. package/esm/main/type/index.d.ts +3 -0
  48. package/esm/main/type/index.d.ts.map +1 -0
  49. package/esm/main/type/index.js +3 -0
  50. package/esm/main/type/index.js.map +1 -0
  51. package/esm/main/type/set.d.ts +29 -0
  52. package/esm/main/type/set.d.ts.map +1 -0
  53. package/esm/main/type/set.js +2 -0
  54. package/esm/main/type/set.js.map +1 -0
  55. package/esm/main/typed-array.d.ts +5 -0
  56. package/esm/main/typed-array.d.ts.map +1 -0
  57. package/esm/main/typed-array.js +2 -0
  58. package/esm/main/typed-array.js.map +1 -0
  59. package/esm/package.json +3 -0
  60. package/esm/test-utils.d.ts +348 -0
  61. package/esm/test-utils.d.ts.map +1 -0
  62. package/esm/test-utils.js +49 -0
  63. package/esm/test-utils.js.map +1 -0
  64. package/package.json +29 -0
  65. package/script/main/array.d.ts +48 -0
  66. package/script/main/array.d.ts.map +1 -0
  67. package/script/main/array.js +3 -0
  68. package/script/main/array.js.map +1 -0
  69. package/script/main/async.d.ts +5 -0
  70. package/script/main/async.d.ts.map +1 -0
  71. package/script/main/async.js +3 -0
  72. package/script/main/async.js.map +1 -0
  73. package/script/main/boolean.d.ts +36 -0
  74. package/script/main/boolean.d.ts.map +1 -0
  75. package/script/main/boolean.js +3 -0
  76. package/script/main/boolean.js.map +1 -0
  77. package/script/main/control.d.ts +88 -0
  78. package/script/main/control.d.ts.map +1 -0
  79. package/script/main/control.js +3 -0
  80. package/script/main/control.js.map +1 -0
  81. package/script/main/doc.d.ts +30 -0
  82. package/script/main/doc.d.ts.map +1 -0
  83. package/script/main/doc.js +3 -0
  84. package/script/main/doc.js.map +1 -0
  85. package/script/main/function.d.ts +21 -0
  86. package/script/main/function.d.ts.map +1 -0
  87. package/script/main/function.js +4 -0
  88. package/script/main/function.js.map +1 -0
  89. package/script/main/index.d.ts +12 -0
  90. package/script/main/index.d.ts.map +1 -0
  91. package/script/main/index.js +28 -0
  92. package/script/main/index.js.map +1 -0
  93. package/script/main/json.d.ts +44 -0
  94. package/script/main/json.d.ts.map +1 -0
  95. package/script/main/json.js +3 -0
  96. package/script/main/json.js.map +1 -0
  97. package/script/main/key.d.ts +26 -0
  98. package/script/main/key.d.ts.map +1 -0
  99. package/script/main/key.js +3 -0
  100. package/script/main/key.js.map +1 -0
  101. package/script/main/object.d.ts +81 -0
  102. package/script/main/object.d.ts.map +1 -0
  103. package/script/main/object.js +3 -0
  104. package/script/main/object.js.map +1 -0
  105. package/script/main/type/compare.d.ts +79 -0
  106. package/script/main/type/compare.d.ts.map +1 -0
  107. package/script/main/type/compare.js +3 -0
  108. package/script/main/type/compare.js.map +1 -0
  109. package/script/main/type/index.d.ts +3 -0
  110. package/script/main/type/index.d.ts.map +1 -0
  111. package/script/main/type/index.js +19 -0
  112. package/script/main/type/index.js.map +1 -0
  113. package/script/main/type/set.d.ts +29 -0
  114. package/script/main/type/set.d.ts.map +1 -0
  115. package/script/main/type/set.js +3 -0
  116. package/script/main/type/set.js.map +1 -0
  117. package/script/main/typed-array.d.ts +5 -0
  118. package/script/main/typed-array.d.ts.map +1 -0
  119. package/script/main/typed-array.js +3 -0
  120. package/script/main/typed-array.js.map +1 -0
  121. package/script/package.json +3 -0
  122. package/script/test-utils.d.ts +348 -0
  123. package/script/test-utils.d.ts.map +1 -0
  124. package/script/test-utils.js +54 -0
  125. package/script/test-utils.js.map +1 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Leawind <leawind@yeah.net>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,151 @@
1
+ | | |
2
+ | ------- | -------------------------- |
3
+ | English | [简体中文](./README-zh.md) |
4
+
5
+ # `lay-sing`
6
+
7
+ A collection of testing utilities and type manipulation tools for compile-time type validation and advanced type operations.
8
+
9
+ ## What is it
10
+
11
+ 1. **Testing Utilities**
12
+
13
+ ```ts
14
+ // They do nothing at runtime
15
+ expect<number>().toBe<number>().success
16
+ expect<number>().toBe<string>().fail
17
+
18
+ // Type error: Property 'success' does not exist on type '{ fail: void; }'.
19
+ expect<number>().toBe<string>().success
20
+ ```
21
+
22
+ 2. **Type Manipulation Tools**
23
+
24
+ ```ts
25
+ // Result is 'Bob'
26
+ type Result = Switch<2, [
27
+ Case<1, 'Alice'>,
28
+ Case<2, 'Bob'>,
29
+ Case<3, 'Charlie'>,
30
+ ], DefaultCase<'Unknown'>>
31
+ ```
32
+
33
+ ## Install
34
+
35
+ (#TODO)
36
+
37
+ ## Testing Utilities
38
+
39
+ The `test-utils` module provides type-level testing utilities for compile-time type validation.
40
+
41
+ ### Type Expectations
42
+
43
+ The `expect` function provides a fluent API for type-level assertions:
44
+
45
+ ```ts
46
+ // Test if two types are identical
47
+ expect<number>().toBe<number>().success
48
+ expect<number>().toBe<string>().fail
49
+
50
+ // Test if one type extends another
51
+ expect<2>().toExtend<number>().success
52
+ expect<2>().toExtend<string>().fail
53
+
54
+ // Test if type has a specific property
55
+ expect<{ name: string }>().toHaveProperty<'name'>().success
56
+
57
+ // Test primitive types
58
+ expect<'hello'>().toExtendString.success
59
+ expect<true>().toExtendBoolean.success
60
+ ```
61
+
62
+ Available assertion methods:
63
+
64
+ - `toBe<U>()` - Tests exact type equality
65
+ - `toExtend<U>()` - Tests if type extends another
66
+ - `toProperExtend<U>()` - Tests if type properly extends another (extends but is not the same)
67
+ - `toHaveProperty<K>()` - Tests if type has a property with key K
68
+ - `toExtendNumber` - Tests if type extends the Number primitive (available only when type extends number)
69
+ - `toExtendString` - Tests if type extends the String primitive (available only when type extends string)
70
+ - `toExtendBoolean` - Tests if type extends the Boolean primitive (available only when type extends boolean)
71
+ - Specific primitive type checks: `toBeAny`, `toBeNever`, `toBeUnknown`, `toBeVoid`, `toBeTrue`, `toBeFalse`
72
+
73
+ ### Type Comparisons
74
+
75
+ The `compare` function allows for sophisticated type-to-type relationship testing:
76
+
77
+ ```ts
78
+ // Check if two types are the same
79
+ compare<number, number>().same // Available
80
+
81
+ // Check if two types are different
82
+ compare<number, string>().different // Available
83
+
84
+ // Check if two types overlap
85
+ compare<4, number>().overlap.different // Available
86
+
87
+ // Check if two types are disjoint
88
+ compare<4, 'abc'>().different.disjoint // Available
89
+
90
+ // Check if two types are mutually assignable
91
+ compare<1 | 2, 1 | 2>().mutuallyAssignable // Available
92
+ ```
93
+
94
+ Available comparison methods:
95
+
96
+ - `same` - Available when types are exactly the same
97
+ - `different` - Available when types are different
98
+ - `overlap` - Available when types have some overlap
99
+ - `disjoint` - Available when types have no overlap
100
+ - `mutuallyAssignable` - Available when types are mutually assignable
101
+
102
+ These utilities are invaluable for creating type-level tests that validate your type definitions at compile time.
103
+
104
+ ### NOOP Placeholder
105
+
106
+ A universal no-op placeholder implemented via `Proxy`. `NOOP` can be accessed, called, or chained indefinitely without throwing. Every operation returns itself, making it safe to use as a dummy fallback for APIs, optional hooks, or unimplemented interfaces.
107
+
108
+ ```ts
109
+ NOOP.foo.bar().baz.qux // safe, returns NOOP
110
+ String(NOOP) // "[NOOP]"
111
+ await NOOP // does not await (not thenable)
112
+ ```
113
+
114
+ ## Type Tools
115
+
116
+ Here are some of type tools:
117
+
118
+ ### Conditional Types
119
+
120
+ ```typescript
121
+ type Result = If<true, 'yes', 'no'> // 'yes'
122
+ type Conditional = If<boolean, 'yes', 'no'> // 'yes' | 'no'
123
+ ```
124
+
125
+ ### Boolean Operations
126
+
127
+ ```typescript
128
+ type IsTrue = And<true, true> // true
129
+ type IsFalse = And<true, false> // false
130
+ type Either = Or<true, false> // true
131
+ type Negation = Not<true> // false
132
+ ```
133
+
134
+ ### Array/Tuple Operations
135
+
136
+ ```typescript
137
+ type Combined = ConcatTuple<[1, 2], [3, 4]> // [1, 2, 3, 4]
138
+ type UniqueCombined = ConcatUniqueTuple<[1, 2, 3], [2, 3, 4]> // [1, 2, 3, 4]
139
+ type HasElement = TupleIncludes<[1, 2, 3], 2> // true
140
+ ```
141
+
142
+ ### Object Manipulation
143
+
144
+ ```typescript
145
+ type PartialObj = DeepPartial<{ a: string; nested: { b: number } }> // { a?: string; nested?: { b?: number } }
146
+ type PickedProps = PropsOfType<{ a: string; b: number; c: string }, string> // { a: string; c: string }
147
+ ```
148
+
149
+ ## Name
150
+
151
+ The name "lay-sing" (pronounced /leɪ sɪŋ/) is phonetically similar to the Chinese word "类型" (pinyin: lèi xíng), which translates to "type" in English.
@@ -0,0 +1,48 @@
1
+ import type { Same } from './type/compare.js';
2
+ /**
3
+ * Represents a readonly array of type T
4
+ */
5
+ export type ReadonlyArray<T = unknown> = readonly T[];
6
+ /**
7
+ * Concatenates two tuples into a single tuple type
8
+ *
9
+ * ### Examples
10
+ *
11
+ * ```ts
12
+ * type Result = ConcatTuple<[1, 2], [3, 4]> // [1, 2, 3, 4]
13
+ * ```
14
+ */
15
+ export type ConcatTuple<Left extends readonly unknown[], Right extends readonly unknown[]> = Left extends readonly unknown[] ? (Right extends readonly unknown[] ? [...Left, ...Right] : never) : never;
16
+ /**
17
+ * Checks whether a tuple includes a specific element type
18
+ *
19
+ * ### Examples
20
+ *
21
+ * ```ts
22
+ * type HasTwo = TupleIncludes<[1, 2, 3], 2> // true
23
+ * type HasFour = TupleIncludes<[1, 2, 3], 4> // false
24
+ * ```
25
+ */
26
+ export type TupleIncludes<Tuple extends readonly unknown[], Element> = Tuple extends readonly [infer First, ...infer Rest] ? (Same<Element, First> extends true ? true : TupleIncludes<Rest, Element>) : false;
27
+ /**
28
+ * Appends an element to a tuple only if it doesn't already exist in the tuple
29
+ *
30
+ * ### Examples
31
+ *
32
+ * ```ts
33
+ * type Result1 = AppendUnique<[1, 2, 3], 4> // [1, 2, 3, 4]
34
+ * type Result2 = AppendUnique<[1, 2, 3], 2> // [1, 2, 3]
35
+ * ```
36
+ */
37
+ export type AppendUnique<Tuple extends readonly unknown[], Element> = TupleIncludes<Tuple, Element> extends true ? Tuple : [...Tuple, Element];
38
+ /**
39
+ * Concatenates two tuples while ensuring uniqueness of elements
40
+ *
41
+ * ### Examples
42
+ *
43
+ * ```ts
44
+ * type Result = ConcatUniqueTuple<[1, 2, 3], [2, 3, 4]> // [1, 2, 3, 4]
45
+ * ```
46
+ */
47
+ export type ConcatUniqueTuple<A extends readonly unknown[], B extends readonly unknown[], R extends readonly unknown[] = A> = B extends readonly [infer First, ...infer Rest] ? ConcatUniqueTuple<A, Rest, AppendUnique<R, First>> : R;
48
+ //# sourceMappingURL=array.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src/main/array.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAE7C;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,GAAG,OAAO,IAAI,SAAS,CAAC,EAAE,CAAA;AAErD;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,CACrB,IAAI,SAAS,SAAS,OAAO,EAAE,EAC/B,KAAK,SAAS,SAAS,OAAO,EAAE,IAC9B,IAAI,SAAS,SAAS,OAAO,EAAE,GAAG,CAAC,KAAK,SAAS,SAAS,OAAO,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,KAAK,CAAA;AAE9G;;;;;;;;;GASG;AACH,MAAM,MAAM,aAAa,CACvB,KAAK,SAAS,SAAS,OAAO,EAAE,EAChC,OAAO,IACL,KAAK,SAAS,SAAS,CAAC,MAAM,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,GACnD,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,IAAI,GAAG,IAAI,GAAG,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,GACzE,KAAK,CAAA;AAET;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,CACtB,KAAK,SAAS,SAAS,OAAO,EAAE,EAChC,OAAO,IACL,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,IAAI,GAAG,KAAK,GAAG,CAAC,GAAG,KAAK,EAAE,OAAO,CAAC,CAAA;AAE5E;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,CAC3B,CAAC,SAAS,SAAS,OAAO,EAAE,EAC5B,CAAC,SAAS,SAAS,OAAO,EAAE,EAC5B,CAAC,SAAS,SAAS,OAAO,EAAE,GAAG,CAAC,IAC9B,CAAC,SAAS,SAAS,CAAC,MAAM,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,GAAG,iBAAiB,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=array.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array.js","sourceRoot":"","sources":["../../src/main/array.ts"],"names":[],"mappings":"","sourcesContent":["import type { Same } from './type/compare.js'\n\n/**\n * Represents a readonly array of type T\n */\nexport type ReadonlyArray<T = unknown> = readonly T[]\n\n/**\n * Concatenates two tuples into a single tuple type\n *\n * ### Examples\n *\n * ```ts\n * type Result = ConcatTuple<[1, 2], [3, 4]> // [1, 2, 3, 4]\n * ```\n */\nexport type ConcatTuple<\n Left extends readonly unknown[],\n Right extends readonly unknown[],\n> = Left extends readonly unknown[] ? (Right extends readonly unknown[] ? [...Left, ...Right] : never) : never\n\n/**\n * Checks whether a tuple includes a specific element type\n *\n * ### Examples\n *\n * ```ts\n * type HasTwo = TupleIncludes<[1, 2, 3], 2> // true\n * type HasFour = TupleIncludes<[1, 2, 3], 4> // false\n * ```\n */\nexport type TupleIncludes<\n Tuple extends readonly unknown[],\n Element,\n> = Tuple extends readonly [infer First, ...infer Rest]\n ? (Same<Element, First> extends true ? true : TupleIncludes<Rest, Element>)\n : false\n\n/**\n * Appends an element to a tuple only if it doesn't already exist in the tuple\n *\n * ### Examples\n *\n * ```ts\n * type Result1 = AppendUnique<[1, 2, 3], 4> // [1, 2, 3, 4]\n * type Result2 = AppendUnique<[1, 2, 3], 2> // [1, 2, 3]\n * ```\n */\nexport type AppendUnique<\n Tuple extends readonly unknown[],\n Element,\n> = TupleIncludes<Tuple, Element> extends true ? Tuple : [...Tuple, Element]\n\n/**\n * Concatenates two tuples while ensuring uniqueness of elements\n *\n * ### Examples\n *\n * ```ts\n * type Result = ConcatUniqueTuple<[1, 2, 3], [2, 3, 4]> // [1, 2, 3, 4]\n * ```\n */\nexport type ConcatUniqueTuple<\n A extends readonly unknown[],\n B extends readonly unknown[],\n R extends readonly unknown[] = A,\n> = B extends readonly [infer First, ...infer Rest] ? ConcatUniqueTuple<A, Rest, AppendUnique<R, First>> : R\n"]}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Represents a value that can be either T or a Promise of T
3
+ */
4
+ export type Awaitable<T> = Promise<T> | T;
5
+ //# sourceMappingURL=async.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../src/main/async.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=async.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async.js","sourceRoot":"","sources":["../../src/main/async.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Represents a value that can be either T or a Promise of T\n */\nexport type Awaitable<T> = Promise<T> | T\n"]}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * ### Result
3
+ *
4
+ * - `never`: if `T` is `never`
5
+ * - `boolean`: if `T` is `boolean` or `any`
6
+ * - `false`: if `T` is `true`
7
+ * - `true`: if `T` is `false`
8
+ *
9
+ * ### Examples
10
+ *
11
+ * | `T` | `Not<T>` |
12
+ * | --------- | --------- |
13
+ * | `never` | `never` |
14
+ * | `true` | `false` |
15
+ * | `false` | `true` |
16
+ * | `boolean` | `boolean` |
17
+ * | `any` | `boolean` |
18
+ */
19
+ export type Not<T extends boolean> = T extends true ? false : T extends false ? true : boolean;
20
+ /**
21
+ * - `never`: if anyone of A,B is `never`
22
+ * - `boolean`: if anyone of A,B is `boolean` or `any`
23
+ * - `true`: if both A,B are `true`
24
+ * - `false`: otherwise
25
+ */
26
+ export type And<A extends boolean, B extends boolean> = A extends never ? never : [B] extends [never] ? never : (A extends true ? (B extends true ? true : false) : false);
27
+ /**
28
+ * ### Result
29
+ *
30
+ * - `never`: if anyone of A,B is `never`
31
+ * - `boolean`: if anyone of A,B is `boolean` or `any`
32
+ * - `false`: if both A,B are `false`
33
+ * - `true`: otherwise
34
+ */
35
+ export type Or<A extends boolean, B extends boolean> = [A] extends [never] ? never : [B] extends [never] ? never : [boolean] extends [A] ? boolean : [boolean] extends [B] ? boolean : true extends A ? true : true extends B ? true : false;
36
+ //# sourceMappingURL=boolean.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../src/main/boolean.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,OAAO,IAAI,CAAC,SAAS,IAAI,GAAG,KAAK,GACvD,CAAC,SAAS,KAAK,GAAG,IAAI,GACtB,OAAO,CAAA;AAEX;;;;;GAKG;AACH,MAAM,MAAM,GAAG,CACb,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,OAAO,IACf,CAAC,SAAS,KAAK,GAAG,KAAK,GACvB,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,GAC3B,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC,CAAA;AAE9D;;;;;;;GAOG;AACH,MAAM,MAAM,EAAE,CACZ,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,OAAO,IACf,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,GAC3B,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,GAC3B,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,GAC/B,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,GAC/B,IAAI,SAAS,CAAC,GAAG,IAAI,GACrB,IAAI,SAAS,CAAC,GAAG,IAAI,GACrB,KAAK,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=boolean.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../src/main/boolean.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * ### Result\n *\n * - `never`: if `T` is `never`\n * - `boolean`: if `T` is `boolean` or `any`\n * - `false`: if `T` is `true`\n * - `true`: if `T` is `false`\n *\n * ### Examples\n *\n * | `T` | `Not<T>` |\n * | --------- | --------- |\n * | `never` | `never` |\n * | `true` | `false` |\n * | `false` | `true` |\n * | `boolean` | `boolean` |\n * | `any` | `boolean` |\n */\nexport type Not<T extends boolean> = T extends true ? false\n : T extends false ? true\n : boolean\n\n/**\n * - `never`: if anyone of A,B is `never`\n * - `boolean`: if anyone of A,B is `boolean` or `any`\n * - `true`: if both A,B are `true`\n * - `false`: otherwise\n */\nexport type And<\n A extends boolean,\n B extends boolean,\n> = A extends never ? never\n : [B] extends [never] ? never\n : (A extends true ? (B extends true ? true : false) : false)\n\n/**\n * ### Result\n *\n * - `never`: if anyone of A,B is `never`\n * - `boolean`: if anyone of A,B is `boolean` or `any`\n * - `false`: if both A,B are `false`\n * - `true`: otherwise\n */\nexport type Or<\n A extends boolean,\n B extends boolean,\n> = [A] extends [never] ? never\n : [B] extends [never] ? never\n : [boolean] extends [A] ? boolean\n : [boolean] extends [B] ? boolean\n : true extends A ? true\n : true extends B ? true\n : false\n"]}
@@ -0,0 +1,88 @@
1
+ import type { Same } from './type/compare.js';
2
+ /**
3
+ * Conditional type - returns `T` if condition `C` is true, otherwise returns `F`
4
+ *
5
+ * ### Result
6
+ *
7
+ * - `never`: if `C` is `never`
8
+ * - `T`: if `C` is `true`
9
+ * - `F`: if `C` is `false`
10
+ *
11
+ * ### Examples
12
+ *
13
+ * ```ts
14
+ * type Result = If<true, 'yes', 'no'> // 'yes'
15
+ * type Result2 = If<false, 'yes', 'no'> // 'no'
16
+ * type NeverResult = If<never, 'yes', 'no'> // never
17
+ * ```
18
+ */
19
+ export type If<C extends boolean, T, F = never> = [C] extends [never] ? never : C extends true ? T : F;
20
+ /**
21
+ * Conditional type - returns `T` if condition `C` is false, otherwise returns `F`
22
+ *
23
+ * ### Result
24
+ *
25
+ * - `never`: if `C` is `never`
26
+ * - `T`: if `C` is `false`
27
+ * - `F`: if `C` is `true`
28
+ *
29
+ * ### Examples
30
+ *
31
+ * ```ts
32
+ * type Result = IfFalse<false, 'yes', 'no'> // 'yes'
33
+ * type Result2 = IfFalse<true, 'yes', 'no'> // 'no'
34
+ * type NeverResult = IfFalse<never, 'yes', 'no'> // never
35
+ * ```
36
+ */
37
+ export type IfFalse<C extends boolean, T, F = never> = [C] extends [never] ? never : C extends false ? T : F;
38
+ /**
39
+ * Used with:
40
+ * - {@link Switch}
41
+ * - {@link SwitchExtends}
42
+ */
43
+ export type Case<T = unknown, Return = unknown> = [T, Return];
44
+ /**
45
+ * Used with:
46
+ *
47
+ * - {@link Switch}
48
+ * - {@link SwitchExtends}
49
+ *
50
+ * ### Examples
51
+ *
52
+ * ```ts
53
+ * type NameMap<id> = Switch<id, [
54
+ * Case<1, 'Alice'>,
55
+ * Case<2, 'Bob'>,
56
+ * Case<3, 'Charlie'>,
57
+ * ], DefaultCase<'Steve'>>
58
+ * ```
59
+ */
60
+ export type DefaultCase<T> = T;
61
+ /**
62
+ * ### Examples
63
+ *
64
+ * ```ts
65
+ * type Result = Switch<2, [
66
+ * Case<1, 'Alice'>,
67
+ * Case<2, 'Bob'>,
68
+ * Case<3, 'Charlie'>,
69
+ * ], DefaultCase<'Steve'>>
70
+ *
71
+ * // Result: 'Bob'
72
+ * ```
73
+ */
74
+ export type Switch<T, Cases extends readonly Case[], Default = never> = Cases extends [infer First, ...infer Rest] ? (First extends [infer C, infer R] ? (Same<T, C> extends true ? R : (Switch<T, Rest extends readonly Case[] ? Rest : never, Default>)) : (never)) : Default;
75
+ /**
76
+ * Switch type that uses 'extends' logic instead of 'Same' logic
77
+ *
78
+ * ### Examples
79
+ * ```ts
80
+ * type Result = SwitchExtends<string | number, [
81
+ * Case<string, 'string type'>,
82
+ * Case<number, 'number type'>,
83
+ * ], 'other'>
84
+ * // Result: 'string type' | 'number type'
85
+ * ```
86
+ */
87
+ export type SwitchExtends<T, Cases extends readonly Case[], Default = never> = Cases extends [infer First, ...infer Rest] ? (First extends [infer C, infer R] ? ([T] extends [C] ? R : SwitchExtends<T, Rest extends readonly Case[] ? Rest : never, Default>) : never) : Default;
88
+ //# sourceMappingURL=control.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../src/main/control.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAE7C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,EAAE,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,GACzE,CAAC,SAAS,IAAI,GAAG,CAAC,GAClB,CAAC,CAAA;AAEL;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,GAC9E,CAAC,SAAS,KAAK,GAAG,CAAC,GACnB,CAAC,CAAA;AAEL;;;;GAIG;AACH,MAAM,MAAM,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,GAAG,OAAO,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;AAC7D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,CAAA;AAE9B;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,MAAM,CAChB,CAAC,EACD,KAAK,SAAS,SAAS,IAAI,EAAE,EAC7B,OAAO,GAAG,KAAK,IACb,KAAK,SAAS,CAAC,MAAM,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,GAAG,CAC7C,KAAK,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAC5B,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,SAAS,SAAS,IAAI,EAAE,GAAG,IAAI,GAAG,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,GACjG,CAAC,KAAK,CAAC,CACZ,GACC,OAAO,CAAA;AAEX;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,aAAa,CACvB,CAAC,EACD,KAAK,SAAS,SAAS,IAAI,EAAE,EAC7B,OAAO,GAAG,KAAK,IACb,KAAK,SAAS,CAAC,MAAM,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,GAAG,CAC7C,KAAK,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAC5B,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,CAAC,EAAE,IAAI,SAAS,SAAS,IAAI,EAAE,GAAG,IAAI,GAAG,KAAK,EAAE,OAAO,CAAC,CAAC,GAC9F,KAAK,CACV,GACC,OAAO,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=control.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control.js","sourceRoot":"","sources":["../../src/main/control.ts"],"names":[],"mappings":"","sourcesContent":["import type { Same } from './type/compare.js'\n\n/**\n * Conditional type - returns `T` if condition `C` is true, otherwise returns `F`\n *\n * ### Result\n *\n * - `never`: if `C` is `never`\n * - `T`: if `C` is `true`\n * - `F`: if `C` is `false`\n *\n * ### Examples\n *\n * ```ts\n * type Result = If<true, 'yes', 'no'> // 'yes'\n * type Result2 = If<false, 'yes', 'no'> // 'no'\n * type NeverResult = If<never, 'yes', 'no'> // never\n * ```\n */\nexport type If<C extends boolean, T, F = never> = [C] extends [never] ? never\n : C extends true ? T\n : F\n\n/**\n * Conditional type - returns `T` if condition `C` is false, otherwise returns `F`\n *\n * ### Result\n *\n * - `never`: if `C` is `never`\n * - `T`: if `C` is `false`\n * - `F`: if `C` is `true`\n *\n * ### Examples\n *\n * ```ts\n * type Result = IfFalse<false, 'yes', 'no'> // 'yes'\n * type Result2 = IfFalse<true, 'yes', 'no'> // 'no'\n * type NeverResult = IfFalse<never, 'yes', 'no'> // never\n * ```\n */\nexport type IfFalse<C extends boolean, T, F = never> = [C] extends [never] ? never\n : C extends false ? T\n : F\n\n/**\n * Used with:\n * - {@link Switch}\n * - {@link SwitchExtends}\n */\nexport type Case<T = unknown, Return = unknown> = [T, Return]\n/**\n * Used with:\n *\n * - {@link Switch}\n * - {@link SwitchExtends}\n *\n * ### Examples\n *\n * ```ts\n * type NameMap<id> = Switch<id, [\n * Case<1, 'Alice'>,\n * Case<2, 'Bob'>,\n * Case<3, 'Charlie'>,\n * ], DefaultCase<'Steve'>>\n * ```\n */\nexport type DefaultCase<T> = T\n\n/**\n * ### Examples\n *\n * ```ts\n * type Result = Switch<2, [\n * Case<1, 'Alice'>,\n * Case<2, 'Bob'>,\n * Case<3, 'Charlie'>,\n * ], DefaultCase<'Steve'>>\n *\n * // Result: 'Bob'\n * ```\n */\nexport type Switch<\n T,\n Cases extends readonly Case[],\n Default = never,\n> = Cases extends [infer First, ...infer Rest] ? (\n First extends [infer C, infer R]\n ? (Same<T, C> extends true ? R : (Switch<T, Rest extends readonly Case[] ? Rest : never, Default>))\n : (never)\n )\n : Default\n\n/**\n * Switch type that uses 'extends' logic instead of 'Same' logic\n *\n * ### Examples\n * ```ts\n * type Result = SwitchExtends<string | number, [\n * Case<string, 'string type'>,\n * Case<number, 'number type'>,\n * ], 'other'>\n * // Result: 'string type' | 'number type'\n * ```\n */\nexport type SwitchExtends<\n T,\n Cases extends readonly Case[],\n Default = never,\n> = Cases extends [infer First, ...infer Rest] ? (\n First extends [infer C, infer R]\n ? ([T] extends [C] ? R : SwitchExtends<T, Rest extends readonly Case[] ? Rest : never, Default>)\n : never\n )\n : Default\n"]}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Append documentation or auxiliary metadata to type `A`
3
+ * without changing its shape.
4
+ *
5
+ * This type intersects `Doc` onto `A`, but only keeps the keys
6
+ * originally defined in `A`. As a result:
7
+ *
8
+ * - `Doc` cannot introduce new properties
9
+ * - Existing properties in `A` are preserved
10
+ * - `Doc` may further constrain or annotate existing properties
11
+ *
12
+ * This is typically used to attach JSDoc comments, branding,
13
+ * or editor-only metadata to an existing type while keeping
14
+ * its public structure intact.
15
+ */
16
+ export type AppendDoc<T, Doc> = Pick<T & Doc, keyof T>;
17
+ /**
18
+ * Prepend documentation or auxiliary metadata to type `A`
19
+ * without changing its shape.
20
+ *
21
+ * This is similar to {@link AppendDoc}, but the intersection order
22
+ * is reversed (`Doc & A`), which can affect how property types,
23
+ * documentation, and hover information are presented by tooling.
24
+ *
25
+ * In practice, this allows `Doc` to act as a non-invasive,
26
+ * descriptive layer while ensuring `A` remains the authoritative
27
+ * source of truth for property types.
28
+ */
29
+ export type PrependDoc<T, Doc> = Pick<Doc & T, keyof T>;
30
+ //# sourceMappingURL=doc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doc.d.ts","sourceRoot":"","sources":["../../src/main/doc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,GAAG,IAAI,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,CAAC,CAAC,CAAA;AAEtD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,EAAE,GAAG,IAAI,IAAI,CAAC,GAAG,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=doc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doc.js","sourceRoot":"","sources":["../../src/main/doc.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Append documentation or auxiliary metadata to type `A`\n * without changing its shape.\n *\n * This type intersects `Doc` onto `A`, but only keeps the keys\n * originally defined in `A`. As a result:\n *\n * - `Doc` cannot introduce new properties\n * - Existing properties in `A` are preserved\n * - `Doc` may further constrain or annotate existing properties\n *\n * This is typically used to attach JSDoc comments, branding,\n * or editor-only metadata to an existing type while keeping\n * its public structure intact.\n */\nexport type AppendDoc<T, Doc> = Pick<T & Doc, keyof T>\n\n/**\n * Prepend documentation or auxiliary metadata to type `A`\n * without changing its shape.\n *\n * This is similar to {@link AppendDoc}, but the intersection order\n * is reversed (`Doc & A`), which can affect how property types,\n * documentation, and hover information are presented by tooling.\n *\n * In practice, this allows `Doc` to act as a non-invasive,\n * descriptive layer while ensuring `A` remains the authoritative\n * source of truth for property types.\n */\nexport type PrependDoc<T, Doc> = Pick<Doc & T, keyof T>\n"]}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Represents a function with any parameters and a specific return type
3
+ *
4
+ * ### Examples
5
+ *
6
+ * ```ts
7
+ * type _ = AnyFunction<string, [number]> // (arg: number) => string
8
+ * ```
9
+ */
10
+ export type AnyFunction<Return = any, Params extends any[] = any[]> = (...args: Params) => Return;
11
+ /**
12
+ * Represents a constructor with any parameters and a specific return type
13
+ *
14
+ * ### Examples
15
+ *
16
+ * ```ts
17
+ * type _ = Constructor<string, [number]> // new (arg: number) => string
18
+ * ```
19
+ */
20
+ export type Constructor<Return = any, Params extends any[] = any[]> = new (...args: Params) => Return;
21
+ //# sourceMappingURL=function.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../src/main/function.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,CACrB,MAAM,GAAG,GAAG,EACZ,MAAM,SAAS,GAAG,EAAE,GAAG,GAAG,EAAE,IAC1B,CAAC,GAAG,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;AAE/B;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,CACrB,MAAM,GAAG,GAAG,EACZ,MAAM,SAAS,GAAG,EAAE,GAAG,GAAG,EAAE,IAC1B,KAAK,GAAG,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA"}
@@ -0,0 +1,3 @@
1
+ // deno-lint-ignore-file no-explicit-any
2
+ export {};
3
+ //# sourceMappingURL=function.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function.js","sourceRoot":"","sources":["../../src/main/function.ts"],"names":[],"mappings":"AAAA,wCAAwC","sourcesContent":["// deno-lint-ignore-file no-explicit-any\n\n/**\n * Represents a function with any parameters and a specific return type\n *\n * ### Examples\n *\n * ```ts\n * type _ = AnyFunction<string, [number]> // (arg: number) => string\n * ```\n */\nexport type AnyFunction<\n Return = any,\n Params extends any[] = any[],\n> = (...args: Params) => Return\n\n/**\n * Represents a constructor with any parameters and a specific return type\n *\n * ### Examples\n *\n * ```ts\n * type _ = Constructor<string, [number]> // new (arg: number) => string\n * ```\n */\nexport type Constructor<\n Return = any,\n Params extends any[] = any[],\n> = new (...args: Params) => Return\n"]}
@@ -0,0 +1,12 @@
1
+ export * from './array.js';
2
+ export * from './async.js';
3
+ export * from './boolean.js';
4
+ export * from './control.js';
5
+ export * from './doc.js';
6
+ export * from './function.js';
7
+ export * from './json.js';
8
+ export * from './key.js';
9
+ export * from './object.js';
10
+ export * from './type/index.js';
11
+ export * from './typed-array.js';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/main/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,12 @@
1
+ export * from './array.js';
2
+ export * from './async.js';
3
+ export * from './boolean.js';
4
+ export * from './control.js';
5
+ export * from './doc.js';
6
+ export * from './function.js';
7
+ export * from './json.js';
8
+ export * from './key.js';
9
+ export * from './object.js';
10
+ export * from './type/index.js';
11
+ export * from './typed-array.js';
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/main/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA","sourcesContent":["export * from './array.js'\nexport * from './async.js'\nexport * from './boolean.js'\nexport * from './control.js'\nexport * from './doc.js'\nexport * from './function.js'\nexport * from './json.js'\nexport * from './key.js'\nexport * from './object.js'\nexport * from './type/index.js'\nexport * from './typed-array.js'\n"]}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Primitive values allowed by the JSON specification.
3
+ *
4
+ * This represents the set of non-object, non-array values
5
+ * that can appear in valid JSON data.
6
+ */
7
+ export type JsonPrimitive = string | number | boolean | null;
8
+ /**
9
+ * A JSON array.
10
+ *
11
+ * Each element of the array must itself be a valid `JsonValue`.
12
+ */
13
+ export type JsonArray = JsonValue[];
14
+ /**
15
+ * A JSON object.
16
+ *
17
+ * Keys are strings, and values must be valid `JsonValue`s.
18
+ * This mirrors the object structure defined by the JSON specification.
19
+ */
20
+ export type JsonObject = {
21
+ [key: string]: JsonValue;
22
+ };
23
+ /**
24
+ * Any valid JSON value.
25
+ *
26
+ * This is a strict representation of JSON data, suitable for
27
+ * describing the result of `JSON.parse`, serialized payloads,
28
+ * or schema-level JSON structures.
29
+ */
30
+ export type JsonValue = JsonPrimitive | JsonArray | JsonObject;
31
+ /**
32
+ * A JavaScript value that can be safely serialized to JSON.
33
+ *
34
+ * Unlike `JsonValue`, this type represents values *before*
35
+ * serialization, describing the set of recursive structures
36
+ * that `JSON.stringify` can handle.
37
+ *
38
+ * This is useful for constraining inputs that are expected to
39
+ * be JSON-serializable, rather than already being JSON data.
40
+ */
41
+ export type Jsonable = string | number | boolean | null | Jsonable[] | {
42
+ [key: string]: Jsonable;
43
+ };
44
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/main/json.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;AAE5D;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,EAAE,CAAA;AAEnC;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAA;AAErD;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,UAAU,CAAA;AAE9D;;;;;;;;;GASG;AACH,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,QAAQ,EAAE,GACV;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAA;CAAE,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/main/json.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Primitive values allowed by the JSON specification.\n *\n * This represents the set of non-object, non-array values\n * that can appear in valid JSON data.\n */\nexport type JsonPrimitive = string | number | boolean | null\n\n/**\n * A JSON array.\n *\n * Each element of the array must itself be a valid `JsonValue`.\n */\nexport type JsonArray = JsonValue[]\n\n/**\n * A JSON object.\n *\n * Keys are strings, and values must be valid `JsonValue`s.\n * This mirrors the object structure defined by the JSON specification.\n */\nexport type JsonObject = { [key: string]: JsonValue }\n\n/**\n * Any valid JSON value.\n *\n * This is a strict representation of JSON data, suitable for\n * describing the result of `JSON.parse`, serialized payloads,\n * or schema-level JSON structures.\n */\nexport type JsonValue = JsonPrimitive | JsonArray | JsonObject\n\n/**\n * A JavaScript value that can be safely serialized to JSON.\n *\n * Unlike `JsonValue`, this type represents values *before*\n * serialization, describing the set of recursive structures\n * that `JSON.stringify` can handle.\n *\n * This is useful for constraining inputs that are expected to\n * be JSON-serializable, rather than already being JSON data.\n */\nexport type Jsonable =\n | string\n | number\n | boolean\n | null\n | Jsonable[]\n | { [key: string]: Jsonable }\n"]}
@@ -0,0 +1,26 @@
1
+ import type { Same } from './type/index.js';
2
+ /**
3
+ * Extracts the keys of type T that have values of type U
4
+ *
5
+ * ### Examples
6
+ *
7
+ * ```ts
8
+ * type A = { a: 1; b: 2; c: 1 }
9
+ * type Keys = KeysOfType<A, 1> // 'a' | 'c'
10
+ * ```
11
+ */
12
+ export type KeysOfType<T, U> = Exclude<{
13
+ [K in keyof T]: Same<T[K], U> extends true ? K : never;
14
+ }[keyof T], undefined>;
15
+ /**
16
+ * Extracts the keys of type T that do not have values of type U
17
+ *
18
+ * ### Examples
19
+ *
20
+ * ```ts
21
+ * type A = { a: 1; b: 2; c: 1 }
22
+ * type Keys = KeysOfOtherType<A, 1> // 'b'
23
+ * ```
24
+ */
25
+ export type KeysOfOtherType<T, U> = Exclude<keyof T, KeysOfType<T, U>>;
26
+ //# sourceMappingURL=key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"key.d.ts","sourceRoot":"","sources":["../../src/main/key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAE3C;;;;;;;;;GASG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,EAAE,CAAC,IAAI,OAAO,CAAC;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,GAAG,KAAK;CAAE,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,CAAA;AAEtH;;;;;;;;;GASG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=key.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"key.js","sourceRoot":"","sources":["../../src/main/key.ts"],"names":[],"mappings":"","sourcesContent":["import type { Same } from './type/index.js'\n\n/**\n * Extracts the keys of type T that have values of type U\n *\n * ### Examples\n *\n * ```ts\n * type A = { a: 1; b: 2; c: 1 }\n * type Keys = KeysOfType<A, 1> // 'a' | 'c'\n * ```\n */\nexport type KeysOfType<T, U> = Exclude<{ [K in keyof T]: Same<T[K], U> extends true ? K : never }[keyof T], undefined>\n\n/**\n * Extracts the keys of type T that do not have values of type U\n *\n * ### Examples\n *\n * ```ts\n * type A = { a: 1; b: 2; c: 1 }\n * type Keys = KeysOfOtherType<A, 1> // 'b'\n * ```\n */\nexport type KeysOfOtherType<T, U> = Exclude<keyof T, KeysOfType<T, U>>\n"]}