@sinclair/typebox 0.33.19 → 0.33.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/build/cjs/index.d.ts +1 -0
  2. package/build/cjs/index.js +5 -1
  3. package/build/cjs/parse/index.d.ts +1 -0
  4. package/build/cjs/parse/index.js +18 -0
  5. package/build/cjs/parse/parse.d.ts +11 -0
  6. package/build/cjs/parse/parse.js +18 -0
  7. package/build/cjs/parse/parsebox/index.d.ts +2 -0
  8. package/build/cjs/parse/parsebox/index.js +6 -0
  9. package/build/cjs/parse/parsebox/runtime/guard.d.ts +17 -0
  10. package/build/cjs/parse/parsebox/runtime/guard.js +75 -0
  11. package/build/cjs/parse/parsebox/runtime/index.d.ts +5 -0
  12. package/build/cjs/parse/parsebox/runtime/index.js +23 -0
  13. package/build/cjs/parse/parsebox/runtime/module.d.ts +9 -0
  14. package/build/cjs/parse/parsebox/runtime/module.js +22 -0
  15. package/build/cjs/parse/parsebox/runtime/parse.d.ts +9 -0
  16. package/build/cjs/parse/parsebox/runtime/parse.js +99 -0
  17. package/build/cjs/parse/parsebox/runtime/token.d.ts +8 -0
  18. package/build/cjs/parse/parsebox/runtime/token.js +230 -0
  19. package/build/cjs/parse/parsebox/runtime/types.d.ts +68 -0
  20. package/build/cjs/parse/parsebox/runtime/types.js +45 -0
  21. package/build/cjs/parse/parsebox/static/index.d.ts +3 -0
  22. package/build/cjs/parse/parsebox/static/index.js +21 -0
  23. package/build/cjs/parse/parsebox/static/parse.d.ts +17 -0
  24. package/build/cjs/parse/parsebox/static/parse.js +3 -0
  25. package/build/cjs/parse/parsebox/static/token.d.ts +108 -0
  26. package/build/cjs/parse/parsebox/static/token.js +3 -0
  27. package/build/cjs/parse/parsebox/static/types.d.ts +46 -0
  28. package/build/cjs/parse/parsebox/static/types.js +3 -0
  29. package/build/cjs/parse/runtime.d.ts +55 -0
  30. package/build/cjs/parse/runtime.js +621 -0
  31. package/build/cjs/parse/static.d.ts +471 -0
  32. package/build/cjs/parse/static.js +3 -0
  33. package/build/esm/index.d.mts +1 -0
  34. package/build/esm/index.mjs +5 -1
  35. package/build/esm/parse/index.d.mts +1 -0
  36. package/build/esm/parse/index.mjs +1 -0
  37. package/build/esm/parse/parse.d.mts +11 -0
  38. package/build/esm/parse/parse.mjs +13 -0
  39. package/build/esm/parse/parsebox/index.d.mts +2 -0
  40. package/build/esm/parse/parsebox/index.mjs +2 -0
  41. package/build/esm/parse/parsebox/runtime/guard.d.mts +17 -0
  42. package/build/esm/parse/parsebox/runtime/guard.mjs +64 -0
  43. package/build/esm/parse/parsebox/runtime/index.d.mts +5 -0
  44. package/build/esm/parse/parsebox/runtime/index.mjs +5 -0
  45. package/build/esm/parse/parsebox/runtime/module.d.mts +9 -0
  46. package/build/esm/parse/parsebox/runtime/module.mjs +17 -0
  47. package/build/esm/parse/parsebox/runtime/parse.d.mts +9 -0
  48. package/build/esm/parse/parsebox/runtime/parse.mjs +95 -0
  49. package/build/esm/parse/parsebox/runtime/token.d.mts +8 -0
  50. package/build/esm/parse/parsebox/runtime/token.mjs +223 -0
  51. package/build/esm/parse/parsebox/runtime/types.d.mts +68 -0
  52. package/build/esm/parse/parsebox/runtime/types.mjs +32 -0
  53. package/build/esm/parse/parsebox/static/index.d.mts +3 -0
  54. package/build/esm/parse/parsebox/static/index.mjs +3 -0
  55. package/build/esm/parse/parsebox/static/parse.d.mts +17 -0
  56. package/build/esm/parse/parsebox/static/parse.mjs +1 -0
  57. package/build/esm/parse/parsebox/static/token.d.mts +108 -0
  58. package/build/esm/parse/parsebox/static/token.mjs +1 -0
  59. package/build/esm/parse/parsebox/static/types.d.mts +46 -0
  60. package/build/esm/parse/parsebox/static/types.mjs +1 -0
  61. package/build/esm/parse/runtime.d.mts +55 -0
  62. package/build/esm/parse/runtime.mjs +617 -0
  63. package/build/esm/parse/static.d.mts +471 -0
  64. package/build/esm/parse/static.mjs +1 -0
  65. package/package.json +11 -1
  66. package/parse/package.json +4 -0
  67. package/readme.md +5 -4
