typetify 0.1.1

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 (185) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +327 -0
  3. package/dist/async/index.d.mts +152 -0
  4. package/dist/async/index.d.ts +152 -0
  5. package/dist/async/index.js +49 -0
  6. package/dist/async/index.js.map +1 -0
  7. package/dist/async/index.mjs +4 -0
  8. package/dist/async/index.mjs.map +1 -0
  9. package/dist/chunk-2LJ6NZ6K.js +108 -0
  10. package/dist/chunk-2LJ6NZ6K.js.map +1 -0
  11. package/dist/chunk-44Y5JSGU.js +145 -0
  12. package/dist/chunk-44Y5JSGU.js.map +1 -0
  13. package/dist/chunk-4NXETABV.mjs +116 -0
  14. package/dist/chunk-4NXETABV.mjs.map +1 -0
  15. package/dist/chunk-6ZBTL74K.js +129 -0
  16. package/dist/chunk-6ZBTL74K.js.map +1 -0
  17. package/dist/chunk-CN3GYRJN.mjs +137 -0
  18. package/dist/chunk-CN3GYRJN.mjs.map +1 -0
  19. package/dist/chunk-CNTE6ZVH.js +359 -0
  20. package/dist/chunk-CNTE6ZVH.js.map +1 -0
  21. package/dist/chunk-DBENOSTA.js +156 -0
  22. package/dist/chunk-DBENOSTA.js.map +1 -0
  23. package/dist/chunk-DWIG5GF2.js +135 -0
  24. package/dist/chunk-DWIG5GF2.js.map +1 -0
  25. package/dist/chunk-EAUTTWTQ.mjs +231 -0
  26. package/dist/chunk-EAUTTWTQ.mjs.map +1 -0
  27. package/dist/chunk-FXWYPHA3.mjs +13 -0
  28. package/dist/chunk-FXWYPHA3.mjs.map +1 -0
  29. package/dist/chunk-GS3PP67B.js +200 -0
  30. package/dist/chunk-GS3PP67B.js.map +1 -0
  31. package/dist/chunk-J5LGTIGS.mjs +9 -0
  32. package/dist/chunk-J5LGTIGS.mjs.map +1 -0
  33. package/dist/chunk-JAOGY4JO.mjs +1007 -0
  34. package/dist/chunk-JAOGY4JO.mjs.map +1 -0
  35. package/dist/chunk-JB6UXRKD.mjs +97 -0
  36. package/dist/chunk-JB6UXRKD.mjs.map +1 -0
  37. package/dist/chunk-JQHUBZ4M.js +88 -0
  38. package/dist/chunk-JQHUBZ4M.js.map +1 -0
  39. package/dist/chunk-L3M7LGKL.mjs +128 -0
  40. package/dist/chunk-L3M7LGKL.mjs.map +1 -0
  41. package/dist/chunk-LT7JK7RJ.js +87 -0
  42. package/dist/chunk-LT7JK7RJ.js.map +1 -0
  43. package/dist/chunk-OEJK37LO.mjs +328 -0
  44. package/dist/chunk-OEJK37LO.mjs.map +1 -0
  45. package/dist/chunk-OPVES6W2.js +16 -0
  46. package/dist/chunk-OPVES6W2.js.map +1 -0
  47. package/dist/chunk-OWNUKWXV.js +291 -0
  48. package/dist/chunk-OWNUKWXV.js.map +1 -0
  49. package/dist/chunk-PQTXSQ4P.js +369 -0
  50. package/dist/chunk-PQTXSQ4P.js.map +1 -0
  51. package/dist/chunk-PZ5AY32C.js +11 -0
  52. package/dist/chunk-PZ5AY32C.js.map +1 -0
  53. package/dist/chunk-QFR7DVAJ.mjs +63 -0
  54. package/dist/chunk-QFR7DVAJ.mjs.map +1 -0
  55. package/dist/chunk-SGQNLTRK.js +73 -0
  56. package/dist/chunk-SGQNLTRK.js.map +1 -0
  57. package/dist/chunk-SIA5BSVY.js +1054 -0
  58. package/dist/chunk-SIA5BSVY.js.map +1 -0
  59. package/dist/chunk-SRDWUHDY.mjs +188 -0
  60. package/dist/chunk-SRDWUHDY.mjs.map +1 -0
  61. package/dist/chunk-TXU7NTT4.js +249 -0
  62. package/dist/chunk-TXU7NTT4.js.map +1 -0
  63. package/dist/chunk-TZEWREAC.mjs +277 -0
  64. package/dist/chunk-TZEWREAC.mjs.map +1 -0
  65. package/dist/chunk-V6CWFDIJ.mjs +123 -0
  66. package/dist/chunk-V6CWFDIJ.mjs.map +1 -0
  67. package/dist/chunk-YBJC5WMX.mjs +341 -0
  68. package/dist/chunk-YBJC5WMX.mjs.map +1 -0
  69. package/dist/chunk-YOPAXITF.mjs +75 -0
  70. package/dist/chunk-YOPAXITF.mjs.map +1 -0
  71. package/dist/chunk-ZE4FDBRI.mjs +79 -0
  72. package/dist/chunk-ZE4FDBRI.mjs.map +1 -0
  73. package/dist/collection/index.d.mts +291 -0
  74. package/dist/collection/index.d.ts +291 -0
  75. package/dist/collection/index.js +125 -0
  76. package/dist/collection/index.js.map +1 -0
  77. package/dist/collection/index.mjs +4 -0
  78. package/dist/collection/index.mjs.map +1 -0
  79. package/dist/core/index.d.mts +85 -0
  80. package/dist/core/index.d.ts +85 -0
  81. package/dist/core/index.js +41 -0
  82. package/dist/core/index.js.map +1 -0
  83. package/dist/core/index.mjs +4 -0
  84. package/dist/core/index.mjs.map +1 -0
  85. package/dist/decorator/index.d.mts +165 -0
  86. package/dist/decorator/index.d.ts +165 -0
  87. package/dist/decorator/index.js +57 -0
  88. package/dist/decorator/index.js.map +1 -0
  89. package/dist/decorator/index.mjs +4 -0
  90. package/dist/decorator/index.mjs.map +1 -0
  91. package/dist/dx/index.d.mts +125 -0
  92. package/dist/dx/index.d.ts +125 -0
  93. package/dist/dx/index.js +53 -0
  94. package/dist/dx/index.js.map +1 -0
  95. package/dist/dx/index.mjs +4 -0
  96. package/dist/dx/index.mjs.map +1 -0
  97. package/dist/flow/index.d.mts +165 -0
  98. package/dist/flow/index.d.ts +165 -0
  99. package/dist/flow/index.js +50 -0
  100. package/dist/flow/index.js.map +1 -0
  101. package/dist/flow/index.mjs +5 -0
  102. package/dist/flow/index.mjs.map +1 -0
  103. package/dist/fn/index.d.mts +77 -0
  104. package/dist/fn/index.d.ts +77 -0
  105. package/dist/fn/index.js +37 -0
  106. package/dist/fn/index.js.map +1 -0
  107. package/dist/fn/index.mjs +4 -0
  108. package/dist/fn/index.mjs.map +1 -0
  109. package/dist/guards/index.d.mts +165 -0
  110. package/dist/guards/index.d.ts +165 -0
  111. package/dist/guards/index.js +69 -0
  112. package/dist/guards/index.js.map +1 -0
  113. package/dist/guards/index.mjs +4 -0
  114. package/dist/guards/index.mjs.map +1 -0
  115. package/dist/index.d.mts +228 -0
  116. package/dist/index.d.ts +228 -0
  117. package/dist/index.js +775 -0
  118. package/dist/index.js.map +1 -0
  119. package/dist/index.mjs +51 -0
  120. package/dist/index.mjs.map +1 -0
  121. package/dist/input/index.d.mts +185 -0
  122. package/dist/input/index.d.ts +185 -0
  123. package/dist/input/index.js +74 -0
  124. package/dist/input/index.js.map +1 -0
  125. package/dist/input/index.mjs +5 -0
  126. package/dist/input/index.mjs.map +1 -0
  127. package/dist/iterator/index.d.mts +209 -0
  128. package/dist/iterator/index.d.ts +209 -0
  129. package/dist/iterator/index.js +522 -0
  130. package/dist/iterator/index.js.map +1 -0
  131. package/dist/iterator/index.mjs +502 -0
  132. package/dist/iterator/index.mjs.map +1 -0
  133. package/dist/logic/index.d.mts +531 -0
  134. package/dist/logic/index.d.ts +531 -0
  135. package/dist/logic/index.js +416 -0
  136. package/dist/logic/index.js.map +1 -0
  137. package/dist/logic/index.mjs +367 -0
  138. package/dist/logic/index.mjs.map +1 -0
  139. package/dist/math/index.d.mts +86 -0
  140. package/dist/math/index.d.ts +86 -0
  141. package/dist/math/index.js +45 -0
  142. package/dist/math/index.js.map +1 -0
  143. package/dist/math/index.mjs +4 -0
  144. package/dist/math/index.mjs.map +1 -0
  145. package/dist/narrowing/index.d.mts +429 -0
  146. package/dist/narrowing/index.d.ts +429 -0
  147. package/dist/narrowing/index.js +220 -0
  148. package/dist/narrowing/index.js.map +1 -0
  149. package/dist/narrowing/index.mjs +186 -0
  150. package/dist/narrowing/index.mjs.map +1 -0
  151. package/dist/object/index.d.mts +327 -0
  152. package/dist/object/index.d.ts +327 -0
  153. package/dist/object/index.js +113 -0
  154. package/dist/object/index.js.map +1 -0
  155. package/dist/object/index.mjs +4 -0
  156. package/dist/object/index.mjs.map +1 -0
  157. package/dist/result/index.d.mts +201 -0
  158. package/dist/result/index.d.ts +201 -0
  159. package/dist/result/index.js +86 -0
  160. package/dist/result/index.js.map +1 -0
  161. package/dist/result/index.mjs +5 -0
  162. package/dist/result/index.mjs.map +1 -0
  163. package/dist/schema/index.d.mts +216 -0
  164. package/dist/schema/index.d.ts +216 -0
  165. package/dist/schema/index.js +410 -0
  166. package/dist/schema/index.js.map +1 -0
  167. package/dist/schema/index.mjs +384 -0
  168. package/dist/schema/index.mjs.map +1 -0
  169. package/dist/string/index.d.mts +102 -0
  170. package/dist/string/index.d.ts +102 -0
  171. package/dist/string/index.js +49 -0
  172. package/dist/string/index.js.map +1 -0
  173. package/dist/string/index.mjs +4 -0
  174. package/dist/string/index.mjs.map +1 -0
  175. package/dist/typed/index.d.mts +1962 -0
  176. package/dist/typed/index.d.ts +1962 -0
  177. package/dist/typed/index.js +193 -0
  178. package/dist/typed/index.js.map +1 -0
  179. package/dist/typed/index.mjs +4 -0
  180. package/dist/typed/index.mjs.map +1 -0
  181. package/dist/types-Db0vauC3.d.mts +258 -0
  182. package/dist/types-Db0vauC3.d.ts +258 -0
  183. package/dist/types-VsDp2t8s.d.mts +30 -0
  184. package/dist/types-VsDp2t8s.d.ts +30 -0
  185. package/package.json +157 -0