@@ -0,0 +1,471 @@
1
+ import { Static } from './parsebox/index.mjs';
2
+ import * as Types from '../type/index.mjs';
3
+ type Newline = '\n';
4
+ type LBracket = '[';
5
+ type RBracket = ']';
6
+ type LParen = '(';
7
+ type RParen = ')';
8
+ type LBrace = '{';
9
+ type RBrace = '}';
10
+ type LAngle = '<';
11
+ type RAngle = '>';
12
+ type Question = '?';
13
+ type Colon = ':';
14
+ type Comma = ',';
15
+ type SemiColon = ';';
16
+ type SingleQuote = "'";
17
+ type DoubleQuote = '"';
18
+ type Tilde = '`';
19
+ interface DelimitTailMapping<_ = unknown> extends Static.IMapping {
20
+ output: (this['input'] extends [_, infer A, _, infer B, _, infer C, _, infer D, _, infer E, _, infer F, _, infer G, _, infer H, _, infer I, _, infer Rest extends unknown[]] ? [A, B, C, D, E, F, G, H, I, ...Rest] : this['input'] extends [_, infer A, _, infer B, _, infer C, _, infer D, _, infer E, _, infer F, _, infer G, _, infer H, _, infer Rest extends unknown[]] ? [A, B, C, D, E, F, G, H, ...Rest] : this['input'] extends [_, infer A, _, infer B, _, infer C, _, infer D, _, infer E, _, infer F, _, infer G, _, infer Rest extends unknown[]] ? [A, B, C, D, E, F, G, ...Rest] : this['input'] extends [_, infer A, _, infer B, _, infer C, _, infer D, _, infer E, _, infer F, _, infer Rest extends unknown[]] ? [A, B, C, D, E, F, ...Rest] : this['input'] extends [_, infer A, _, infer B, _, infer C, _, infer D, _, infer E, _, infer Rest extends unknown[]] ? [A, B, C, D, E, ...Rest] : this['input'] extends [_, infer A, _, infer B, _, infer C, _, infer D, _, infer Rest extends unknown[]] ? [A, B, C, D, ...Rest] : this['input'] extends [_, infer A, _, infer B, _, infer C, _, infer Rest extends unknown[]] ? [A, B, C, ...Rest] : this['input'] extends [_, infer A, _, infer B, _, infer Rest extends unknown[]] ? [A, B, ...Rest] : this['input'] extends [_, infer A, _, infer Rest extends unknown[]] ? [A, ...Rest] : this['input'] extends [_, infer Rest extends unknown[]] ? [...Rest] : this['input'] extends [_] ? [] : [
21
+ ]);
22
+ }
23
+ type DelimitTail<T extends Static.IParser, _ extends Static.IParser> = Static.Union<[
24
+ Static.Tuple<[_, T, _, T, _, T, _, T, _, T, _, T, _, T, _, T, _, T, _, Delimit<T, _>]>,
25
+ Static.Tuple<[_, T, _, T, _, T, _, T, _, T, _, T, _, T, _, T, _, Delimit<T, _>]>,
26
+ Static.Tuple<[_, T, _, T, _, T, _, T, _, T, _, T, _, T, _, Delimit<T, _>]>,
27
+ Static.Tuple<[_, T, _, T, _, T, _, T, _, T, _, T, _, Delimit<T, _>]>,
28
+ Static.Tuple<[_, T, _, T, _, T, _, T, _, T, _, Delimit<T, _>]>,
29
+ Static.Tuple<[_, T, _, T, _, T, _, T, _, Delimit<T, _>]>,
30
+ Static.Tuple<[_, T, _, T, _, T, _, Delimit<T, _>]>,
31
+ Static.Tuple<[_, T, _, T, _, Delimit<T, _>]>,
32
+ Static.Tuple<[_, T, _, Delimit<T, _>]>,
33
+ Static.Tuple<[_, Delimit<T, _>]>,
34
+ Static.Tuple<[_]>,
35
+ Static.Tuple<[]>
36
+ ], DelimitTailMapping>;
37
+ interface DelimitMapping extends Static.IMapping {
38
+ output: (this['input'] extends [infer Element extends unknown, infer Rest extends unknown[]] ? [Element, ...Rest] : []);
39
+ }
40
+ type Delimit<Parser extends Static.IParser, Delimiter extends Static.IParser> = (Static.Union<[
41
+ Static.Tuple<[Parser, DelimitTail<Parser, Delimiter>]>,
42
+ Static.Tuple<[]>
43
+ ], DelimitMapping>);
44
+ interface ReferenceMapping extends Static.IMapping {
45
+ output: this['input'] extends [infer Key extends string] ? Key extends keyof this['context'] ? this['context'][Key] : Types.TRef<Types.TUnknown> : never;
46
+ }
47
+ type Reference = Static.Tuple<[Static.Ident], ReferenceMapping>;
48
+ interface LiteralBooleanMapping extends Static.IMapping {
49
+ output: this['input'] extends `${infer S extends boolean}` ? Types.TLiteral<S> : never;
50
+ }
51
+ interface LiteralNumberMapping extends Static.IMapping {
52
+ output: this['input'] extends `${infer S extends number}` ? Types.TLiteral<S> : never;
53
+ }
54
+ interface LiteralStringMapping extends Static.IMapping {
55
+ output: this['input'] extends `${infer S extends string}` ? Types.TLiteral<S> : never;
56
+ }
57
+ type Literal = Static.Union<[
58
+ Static.Union<[Static.Const<'true'>, Static.Const<'false'>], LiteralBooleanMapping>,
59
+ Static.Number<LiteralNumberMapping>,
60
+ Static.String<[DoubleQuote, SingleQuote, Tilde], LiteralStringMapping>
61
+ ]>;
62
+ type Keyword = Static.Union<[
63
+ Static.Const<'any', Static.As<Types.TAny>>,
64
+ Static.Const<'bigint', Static.As<Types.TBigInt>>,
65
+ Static.Const<'boolean', Static.As<Types.TBoolean>>,
66
+ Static.Const<'integer', Static.As<Types.TInteger>>,
67
+ Static.Const<'never', Static.As<Types.TNever>>,
68
+ Static.Const<'null', Static.As<Types.TNull>>,
69
+ Static.Const<'number', Static.As<Types.TNumber>>,
70
+ Static.Const<'string', Static.As<Types.TString>>,
71
+ Static.Const<'symbol', Static.As<Types.TSymbol>>,
72
+ Static.Const<'undefined', Static.As<Types.TUndefined>>,
73
+ Static.Const<'unknown', Static.As<Types.TUnknown>>,
74
+ Static.Const<'void', Static.As<Types.TVoid>>
75
+ ]>;
76
+ interface KeyOfMapping extends Static.IMapping {
77
+ output: this['input'] extends [] ? false : true;
78
+ }
79
+ type KeyOf = Static.Union<[
80
+ Static.Tuple<[Static.Const<'keyof'>]>,
81
+ Static.Tuple<[]>
82
+ ], KeyOfMapping>;
83
+ interface IndexArrayMapping extends Static.IMapping {
84
+ output: (this['input'] extends [LBracket, infer Type extends Types.TSchema, RBracket, infer Rest extends unknown[]] ? [[Type], ...Rest] : this['input'] extends [LBracket, RBracket, infer Rest extends unknown[]] ? [[], ...Rest] : [
85
+ ]);
86
+ }
87
+ type IndexArray = Static.Union<[
88
+ Static.Tuple<[Static.Const<LBracket>, Type, Static.Const<RBracket>, IndexArray]>,
89
+ Static.Tuple<[Static.Const<LBracket>, Static.Const<RBracket>, IndexArray]>,
90
+ Static.Tuple<[]>
91
+ ], IndexArrayMapping>;
92
+ interface ExtendsMapping extends Static.IMapping {
93
+ output: this['input'] extends ['extends', infer Type extends Types.TSchema, Question, infer True extends Types.TSchema, Colon, infer False extends Types.TSchema] ? [Type, True, False] : [];
94
+ }
95
+ type Extends = Static.Union<[
96
+ Static.Tuple<[Static.Const<'extends'>, Type, Static.Const<Question>, Type, Static.Const<Colon>, Type]>,
97
+ Static.Tuple<[]>
98
+ ], ExtendsMapping>;
99
+ interface BaseMapping extends Static.IMapping {
100
+ output: (this['input'] extends [LParen, infer Type extends Types.TSchema, RParen] ? Type : this['input'] extends [infer Type extends Types.TSchema] ? Type : never);
101
+ }
102
+ type Base = Static.Union<[
103
+ Static.Tuple<[
104
+ Static.Const<LParen>,
105
+ Type,
106
+ Static.Const<RParen>
107
+ ]>,
108
+ Static.Tuple<[
109
+ Static.Union<[
110
+ Literal,
111
+ Keyword,
112
+ Object,
113
+ Tuple,
114
+ Function,
115
+ Constructor,
116
+ Mapped,
117
+ AsyncIterator,
118
+ Iterator,
119
+ ConstructorParameters,
120
+ FunctionParameters,
121
+ InstanceType,
122
+ ReturnType,
123
+ Awaited,
124
+ Array,
125
+ Record,
126
+ Promise,
127
+ Partial,
128
+ Required,
129
+ Pick,
130
+ Omit,
131
+ Exclude,
132
+ Extract,
133
+ Lowercase,
134
+ Uppercase,
135
+ Capitalize,
136
+ Uncapitalize,
137
+ Date,
138
+ Uint8Array,
139
+ Reference
140
+ ]>
141
+ ]>
142
+ ], BaseMapping>;
143
+ type FactorExtends<Type extends Types.TSchema, Extends extends unknown[]> = (Extends extends [infer Right extends Types.TSchema, infer True extends Types.TSchema, infer False extends Types.TSchema] ? Types.TExtends<Type, Right, True, False> : Type);
144
+ type FactorIndexArray<Type extends Types.TSchema, IndexArray extends unknown[]> = (IndexArray extends [...infer Left extends unknown[], infer Right extends Types.TSchema[]] ? (Right extends [infer Indexer extends Types.TSchema] ? Types.TIndex<FactorIndexArray<Type, Left>, Types.TIndexPropertyKeys<Indexer>> : Right extends [] ? Types.TArray<FactorIndexArray<Type, Left>> : Types.TNever) : Type);
145
+ interface FactorMapping extends Static.IMapping {
146
+ output: this['input'] extends [infer KeyOf extends boolean, infer Type extends Types.TSchema, infer IndexArray extends unknown[], infer Extends extends unknown[]] ? KeyOf extends true ? FactorExtends<Types.TKeyOf<FactorIndexArray<Type, IndexArray>>, Extends> : FactorExtends<FactorIndexArray<Type, IndexArray>, Extends> : never;
147
+ }
148
+ type Factor = Static.Tuple<[
149
+ KeyOf,
150
+ Base,
151
+ IndexArray,
152
+ Extends
153
+ ], FactorMapping>;
154
+ type ExprBinaryReduce<Left extends Types.TSchema, Rest extends unknown[]> = (Rest extends [infer Operator extends unknown, infer Right extends Types.TSchema, infer Next extends unknown[]] ? (ExprBinaryReduce<Right, Next> extends infer Schema extends Types.TSchema ? (Operator extends '&' ? (Schema extends Types.TIntersect<infer Types extends Types.TSchema[]> ? Types.TIntersect<[Left, ...Types]> : Types.TIntersect<[Left, Schema]>) : Operator extends '|' ? (Schema extends Types.TUnion<infer Types extends Types.TSchema[]> ? Types.TUnion<[Left, ...Types]> : Types.TUnion<[Left, Schema]>) : never) : never) : Left);
155
+ interface ExprBinaryMapping extends Static.IMapping {
156
+ output: (this['input'] extends [infer Left extends Types.TSchema, infer Rest extends unknown[]] ? ExprBinaryReduce<Left, Rest> : []);
157
+ }
158
+ type ExprTermTail = Static.Union<[
159
+ Static.Tuple<[Static.Const<'&'>, Factor, ExprTermTail]>,
160
+ Static.Tuple<[]>
161
+ ]>;
162
+ type ExprTerm = Static.Tuple<[
163
+ Factor,
164
+ ExprTermTail
165
+ ], ExprBinaryMapping>;
166
+ type ExprTail = Static.Union<[
167
+ Static.Tuple<[Static.Const<'|'>, ExprTerm, ExprTail]>,
168
+ Static.Tuple<[]>
169
+ ]>;
170
+ type Expr = Static.Tuple<[
171
+ ExprTerm,
172
+ ExprTail
173
+ ], ExprBinaryMapping>;
174
+ export type Type = Expr;
175
+ interface PropertyKeyStringMapping extends Static.IMapping {
176
+ output: this['input'];
177
+ }
178
+ type PropertyKeyString = Static.String<[SingleQuote, DoubleQuote], PropertyKeyStringMapping>;
179
+ type PropertyKey = Static.Union<[Static.Ident, PropertyKeyString]>;
180
+ interface PropertyReadonlyMapping extends Static.IMapping {
181
+ output: this['input'] extends ['readonly'] ? true : false;
182
+ }
183
+ type PropertyReadonly = Static.Union<[Static.Tuple<[Static.Const<'readonly'>]>, Static.Tuple<[]>], PropertyReadonlyMapping>;
184
+ interface PropertyOptionalMapping extends Static.IMapping {
185
+ output: this['input'] extends [Question] ? true : false;
186
+ }
187
+ type PropertyOptional = Static.Union<[Static.Tuple<[Static.Const<Question>]>, Static.Tuple<[]>], PropertyOptionalMapping>;
188
+ interface PropertyMapping extends Static.IMapping {
189
+ output: this['input'] extends [infer Readonly extends boolean, infer Key extends string, infer Optional extends boolean, string, infer Type extends Types.TSchema] ? {
190
+ [_ in Key]: ([
191
+ Readonly,
192
+ Optional
193
+ ] extends [true, true] ? Types.TReadonlyOptional<Type> : [
194
+ Readonly,
195
+ Optional
196
+ ] extends [true, false] ? Types.TReadonly<Type> : [
197
+ Readonly,
198
+ Optional
199
+ ] extends [false, true] ? Types.TOptional<Type> : Type);
200
+ } : never;
201
+ }
202
+ type Property = Static.Tuple<[PropertyReadonly, PropertyKey, PropertyOptional, Static.Const<Colon>, Type], PropertyMapping>;
203
+ type PropertiesEvaluate<T> = {
204
+ [K in keyof T]: T[K];
205
+ } & {};
206
+ type PropertyDelimiter = Static.Union<[
207
+ Static.Tuple<[Static.Const<Comma>, Static.Const<Newline>]>,
208
+ Static.Tuple<[Static.Const<SemiColon>, Static.Const<Newline>]>,
209
+ Static.Tuple<[Static.Const<Comma>]>,
210
+ Static.Tuple<[Static.Const<SemiColon>]>,
211
+ Static.Tuple<[Static.Const<Newline>]>
212
+ ]>;
213
+ type PropertiesReduce<PropertiesArray extends Types.TProperties[], Result extends Types.TProperties = {}> = (PropertiesArray extends [infer Left extends Types.TProperties, ...infer Right extends Types.TProperties[]] ? PropertiesReduce<Right, PropertiesEvaluate<Result & Left>> : Result);
214
+ interface PropertiesMapping extends Static.IMapping {
215
+ output: this['input'] extends Types.TProperties[] ? PropertiesReduce<this['input']> : never;
216
+ }
217
+ type Properties = Static.Union<[Delimit<Property, PropertyDelimiter>], PropertiesMapping>;
218
+ interface ObjectMapping extends Static.IMapping {
219
+ output: this['input'] extends [unknown, infer Properties extends Types.TProperties, unknown] ? Types.TObject<Properties> : never;
220
+ }
221
+ type Object = Static.Tuple<[
222
+ Static.Const<LBrace>,
223
+ Properties,
224
+ Static.Const<RBrace>
225
+ ], ObjectMapping>;
226
+ type Elements = Delimit<Type, Static.Const<Comma>>;
227
+ interface TupleMapping extends Static.IMapping {
228
+ output: this['input'] extends [unknown, infer Elements extends Types.TSchema[], unknown] ? Types.TTuple<Elements> : never;
229
+ }
230
+ type Tuple = Static.Tuple<[
231
+ Static.Const<LBracket>,
232
+ Elements,
233
+ Static.Const<RBracket>
234
+ ], TupleMapping>;
235
+ interface ParameterMapping extends Static.IMapping {
236
+ output: this['input'] extends [string, Colon, infer Type extends Types.TSchema] ? Type : never;
237
+ }
238
+ type Parameter = Static.Tuple<[
239
+ Static.Ident,
240
+ Static.Const<Colon>,
241
+ Type
242
+ ], ParameterMapping>;
243
+ type Parameters = Delimit<Parameter, Static.Const<Comma>>;
244
+ interface FunctionMapping extends Static.IMapping {
245
+ output: this['input'] extends [LParen, infer Parameters extends Types.TSchema[], RParen, '=>', infer ReturnType extends Types.TSchema] ? Types.TFunction<Parameters, ReturnType> : never;
246
+ }
247
+ type Function = Static.Tuple<[
248
+ Static.Const<LParen>,
249
+ Parameters,
250
+ Static.Const<RParen>,
251
+ Static.Const<'=>'>,
252
+ Type
253
+ ], FunctionMapping>;
254
+ interface ConstructorMapping extends Static.IMapping {
255
+ output: this['input'] extends ['new', LParen, infer Parameters extends Types.TSchema[], RParen, '=>', infer InstanceType extends Types.TSchema] ? Types.TConstructor<Parameters, InstanceType> : never;
256
+ }
257
+ type Constructor = Static.Tuple<[
258
+ Static.Const<'new'>,
259
+ Static.Const<LParen>,
260
+ Parameters,
261
+ Static.Const<RParen>,
262
+ Static.Const<'=>'>,
263
+ Type
264
+ ], ConstructorMapping>;
265
+ interface MappedMapping extends Static.IMapping {
266
+ output: this['input'] extends [LBrace, LBracket, infer Key extends string, 'in', infer Right extends Types.TSchema, RBracket, Colon, infer Type extends Types.TSchema, RBrace] ? Types.TLiteral<'Mapped types not supported'> : this['input'];
267
+ }
268
+ type Mapped = Static.Tuple<[
269
+ Static.Const<LBrace>,
270
+ Static.Const<LBracket>,
271
+ Static.Ident,
272
+ Static.Const<'in'>,
273
+ Type,
274
+ Static.Const<RBracket>,
275
+ Static.Const<Colon>,
276
+ Type,
277
+ Static.Const<RBrace>
278
+ ], MappedMapping>;
279
+ interface ArrayMapping extends Static.IMapping {
280
+ output: this['input'] extends ['Array', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TArray<Type> : never;
281
+ }
282
+ type Array = Static.Tuple<[
283
+ Static.Const<'Array'>,
284
+ Static.Const<LAngle>,
285
+ Type,
286
+ Static.Const<RAngle>
287
+ ], ArrayMapping>;
288
+ interface AsyncIteratorMapping extends Static.IMapping {
289
+ output: this['input'] extends ['AsyncIterator', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TAsyncIterator<Type> : never;
290
+ }
291
+ type AsyncIterator = Static.Tuple<[
292
+ Static.Const<'AsyncIterator'>,
293
+ Static.Const<LAngle>,
294
+ Type,
295
+ Static.Const<RAngle>
296
+ ], AsyncIteratorMapping>;
297
+ interface IteratorMapping extends Static.IMapping {
298
+ output: this['input'] extends ['Iterator', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TIterator<Type> : never;
299
+ }
300
+ type Iterator = Static.Tuple<[
301
+ Static.Const<'Iterator'>,
302
+ Static.Const<LAngle>,
303
+ Type,
304
+ Static.Const<RAngle>
305
+ ], IteratorMapping>;
306
+ interface ConstructorParametersMapping extends Static.IMapping {
307
+ output: this['input'] extends ['ConstructorParameters', LAngle, infer Type extends Types.TConstructor, RAngle] ? Types.TConstructorParameters<Type> : never;
308
+ }
309
+ type ConstructorParameters = Static.Tuple<[
310
+ Static.Const<'ConstructorParameters'>,
311
+ Static.Const<LAngle>,
312
+ Type,
313
+ Static.Const<RAngle>
314
+ ], ConstructorParametersMapping>;
315
+ interface FunctionParametersMapping extends Static.IMapping {
316
+ output: this['input'] extends ['Parameters', LAngle, infer Type extends Types.TFunction, RAngle] ? Types.TParameters<Type> : never;
317
+ }
318
+ type FunctionParameters = Static.Tuple<[
319
+ Static.Const<'Parameters'>,
320
+ Static.Const<LAngle>,
321
+ Type,
322
+ Static.Const<RAngle>
323
+ ], FunctionParametersMapping>;
324
+ interface InstanceTypeMapping extends Static.IMapping {
325
+ output: this['input'] extends ['InstanceType', LAngle, infer Type extends Types.TConstructor, RAngle] ? Types.TInstanceType<Type> : never;
326
+ }
327
+ type InstanceType = Static.Tuple<[
328
+ Static.Const<'InstanceType'>,
329
+ Static.Const<LAngle>,
330
+ Type,
331
+ Static.Const<RAngle>
332
+ ], InstanceTypeMapping>;
333
+ interface ReturnTypeMapping extends Static.IMapping {
334
+ output: this['input'] extends ['ReturnType', LAngle, infer Type extends Types.TFunction, RAngle] ? Types.TReturnType<Type> : never;
335
+ }
336
+ type ReturnType = Static.Tuple<[
337
+ Static.Const<'ReturnType'>,
338
+ Static.Const<LAngle>,
339
+ Type,
340
+ Static.Const<RAngle>
341
+ ], ReturnTypeMapping>;
342
+ interface AwaitedMapping extends Static.IMapping {
343
+ output: this['input'] extends ['Awaited', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TAwaited<Type> : never;
344
+ }
345
+ type Awaited = Static.Tuple<[
346
+ Static.Const<'Awaited'>,
347
+ Static.Const<LAngle>,
348
+ Type,
349
+ Static.Const<RAngle>
350
+ ], AwaitedMapping>;
351
+ interface PromiseMapping extends Static.IMapping {
352
+ output: this['input'] extends ['Promise', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TPromise<Type> : never;
353
+ }
354
+ type Promise = Static.Tuple<[
355
+ Static.Const<'Promise'>,
356
+ Static.Const<LAngle>,
357
+ Type,
358
+ Static.Const<RAngle>
359
+ ], PromiseMapping>;
360
+ interface RecordMapping extends Static.IMapping {
361
+ output: this['input'] extends ['Record', LAngle, infer Key extends Types.TSchema, Comma, infer Type extends Types.TSchema, RAngle] ? Types.TRecord<Key, Type> : never;
362
+ }
363
+ type Record = Static.Tuple<[
364
+ Static.Const<'Record'>,
365
+ Static.Const<LAngle>,
366
+ Type,
367
+ Static.Const<Comma>,
368
+ Type,
369
+ Static.Const<RAngle>
370
+ ], RecordMapping>;
371
+ interface PartialMapping extends Static.IMapping {
372
+ output: this['input'] extends ['Partial', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TPartial<Type> : never;
373
+ }
374
+ type Partial = Static.Tuple<[
375
+ Static.Const<'Partial'>,
376
+ Static.Const<LAngle>,
377
+ Type,
378
+ Static.Const<RAngle>
379
+ ], PartialMapping>;
380
+ interface RequiredMapping extends Static.IMapping {
381
+ output: this['input'] extends ['Required', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TPartial<Type> : never;
382
+ }
383
+ type Required = Static.Tuple<[
384
+ Static.Const<'Required'>,
385
+ Static.Const<LAngle>,
386
+ Type,
387
+ Static.Const<RAngle>
388
+ ], RequiredMapping>;
389
+ interface PickMapping extends Static.IMapping {
390
+ output: this['input'] extends ['Pick', LAngle, infer Type extends Types.TSchema, Comma, infer PropertyKey extends Types.TSchema, RAngle] ? Types.TPick<Type, Types.TIndexPropertyKeys<PropertyKey>> : never;
391
+ }
392
+ type Pick = Static.Tuple<[
393
+ Static.Const<'Pick'>,
394
+ Static.Const<LAngle>,
395
+ Type,
396
+ Static.Const<Comma>,
397
+ Type,
398
+ Static.Const<RAngle>
399
+ ], PickMapping>;
400
+ interface OmitMapping extends Static.IMapping {
401
+ output: this['input'] extends ['Omit', LAngle, infer Type extends Types.TSchema, Comma, infer PropertyKey extends Types.TSchema, RAngle] ? Types.TOmit<Type, Types.TIndexPropertyKeys<PropertyKey>> : never;
402
+ }
403
+ type Omit = Static.Tuple<[
404
+ Static.Const<'Omit'>,
405
+ Static.Const<LAngle>,
406
+ Type,
407
+ Static.Const<Comma>,
408
+ Type,
409
+ Static.Const<RAngle>
410
+ ], OmitMapping>;
411
+ interface ExcludeMapping extends Static.IMapping {
412
+ output: this['input'] extends ['Exclude', LAngle, infer Type extends Types.TSchema, Comma, infer PropertyKey extends Types.TSchema, RAngle] ? Types.TExclude<Type, PropertyKey> : never;
413
+ }
414
+ type Exclude = Static.Tuple<[
415
+ Static.Const<'Exclude'>,
416
+ Static.Const<LAngle>,
417
+ Type,
418
+ Static.Const<Comma>,
419
+ Type,
420
+ Static.Const<RAngle>
421
+ ], ExcludeMapping>;
422
+ interface ExtractMapping extends Static.IMapping {
423
+ output: this['input'] extends ['Extract', LAngle, infer Type extends Types.TSchema, Comma, infer PropertyKey extends Types.TSchema, RAngle] ? Types.TExtract<Type, PropertyKey> : never;
424
+ }
425
+ type Extract = Static.Tuple<[
426
+ Static.Const<'Extract'>,
427
+ Static.Const<LAngle>,
428
+ Type,
429
+ Static.Const<Comma>,
430
+ Type,
431
+ Static.Const<RAngle>
432
+ ], ExtractMapping>;
433
+ interface UppercaseMapping extends Static.IMapping {
434
+ output: this['input'] extends ['Uppercase', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TUppercase<Type> : never;
435
+ }
436
+ type Uppercase = Static.Tuple<[
437
+ Static.Const<'Uppercase'>,
438
+ Static.Const<LAngle>,
439
+ Type,
440
+ Static.Const<RAngle>
441
+ ], UppercaseMapping>;
442
+ interface LowercaseMapping extends Static.IMapping {
443
+ output: this['input'] extends ['Lowercase', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TLowercase<Type> : never;
444
+ }
445
+ type Lowercase = Static.Tuple<[
446
+ Static.Const<'Lowercase'>,
447
+ Static.Const<LAngle>,
448
+ Type,
449
+ Static.Const<RAngle>
450
+ ], LowercaseMapping>;
451
+ interface CapitalizeMapping extends Static.IMapping {
452
+ output: this['input'] extends ['Capitalize', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TCapitalize<Type> : never;
453
+ }
454
+ type Capitalize = Static.Tuple<[
455
+ Static.Const<'Capitalize'>,
456
+ Static.Const<LAngle>,
457
+ Type,
458
+ Static.Const<RAngle>
459
+ ], CapitalizeMapping>;
460
+ interface UncapitalizeMapping extends Static.IMapping {
461
+ output: this['input'] extends ['Uncapitalize', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TUncapitalize<Type> : never;
462
+ }
463
+ type Uncapitalize = Static.Tuple<[
464
+ Static.Const<'Uncapitalize'>,
465
+ Static.Const<LAngle>,
466
+ Type,
467
+ Static.Const<RAngle>
468
+ ], UncapitalizeMapping>;
469
+ type Date = Static.Const<'Date', Static.As<Types.TDate>>;
470
+ type Uint8Array = Static.Const<'Uint8Array', Static.As<Types.TUint8Array>>;
471
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sinclair/typebox",
3
- "version": "0.33.19",
3
+ "version": "0.33.21",
4
4
  "description": "Json Schema Type Builder with Static Type Resolution for TypeScript",
5
5
  "keywords": [
6
6
  "typescript",
@@ -62,6 +62,16 @@
62
62
  "default": "./build/esm/errors/index.mjs"
63
63
  }
64
64
  },
65
+ "./parse": {
66
+ "require": {
67
+ "types": "./build/cjs/parse/index.d.ts",
68
+ "default": "./build/cjs/parse/index.js"
69
+ },
70
+ "import": {
71
+ "types": "./build/esm/parse/index.d.mts",
72
+ "default": "./build/esm/parse/index.mjs"
73
+ }
74
+ },
65
75
  "./system": {
66
76
  "require": {
67
77
  "types": "./build/cjs/system/index.d.ts",
@@ -0,0 +1,4 @@
1
+ {
2
+ "main": "../build/cjs/parse/index.js",
3
+ "types": "../build/cjs/parse/index.d.ts"
4
+ }
package/readme.md CHANGED
@@ -1760,11 +1760,12 @@ The following table lists esbuild compiled and minified sizes for each TypeBox m
1760
1760
  ┌──────────────────────┬────────────┬────────────┬─────────────┐
1761
1761
  │ (index) │ Compiled │ Minified │ Compression │
1762
1762
  ├──────────────────────┼────────────┼────────────┼─────────────┤
1763
- │ typebox/compiler │ '119.6 kb' │ ' 52.6 kb' │ '2.27 x' │
1764
- │ typebox/errors │ ' 48.6 kb' │ ' 21.9 kb' │ '2.22 x' │
1763
+ │ typebox/compiler │ '119.8 kb' │ ' 52.6 kb' │ '2.28 x' │
1764
+ │ typebox/errors │ ' 74.4 kb' │ ' 33.1 kb' │ '2.25 x' │
1765
+ │ typebox/parse │ '115.3 kb' │ ' 48.3 kb' │ '2.39 x' │
1765
1766
  │ typebox/system │ ' 7.4 kb' │ ' 3.2 kb' │ '2.33 x' │
1766
- │ typebox/value │ '157.8 kb' │ ' 66.6 kb' │ '2.37 x' │
1767
- │ typebox │ ' 98.3 kb' │ ' 40.9 kb' │ '2.40 x' │
1767
+ │ typebox/value │ '157.2 kb' │ ' 66.1 kb' │ '2.38 x' │
1768
+ │ typebox │ '127.3 kb' │ ' 53.3 kb' │ '2.39 x' │
1768
1769
  └──────────────────────┴────────────┴────────────┴─────────────┘
1769
1770
  ```
1770
1771