@@ -0,0 +1,193 @@
1
+ 'use strict';
2
+
3
+ var chunkSIA5BSVY_js = require('../chunk-SIA5BSVY.js');
4
+ require('../chunk-PZ5AY32C.js');
5
+
6
+
7
+
8
+ Object.defineProperty(exports, "assertTypeDebug", {
9
+ enumerable: true,
10
+ get: function () { return chunkSIA5BSVY_js.assertType; }
11
+ });
12
+ Object.defineProperty(exports, "asyncData", {
13
+ enumerable: true,
14
+ get: function () { return chunkSIA5BSVY_js.asyncData; }
15
+ });
16
+ Object.defineProperty(exports, "brand", {
17
+ enumerable: true,
18
+ get: function () { return chunkSIA5BSVY_js.brand; }
19
+ });
20
+ Object.defineProperty(exports, "collection", {
21
+ enumerable: true,
22
+ get: function () { return chunkSIA5BSVY_js.collection; }
23
+ });
24
+ Object.defineProperty(exports, "collectionWithId", {
25
+ enumerable: true,
26
+ get: function () { return chunkSIA5BSVY_js.collectionWithId; }
27
+ });
28
+ Object.defineProperty(exports, "createActions", {
29
+ enumerable: true,
30
+ get: function () { return chunkSIA5BSVY_js.createActions; }
31
+ });
32
+ Object.defineProperty(exports, "createBuilder", {
33
+ enumerable: true,
34
+ get: function () { return chunkSIA5BSVY_js.createBuilder; }
35
+ });
36
+ Object.defineProperty(exports, "createCollection", {
37
+ enumerable: true,
38
+ get: function () { return chunkSIA5BSVY_js.createCollection; }
39
+ });
40
+ Object.defineProperty(exports, "createMap", {
41
+ enumerable: true,
42
+ get: function () { return chunkSIA5BSVY_js.createMap; }
43
+ });
44
+ Object.defineProperty(exports, "createMatcher", {
45
+ enumerable: true,
46
+ get: function () { return chunkSIA5BSVY_js.createMatcher; }
47
+ });
48
+ Object.defineProperty(exports, "createReducer", {
49
+ enumerable: true,
50
+ get: function () { return chunkSIA5BSVY_js.createReducer; }
51
+ });
52
+ Object.defineProperty(exports, "createSet", {
53
+ enumerable: true,
54
+ get: function () { return chunkSIA5BSVY_js.createSet; }
55
+ });
56
+ Object.defineProperty(exports, "createTypedEmitter", {
57
+ enumerable: true,
58
+ get: function () { return chunkSIA5BSVY_js.createTypedEmitter; }
59
+ });
60
+ Object.defineProperty(exports, "deepMergeFn", {
61
+ enumerable: true,
62
+ get: function () { return chunkSIA5BSVY_js.deepMerge; }
63
+ });
64
+ Object.defineProperty(exports, "defineConst", {
65
+ enumerable: true,
66
+ get: function () { return chunkSIA5BSVY_js.defineConst; }
67
+ });
68
+ Object.defineProperty(exports, "defineEnum", {
69
+ enumerable: true,
70
+ get: function () { return chunkSIA5BSVY_js.defineEnum; }
71
+ });
72
+ Object.defineProperty(exports, "defineModel", {
73
+ enumerable: true,
74
+ get: function () { return chunkSIA5BSVY_js.defineModel; }
75
+ });
76
+ Object.defineProperty(exports, "defineStateMachine", {
77
+ enumerable: true,
78
+ get: function () { return chunkSIA5BSVY_js.defineStateMachine; }
79
+ });
80
+ Object.defineProperty(exports, "defineTuple", {
81
+ enumerable: true,
82
+ get: function () { return chunkSIA5BSVY_js.defineTuple; }
83
+ });
84
+ Object.defineProperty(exports, "formState", {
85
+ enumerable: true,
86
+ get: function () { return chunkSIA5BSVY_js.formState; }
87
+ });
88
+ Object.defineProperty(exports, "fromEntries", {
89
+ enumerable: true,
90
+ get: function () { return chunkSIA5BSVY_js.fromEntries; }
91
+ });
92
+ Object.defineProperty(exports, "identityTyped", {
93
+ enumerable: true,
94
+ get: function () { return chunkSIA5BSVY_js.identity; }
95
+ });
96
+ Object.defineProperty(exports, "impossible", {
97
+ enumerable: true,
98
+ get: function () { return chunkSIA5BSVY_js.impossible; }
99
+ });
100
+ Object.defineProperty(exports, "mapKeys", {
101
+ enumerable: true,
102
+ get: function () { return chunkSIA5BSVY_js.mapKeys; }
103
+ });
104
+ Object.defineProperty(exports, "mapValues", {
105
+ enumerable: true,
106
+ get: function () { return chunkSIA5BSVY_js.mapValues; }
107
+ });
108
+ Object.defineProperty(exports, "match", {
109
+ enumerable: true,
110
+ get: function () { return chunkSIA5BSVY_js.match; }
111
+ });
112
+ Object.defineProperty(exports, "matchUnion", {
113
+ enumerable: true,
114
+ get: function () { return chunkSIA5BSVY_js.matchUnion; }
115
+ });
116
+ Object.defineProperty(exports, "matchValue", {
117
+ enumerable: true,
118
+ get: function () { return chunkSIA5BSVY_js.matchValue; }
119
+ });
120
+ Object.defineProperty(exports, "merge", {
121
+ enumerable: true,
122
+ get: function () { return chunkSIA5BSVY_js.merge; }
123
+ });
124
+ Object.defineProperty(exports, "mergeAllFn", {
125
+ enumerable: true,
126
+ get: function () { return chunkSIA5BSVY_js.mergeAll; }
127
+ });
128
+ Object.defineProperty(exports, "mergeModels", {
129
+ enumerable: true,
130
+ get: function () { return chunkSIA5BSVY_js.mergeModels; }
131
+ });
132
+ Object.defineProperty(exports, "mergeWith", {
133
+ enumerable: true,
134
+ get: function () { return chunkSIA5BSVY_js.mergeWith; }
135
+ });
136
+ Object.defineProperty(exports, "modalState", {
137
+ enumerable: true,
138
+ get: function () { return chunkSIA5BSVY_js.modalState; }
139
+ });
140
+ Object.defineProperty(exports, "model", {
141
+ enumerable: true,
142
+ get: function () { return chunkSIA5BSVY_js.model; }
143
+ });
144
+ Object.defineProperty(exports, "narrow", {
145
+ enumerable: true,
146
+ get: function () { return chunkSIA5BSVY_js.narrow; }
147
+ });
148
+ Object.defineProperty(exports, "narrowTyped", {
149
+ enumerable: true,
150
+ get: function () { return chunkSIA5BSVY_js.narrow2; }
151
+ });
152
+ Object.defineProperty(exports, "omitModel", {
153
+ enumerable: true,
154
+ get: function () { return chunkSIA5BSVY_js.omitModel; }
155
+ });
156
+ Object.defineProperty(exports, "omitTyped", {
157
+ enumerable: true,
158
+ get: function () { return chunkSIA5BSVY_js.omit; }
159
+ });
160
+ Object.defineProperty(exports, "persistentCollection", {
161
+ enumerable: true,
162
+ get: function () { return chunkSIA5BSVY_js.persistentCollection; }
163
+ });
164
+ Object.defineProperty(exports, "pickModel", {
165
+ enumerable: true,
166
+ get: function () { return chunkSIA5BSVY_js.pickModel; }
167
+ });
168
+ Object.defineProperty(exports, "pickTyped", {
169
+ enumerable: true,
170
+ get: function () { return chunkSIA5BSVY_js.pick; }
171
+ });
172
+ Object.defineProperty(exports, "renameKeys", {
173
+ enumerable: true,
174
+ get: function () { return chunkSIA5BSVY_js.renameKeys; }
175
+ });
176
+ Object.defineProperty(exports, "showType", {
177
+ enumerable: true,
178
+ get: function () { return chunkSIA5BSVY_js.showType; }
179
+ });
180
+ Object.defineProperty(exports, "t", {
181
+ enumerable: true,
182
+ get: function () { return chunkSIA5BSVY_js.t; }
183
+ });
184
+ Object.defineProperty(exports, "undoable", {
185
+ enumerable: true,
186
+ get: function () { return chunkSIA5BSVY_js.undoable; }
187
+ });
188
+ Object.defineProperty(exports, "v", {
189
+ enumerable: true,
190
+ get: function () { return chunkSIA5BSVY_js.v; }
191
+ });
192
+ //# sourceMappingURL=index.js.map
193
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,4 @@
1
+ export { assertType as assertTypeDebug, asyncData, brand, collection, collectionWithId, createActions, createBuilder, createCollection, createMap, createMatcher, createReducer, createSet, createTypedEmitter, deepMerge as deepMergeFn, defineConst, defineEnum, defineModel, defineStateMachine, defineTuple, formState, fromEntries, identity as identityTyped, impossible, mapKeys, mapValues, match, matchUnion, matchValue, merge, mergeAll as mergeAllFn, mergeModels, mergeWith, modalState, model, narrow, narrow2 as narrowTyped, omitModel, omit as omitTyped, persistentCollection, pickModel, pick as pickTyped, renameKeys, showType, t, undoable, v } from '../chunk-JAOGY4JO.mjs';
2
+ import '../chunk-J5LGTIGS.mjs';
3
+ //# sourceMappingURL=index.mjs.map
4
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
@@ -0,0 +1,258 @@
1
+ /**
2
+ * Creates a readonly constant with inferred literal type.
3
+ * Useful for defining constants that TypeScript will narrow.
4
+ *
5
+ * @example
6
+ * const STATUS = defineConst({
7
+ * PENDING: 'pending',
8
+ * ACTIVE: 'active',
9
+ * DONE: 'done',
10
+ * })
11
+ * // typeof STATUS.PENDING = 'pending' (not string)
12
+ */
13
+ declare function defineConst<T extends Record<string, unknown>>(obj: T): Readonly<T>;
14
+
15
+ /**
16
+ * Creates an enum-like object with proper typing.
17
+ * Values are the same as keys.
18
+ *
19
+ * @example
20
+ * const Status = defineEnum(['pending', 'active', 'done'] as const)
21
+ * // Status.pending = 'pending'
22
+ * // type StatusValue = 'pending' | 'active' | 'done'
23
+ */
24
+ declare function defineEnum<T extends readonly string[]>(values: T): {
25
+ readonly [K in T[number]]: K;
26
+ };
27
+ /**
28
+ * Extracts the value type from a defineEnum result.
29
+ *
30
+ * @example
31
+ * const Status = defineEnum(['pending', 'active', 'done'] as const)
32
+ * type StatusValue = EnumValue<typeof Status> // 'pending' | 'active' | 'done'
33
+ */
34
+ type EnumValue<T extends Record<string, string>> = T[keyof T];
35
+
36
+ /**
37
+ * Creates a tuple with inferred literal types.
38
+ * Useful when you need a tuple type without using 'as const'.
39
+ *
40
+ * @example
41
+ * const coords = defineTuple(10, 20, 30)
42
+ * // type: [number, number, number]
43
+ *
44
+ * const status = defineTuple('pending', 'active', 'done')
45
+ * // type: ['pending', 'active', 'done']
46
+ */
47
+ declare function defineTuple<T extends readonly unknown[]>(...args: T): T;
48
+
49
+ /**
50
+ * Creates a type-safe Map with inferred key and value types.
51
+ *
52
+ * @example
53
+ * const userMap = createMap<number, { name: string }>()
54
+ * userMap.set(1, { name: 'John' })
55
+ * const user = userMap.get(1) // { name: string } | undefined
56
+ */
57
+ declare function createMap<K, V>(entries?: readonly (readonly [K, V])[]): Map<K, V>;
58
+
59
+ /**
60
+ * Creates a type-safe Set with inferred value type.
61
+ *
62
+ * @example
63
+ * const ids = createSet<number>()
64
+ * ids.add(1)
65
+ * ids.has(1) // true
66
+ */
67
+ declare function createSet<T>(values?: readonly T[]): Set<T>;
68
+
69
+ declare const __brand: unique symbol;
70
+ /**
71
+ * Creates a branded type. Branded types are structurally identical
72
+ * but nominally different, preventing accidental mixing.
73
+ *
74
+ * @example
75
+ * type UserId = Brand<number, 'UserId'>
76
+ * type PostId = Brand<number, 'PostId'>
77
+ *
78
+ * const userId = 1 as UserId
79
+ * const postId = 2 as PostId
80
+ *
81
+ * function getUser(id: UserId) { ... }
82
+ * getUser(userId) // OK
83
+ * getUser(postId) // Error!
84
+ */
85
+ type Brand<T, B extends string> = T & {
86
+ readonly [__brand]: B;
87
+ };
88
+ /**
89
+ * Creates a branded value.
90
+ *
91
+ * @example
92
+ * type UserId = Brand<number, 'UserId'>
93
+ * const userId = brand<UserId>(1)
94
+ */
95
+ declare function brand<T extends Brand<unknown, string>>(value: T extends Brand<infer U, string> ? U : never): T;
96
+
97
+ /**
98
+ * Narrows a value to a specific type using a type guard.
99
+ * Returns the value if it passes the guard, undefined otherwise.
100
+ *
101
+ * @example
102
+ * const value: unknown = 'hello'
103
+ * const str = narrow(value, isString)
104
+ * // str is string | undefined
105
+ */
106
+ declare function narrow<T, U extends T>(value: T, guard: (value: T) => value is U): U | undefined;
107
+
108
+ /**
109
+ * Makes all properties of T optional recursively.
110
+ */
111
+ type DeepPartial<T> = T extends object ? {
112
+ [P in keyof T]?: DeepPartial<T[P]>;
113
+ } : T;
114
+ /**
115
+ * Makes all properties of T readonly recursively.
116
+ */
117
+ type DeepReadonly<T> = T extends object ? {
118
+ readonly [P in keyof T]: DeepReadonly<T[P]>;
119
+ } : T;
120
+ /**
121
+ * Makes all properties of T required recursively.
122
+ */
123
+ type DeepRequired<T> = T extends object ? {
124
+ [P in keyof T]-?: DeepRequired<T[P]>;
125
+ } : T;
126
+ /**
127
+ * Extracts the element type from an array.
128
+ */
129
+ type ElementOf<T> = T extends readonly (infer E)[] ? E : never;
130
+ /**
131
+ * Makes specified keys required.
132
+ */
133
+ type RequireKeys<T, K extends keyof T> = T & Required<Pick<T, K>>;
134
+ /**
135
+ * Makes specified keys optional.
136
+ */
137
+ type OptionalKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
138
+ /**
139
+ * Extracts keys of T that have values of type V.
140
+ */
141
+ type KeysOfType<T, V> = {
142
+ [K in keyof T]: T[K] extends V ? K : never;
143
+ }[keyof T];
144
+ /**
145
+ * Makes a type mutable (removes readonly).
146
+ */
147
+ type Mutable<T> = {
148
+ -readonly [P in keyof T]: T[P];
149
+ };
150
+ /**
151
+ * Extracts the resolved type of a Promise.
152
+ */
153
+ type Awaited<T> = T extends Promise<infer U> ? U : T;
154
+ /**
155
+ * Creates a union of all values in an object.
156
+ */
157
+ type ValueOf<T> = T[keyof T];
158
+ /**
159
+ * Excludes null and undefined from T.
160
+ */
161
+ type NonNullableDeep<T> = T extends object ? {
162
+ [P in keyof T]: NonNullableDeep<NonNullable<T[P]>>;
163
+ } : NonNullable<T>;
164
+ /**
165
+ * Makes the type nullable.
166
+ */
167
+ type Nullable<T> = T | null;
168
+ /**
169
+ * Makes the type optional (can be undefined).
170
+ */
171
+ type Optional<T> = T | undefined;
172
+ /**
173
+ * Merge two types, with the second type overriding the first.
174
+ */
175
+ type Merge<T, U> = Omit<T, keyof U> & U;
176
+ /**
177
+ * Require at least one of the specified keys.
178
+ */
179
+ type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
180
+ [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
181
+ }[Keys];
182
+ /**
183
+ * Require exactly one of the specified keys.
184
+ */
185
+ type RequireExactlyOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
186
+ [K in Keys]-?: Required<Pick<T, K>> & Partial<Record<Exclude<Keys, K>, never>>;
187
+ }[Keys];
188
+ /**
189
+ * Prettify a type for better IntelliSense display.
190
+ * Flattens intersections into a single object type.
191
+ */
192
+ type Prettify<T> = {
193
+ [K in keyof T]: T[K];
194
+ } & {};
195
+ /**
196
+ * Makes specified keys partial while keeping others required.
197
+ */
198
+ type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
199
+ /**
200
+ * Makes specified keys required while keeping others as-is.
201
+ */
202
+ type RequiredBy<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
203
+ /**
204
+ * Converts a union type to an intersection type.
205
+ */
206
+ type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
207
+ /**
208
+ * Extracts the resolved value type from a Promise.
209
+ */
210
+ type PromiseValue<T> = T extends Promise<infer U> ? U : T;
211
+ /**
212
+ * Extracts the element type from an array type.
213
+ */
214
+ type ArrayElement<T> = T extends readonly (infer U)[] ? U : never;
215
+ /**
216
+ * Creates a type that requires all properties to match exactly.
217
+ */
218
+ type Exact<T, Shape> = T extends Shape ? Exclude<keyof T, keyof Shape> extends never ? T : never : never;
219
+ /**
220
+ * Creates a type with all properties set to never.
221
+ */
222
+ type Never<T> = {
223
+ [K in keyof T]?: never;
224
+ };
225
+ /**
226
+ * Makes all properties writable (removes readonly) recursively.
227
+ */
228
+ type DeepMutable<T> = T extends object ? {
229
+ -readonly [P in keyof T]: DeepMutable<T[P]>;
230
+ } : T;
231
+ /**
232
+ * Extracts keys that are required in T.
233
+ */
234
+ type RequiredKeys<T> = {
235
+ [K in keyof T]-?: {} extends Pick<T, K> ? never : K;
236
+ }[keyof T];
237
+ /**
238
+ * Extracts keys that are optional in T.
239
+ */
240
+ type OptionalKeysOf<T> = {
241
+ [K in keyof T]-?: {} extends Pick<T, K> ? K : never;
242
+ }[keyof T];
243
+ /**
244
+ * Creates a type where at least one property must be defined.
245
+ */
246
+ type AtLeastOne<T> = {
247
+ [K in keyof T]: Pick<T, K> & Partial<Omit<T, K>>;
248
+ }[keyof T];
249
+ /**
250
+ * Creates a record type with string keys and values of type T.
251
+ */
252
+ type Dictionary<T> = Record<string, T>;
253
+ /**
254
+ * Creates a readonly record type.
255
+ */
256
+ type ReadonlyDictionary<T> = Readonly<Record<string, T>>;
257
+
258
+ export { type ArrayElement as A, type Brand as B, type RequiredKeys as C, type DeepPartial as D, type ElementOf as E, type KeysOfType as K, type Merge as M, type NonNullableDeep as N, type Optional as O, type PartialBy as P, type ReadonlyDictionary as R, type UnionToIntersection as U, type ValueOf as V, type Awaited as a, type DeepReadonly as b, type DeepRequired as c, type Dictionary as d, type EnumValue as e, type Mutable as f, type Nullable as g, type OptionalKeys as h, type Prettify as i, type PromiseValue as j, type RequireAtLeastOne as k, type RequireExactlyOne as l, type RequireKeys as m, type RequiredBy as n, brand as o, createMap as p, createSet as q, defineConst as r, defineEnum as s, defineTuple as t, narrow as u, type AtLeastOne as v, type DeepMutable as w, type Exact as x, type Never as y, type OptionalKeysOf as z };