@sinclair/typebox 0.33.22 → 0.34.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 (87) hide show
  1. package/build/cjs/compiler/compiler.d.ts +2 -2
  2. package/build/cjs/compiler/compiler.js +13 -2
  3. package/build/cjs/errors/errors.js +7 -0
  4. package/build/cjs/index.d.ts +1 -2
  5. package/build/cjs/index.js +1 -2
  6. package/build/cjs/syntax/parse.d.ts +14 -15
  7. package/build/cjs/syntax/parse.js +6 -5
  8. package/build/cjs/syntax/runtime.d.ts +17 -4
  9. package/build/cjs/syntax/runtime.js +180 -27
  10. package/build/cjs/syntax/static.d.ts +104 -20
  11. package/build/cjs/type/guard/kind.d.ts +3 -0
  12. package/build/cjs/type/guard/kind.js +5 -0
  13. package/build/cjs/type/guard/type.d.ts +3 -0
  14. package/build/cjs/type/guard/type.js +13 -0
  15. package/build/cjs/type/index.d.ts +1 -2
  16. package/build/cjs/type/index.js +1 -2
  17. package/build/cjs/type/module/index.d.ts +1 -0
  18. package/build/cjs/type/{strict → module}/index.js +1 -1
  19. package/build/cjs/type/module/module.d.ts +71 -0
  20. package/build/cjs/type/module/module.js +34 -0
  21. package/build/cjs/type/ref/ref.d.ts +4 -7
  22. package/build/cjs/type/ref/ref.js +3 -11
  23. package/build/cjs/type/static/static.d.ts +1 -1
  24. package/build/cjs/type/type/json.d.ts +4 -17
  25. package/build/cjs/type/type/json.js +52 -68
  26. package/build/cjs/type/type/type.d.ts +1 -2
  27. package/build/cjs/type/type/type.js +55 -57
  28. package/build/cjs/value/cast/cast.js +8 -1
  29. package/build/cjs/value/check/check.js +8 -1
  30. package/build/cjs/value/clean/clean.js +8 -1
  31. package/build/cjs/value/convert/convert.js +7 -0
  32. package/build/cjs/value/create/create.js +7 -0
  33. package/build/cjs/value/default/default.js +7 -0
  34. package/build/cjs/value/transform/decode.js +11 -0
  35. package/build/cjs/value/transform/encode.js +11 -0
  36. package/build/esm/compiler/compiler.d.mts +2 -2
  37. package/build/esm/compiler/compiler.mjs +13 -2
  38. package/build/esm/errors/errors.mjs +7 -0
  39. package/build/esm/index.d.mts +1 -2
  40. package/build/esm/index.mjs +1 -2
  41. package/build/esm/syntax/parse.d.mts +14 -15
  42. package/build/esm/syntax/parse.mjs +6 -5
  43. package/build/esm/syntax/runtime.d.mts +17 -4
  44. package/build/esm/syntax/runtime.mjs +180 -27
  45. package/build/esm/syntax/static.d.mts +104 -20
  46. package/build/esm/type/guard/kind.d.mts +3 -0
  47. package/build/esm/type/guard/kind.mjs +4 -0
  48. package/build/esm/type/guard/type.d.mts +3 -0
  49. package/build/esm/type/guard/type.mjs +12 -0
  50. package/build/esm/type/index.d.mts +1 -2
  51. package/build/esm/type/index.mjs +1 -2
  52. package/build/esm/type/module/index.d.mts +1 -0
  53. package/build/esm/type/module/index.mjs +1 -0
  54. package/build/esm/type/module/module.d.mts +71 -0
  55. package/build/esm/type/module/module.mjs +28 -0
  56. package/build/esm/type/ref/ref.d.mts +4 -7
  57. package/build/esm/type/ref/ref.mjs +3 -11
  58. package/build/esm/type/static/static.d.mts +1 -1
  59. package/build/esm/type/type/json.d.mts +4 -17
  60. package/build/esm/type/type/json.mjs +7 -23
  61. package/build/esm/type/type/type.d.mts +1 -2
  62. package/build/esm/type/type/type.mjs +1 -2
  63. package/build/esm/value/cast/cast.mjs +9 -2
  64. package/build/esm/value/check/check.mjs +9 -2
  65. package/build/esm/value/clean/clean.mjs +9 -2
  66. package/build/esm/value/convert/convert.mjs +7 -0
  67. package/build/esm/value/create/create.mjs +7 -0
  68. package/build/esm/value/default/default.mjs +7 -0
  69. package/build/esm/value/transform/decode.mjs +11 -0
  70. package/build/esm/value/transform/encode.mjs +11 -0
  71. package/package.json +1 -1
  72. package/readme.md +219 -97
  73. package/build/cjs/type/deref/deref.d.ts +0 -22
  74. package/build/cjs/type/deref/deref.js +0 -106
  75. package/build/cjs/type/deref/index.d.ts +0 -1
  76. package/build/cjs/type/deref/index.js +0 -18
  77. package/build/cjs/type/strict/index.d.ts +0 -1
  78. package/build/cjs/type/strict/strict.d.ts +0 -12
  79. package/build/cjs/type/strict/strict.js +0 -16
  80. package/build/esm/type/deref/deref.d.mts +0 -22
  81. package/build/esm/type/deref/deref.mjs +0 -102
  82. package/build/esm/type/deref/index.d.mts +0 -1
  83. package/build/esm/type/deref/index.mjs +0 -1
  84. package/build/esm/type/strict/index.d.mts +0 -1
  85. package/build/esm/type/strict/index.mjs +0 -1
  86. package/build/esm/type/strict/strict.d.mts +0 -12
  87. package/build/esm/type/strict/strict.mjs +0 -12
@@ -16,6 +16,7 @@ type SemiColon = ';';
16
16
  type SingleQuote = "'";
17
17
  type DoubleQuote = '"';
18
18
  type Tilde = '`';
19
+ type Equals = '=';
19
20
  interface DelimitTailMapping<_ = unknown> extends Static.IMapping {
20
21
  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
  ]);
@@ -41,10 +42,90 @@ type Delimit<Parser extends Static.IParser, Delimiter extends Static.IParser> =
41
42
  Static.Tuple<[Parser, DelimitTail<Parser, Delimiter>]>,
42
43
  Static.Tuple<[]>
43
44
  ], DelimitMapping>);
45
+ type Deref<Context extends Types.TProperties, Ref extends string> = (Ref extends keyof Context ? Context[Ref] : Types.TRef<Ref>);
46
+ interface ExportModifierMapping extends Static.IMapping {
47
+ output: this['input'] extends [string] ? true : false;
48
+ }
49
+ type ExportModifier = Static.Union<[
50
+ Static.Tuple<[Static.Const<'export'>]>,
51
+ Static.Tuple<[]>
52
+ ], ExportModifierMapping>;
53
+ interface TypeAliasDeclarationMapping extends Static.IMapping {
54
+ output: this['input'] extends [infer _Export extends boolean, 'type', infer Ident extends string, Equals, infer Type extends Types.TSchema] ? {
55
+ [_ in Ident]: Type;
56
+ } : never;
57
+ }
58
+ type TypeAliasDeclaration = Static.Tuple<[
59
+ ExportModifier,
60
+ Static.Const<'type'>,
61
+ Static.Ident,
62
+ Static.Const<Equals>,
63
+ Type
64
+ ], TypeAliasDeclarationMapping>;
65
+ type HeritageListDelimiter = Static.Union<[Static.Tuple<[Static.Const<Comma>, Static.Const<Newline>]>, Static.Tuple<[Static.Const<Comma>]>]>;
66
+ type HeritageListReduce<Values extends string[], Context extends Types.TProperties, Result extends Types.TSchema[] = []> = (Values extends [infer Ref extends string, ...infer Rest extends string[]] ? HeritageListReduce<Rest, Context, [...Result, Deref<Context, Ref>]> : Result);
67
+ interface HeritageListMapping extends Static.IMapping {
68
+ output: (this['context'] extends Types.TProperties ? this['input'] extends string[] ? HeritageListReduce<this['input'], this['context']> : [] : []);
69
+ }
70
+ type HeritageList = Static.Union<[Delimit<Static.Ident, HeritageListDelimiter>], HeritageListMapping>;
71
+ interface HeritageMapping extends Static.IMapping {
72
+ output: this['input'] extends ['extends', infer List extends Types.TSchema[]] ? List : [];
73
+ }
74
+ type Heritage = Static.Union<[
75
+ Static.Tuple<[Static.Const<'extends'>, HeritageList]>,
76
+ Static.Tuple<[]>
77
+ ], HeritageMapping>;
78
+ interface InterfaceDeclarationMapping extends Static.IMapping {
79
+ output: this['input'] extends [boolean, 'interface', infer Ident extends string, infer Heritage extends Types.TSchema[], LBrace, infer Properties extends Types.TProperties, RBrace] ? {
80
+ [_ in Ident]: Types.TIntersectEvaluated<[...Heritage, Types.TObject<Properties>]>;
81
+ } : never;
82
+ }
83
+ type InterfaceDeclaration = Static.Tuple<[
84
+ ExportModifier,
85
+ Static.Const<'interface'>,
86
+ Static.Ident,
87
+ Heritage,
88
+ Static.Const<LBrace>,
89
+ Properties,
90
+ Static.Const<RBrace>
91
+ ], InterfaceDeclarationMapping>;
92
+ type ModuleType = Static.Union<[
93
+ InterfaceDeclaration,
94
+ TypeAliasDeclaration
95
+ ]>;
96
+ type ModulePropertiesDelimiter = Static.Union<[
97
+ Static.Tuple<[Static.Const<SemiColon>, Static.Const<Newline>]>,
98
+ Static.Tuple<[Static.Const<SemiColon>]>,
99
+ Static.Tuple<[Static.Const<Newline>]>
100
+ ]>;
101
+ type ModulePropertiesReduce<Value extends unknown[], Result extends Types.TProperties = {}> = (Value extends [infer ModuleType extends Types.TProperties, unknown[], ...infer Rest extends unknown[]] ? ModulePropertiesReduce<Rest, Result & ModuleType> : Value extends [infer ModuleType extends Types.TProperties] ? ModulePropertiesReduce<[], Result & ModuleType> : Types.Evaluate<Result>);
102
+ interface ModulePropertiesMapping extends Static.IMapping {
103
+ output: this['input'] extends unknown[] ? ModulePropertiesReduce<this['input']> : never;
104
+ }
105
+ type ModuleProperties = Static.Union<[
106
+ Static.Tuple<[ModuleType, ModulePropertiesDelimiter, ModuleProperties]>,
107
+ Static.Tuple<[ModuleType]>,
108
+ Static.Tuple<[]>
109
+ ], ModulePropertiesMapping>;
110
+ type ModuleIdentifier = Static.Union<[
111
+ Static.Tuple<[Static.Ident]>,
112
+ Static.Tuple<[]>
113
+ ]>;
114
+ interface ModuleDeclarationMapping extends Static.IMapping {
115
+ output: this['input'] extends [boolean, 'module', infer _Ident extends string[], LBrace, infer Properties extends Types.TProperties, RBrace] ? Types.TModule<Properties> : never;
116
+ }
117
+ type ModuleDeclaration = Static.Tuple<[
118
+ ExportModifier,
119
+ Static.Const<'module'>,
120
+ ModuleIdentifier,
121
+ Static.Const<LBrace>,
122
+ ModuleProperties,
123
+ Static.Const<RBrace>
124
+ ], ModuleDeclarationMapping>;
44
125
  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;
126
+ output: this['context'] extends Types.TProperties ? this['input'] extends string ? Deref<this['context'], this['input']> : never : never;
46
127
  }
47
- type Reference = Static.Tuple<[Static.Ident], ReferenceMapping>;
128
+ type Reference = Static.Ident<ReferenceMapping>;
48
129
  interface LiteralBooleanMapping extends Static.IMapping {
49
130
  output: this['input'] extends `${infer S extends boolean}` ? Types.TLiteral<S> : never;
50
131
  }
@@ -171,38 +252,35 @@ type Expr = Static.Tuple<[
171
252
  ExprTerm,
172
253
  ExprTail
173
254
  ], ExprBinaryMapping>;
174
- export type Type = Expr;
255
+ type Type = Expr;
175
256
  interface PropertyKeyStringMapping extends Static.IMapping {
176
257
  output: this['input'];
177
258
  }
178
259
  type PropertyKeyString = Static.String<[SingleQuote, DoubleQuote], PropertyKeyStringMapping>;
179
260
  type PropertyKey = Static.Union<[Static.Ident, PropertyKeyString]>;
180
- interface PropertyReadonlyMapping extends Static.IMapping {
261
+ interface ReadonlyMapping extends Static.IMapping {
181
262
  output: this['input'] extends ['readonly'] ? true : false;
182
263
  }
183
- type PropertyReadonly = Static.Union<[Static.Tuple<[Static.Const<'readonly'>]>, Static.Tuple<[]>], PropertyReadonlyMapping>;
184
- interface PropertyOptionalMapping extends Static.IMapping {
264
+ type Readonly = Static.Union<[Static.Tuple<[Static.Const<'readonly'>]>, Static.Tuple<[]>], ReadonlyMapping>;
265
+ interface OptionalMapping extends Static.IMapping {
185
266
  output: this['input'] extends [Question] ? true : false;
186
267
  }
187
- type PropertyOptional = Static.Union<[Static.Tuple<[Static.Const<Question>]>, Static.Tuple<[]>], PropertyOptionalMapping>;
268
+ type Optional = Static.Union<[Static.Tuple<[Static.Const<Question>]>, Static.Tuple<[]>], OptionalMapping>;
188
269
  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] ? {
270
+ output: this['input'] extends [infer IsReadonly extends boolean, infer Key extends string, infer IsOptional extends boolean, string, infer Type extends Types.TSchema] ? {
190
271
  [_ in Key]: ([
191
- Readonly,
192
- Optional
272
+ IsReadonly,
273
+ IsOptional
193
274
  ] extends [true, true] ? Types.TReadonlyOptional<Type> : [
194
- Readonly,
195
- Optional
275
+ IsReadonly,
276
+ IsOptional
196
277
  ] extends [true, false] ? Types.TReadonly<Type> : [
197
- Readonly,
198
- Optional
278
+ IsReadonly,
279
+ IsOptional
199
280
  ] extends [false, true] ? Types.TOptional<Type> : Type);
200
281
  } : never;
201
282
  }
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
- } & {};
283
+ type Property = Static.Tuple<[Readonly, PropertyKey, Optional, Static.Const<Colon>, Type], PropertyMapping>;
206
284
  type PropertyDelimiter = Static.Union<[
207
285
  Static.Tuple<[Static.Const<Comma>, Static.Const<Newline>]>,
208
286
  Static.Tuple<[Static.Const<SemiColon>, Static.Const<Newline>]>,
@@ -210,7 +288,7 @@ type PropertyDelimiter = Static.Union<[
210
288
  Static.Tuple<[Static.Const<SemiColon>]>,
211
289
  Static.Tuple<[Static.Const<Newline>]>
212
290
  ]>;
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);
291
+ type PropertiesReduce<PropertiesArray extends Types.TProperties[], Result extends Types.TProperties = {}> = (PropertiesArray extends [infer Left extends Types.TProperties, ...infer Right extends Types.TProperties[]] ? PropertiesReduce<Right, Types.Evaluate<Result & Left>> : Result);
214
292
  interface PropertiesMapping extends Static.IMapping {
215
293
  output: this['input'] extends Types.TProperties[] ? PropertiesReduce<this['input']> : never;
216
294
  }
@@ -263,7 +341,7 @@ type Constructor = Static.Tuple<[
263
341
  Type
264
342
  ], ConstructorMapping>;
265
343
  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'];
344
+ 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
345
  }
268
346
  type Mapped = Static.Tuple<[
269
347
  Static.Const<LBrace>,
@@ -468,4 +546,10 @@ type Uncapitalize = Static.Tuple<[
468
546
  ], UncapitalizeMapping>;
469
547
  type Date = Static.Const<'Date', Static.As<Types.TDate>>;
470
548
  type Uint8Array = Static.Const<'Uint8Array', Static.As<Types.TUint8Array>>;
549
+ export type Main = Static.Union<[
550
+ ModuleDeclaration,
551
+ TypeAliasDeclaration,
552
+ InterfaceDeclaration,
553
+ Type
554
+ ]>;
471
555
  export {};
@@ -11,6 +11,7 @@ import type { TAsyncIterator } from '../async-iterator/index.mjs';
11
11
  import type { TBigInt } from '../bigint/index.mjs';
12
12
  import type { TConstructor } from '../constructor/index.mjs';
13
13
  import type { TFunction } from '../function/index.mjs';
14
+ import type { TImport } from '../module/index.mjs';
14
15
  import type { TInteger } from '../integer/index.mjs';
15
16
  import type { TIntersect } from '../intersect/index.mjs';
16
17
  import type { TIterator } from '../iterator/index.mjs';
@@ -57,6 +58,8 @@ export declare function IsDate(value: unknown): value is TDate;
57
58
  /** `[Kind-Only]` Returns true if the given value is TFunction */
58
59
  export declare function IsFunction(value: unknown): value is TFunction;
59
60
  /** `[Kind-Only]` Returns true if the given value is TInteger */
61
+ export declare function IsImport(value: unknown): value is TImport;
62
+ /** `[Kind-Only]` Returns true if the given value is TInteger */
60
63
  export declare function IsInteger(value: unknown): value is TInteger;
61
64
  /** `[Kind-Only]` Returns true if the given schema is TProperties */
62
65
  export declare function IsProperties(value: unknown): value is TProperties;
@@ -41,6 +41,10 @@ export function IsFunction(value) {
41
41
  return IsKindOf(value, 'Function');
42
42
  }
43
43
  /** `[Kind-Only]` Returns true if the given value is TInteger */
44
+ export function IsImport(value) {
45
+ return IsKindOf(value, 'Import');
46
+ }
47
+ /** `[Kind-Only]` Returns true if the given value is TInteger */
44
48
  export function IsInteger(value) {
45
49
  return IsKindOf(value, 'Integer');
46
50
  }
@@ -12,6 +12,7 @@ import type { TAsyncIterator } from '../async-iterator/index.mjs';
12
12
  import type { TBigInt } from '../bigint/index.mjs';
13
13
  import type { TConstructor } from '../constructor/index.mjs';
14
14
  import type { TFunction } from '../function/index.mjs';
15
+ import type { TImport } from '../module/index.mjs';
15
16
  import type { TInteger } from '../integer/index.mjs';
16
17
  import type { TIntersect } from '../intersect/index.mjs';
17
18
  import type { TIterator } from '../iterator/index.mjs';
@@ -59,6 +60,8 @@ export declare function IsConstructor(value: unknown): value is TConstructor;
59
60
  export declare function IsDate(value: unknown): value is TDate;
60
61
  /** Returns true if the given value is TFunction */
61
62
  export declare function IsFunction(value: unknown): value is TFunction;
63
+ /** Returns true if the given value is TImport */
64
+ export declare function IsImport(value: unknown): value is TImport;
62
65
  /** Returns true if the given value is TInteger */
63
66
  export declare function IsInteger(value: unknown): value is TInteger;
64
67
  /** Returns true if the given schema is TProperties */
@@ -173,6 +173,18 @@ export function IsFunction(value) {
173
173
  value.parameters.every(schema => IsSchema(schema)) &&
174
174
  IsSchema(value.returns));
175
175
  }
176
+ /** Returns true if the given value is TImport */
177
+ export function IsImport(value) {
178
+ // prettier-ignore
179
+ return (IsKindOf(value, 'Import') &&
180
+ ValueGuard.HasPropertyKey(value, '$defs') &&
181
+ ValueGuard.IsObject(value.$defs) &&
182
+ IsProperties(value.$defs) &&
183
+ ValueGuard.HasPropertyKey(value, '$ref') &&
184
+ ValueGuard.IsString(value.$ref) &&
185
+ value.$ref in value.$defs // required
186
+ );
187
+ }
176
188
  /** Returns true if the given value is TInteger */
177
189
  export function IsInteger(value) {
178
190
  return (IsKindOf(value, 'Integer') &&
@@ -10,7 +10,6 @@ export * from './const/index.mjs';
10
10
  export * from './constructor/index.mjs';
11
11
  export * from './constructor-parameters/index.mjs';
12
12
  export * from './date/index.mjs';
13
- export * from './deref/index.mjs';
14
13
  export * from './discard/index.mjs';
15
14
  export * from './enum/index.mjs';
16
15
  export * from './error/index.mjs';
@@ -29,6 +28,7 @@ export * from './iterator/index.mjs';
29
28
  export * from './keyof/index.mjs';
30
29
  export * from './literal/index.mjs';
31
30
  export * from './mapped/index.mjs';
31
+ export * from './module/index.mjs';
32
32
  export * from './never/index.mjs';
33
33
  export * from './not/index.mjs';
34
34
  export * from './null/index.mjs';
@@ -54,7 +54,6 @@ export * from './return-type/index.mjs';
54
54
  export * from './schema/index.mjs';
55
55
  export * from './sets/index.mjs';
56
56
  export * from './static/index.mjs';
57
- export * from './strict/index.mjs';
58
57
  export * from './string/index.mjs';
59
58
  export * from './symbol/index.mjs';
60
59
  export * from './symbols/index.mjs';
@@ -10,7 +10,6 @@ export * from './const/index.mjs';
10
10
  export * from './constructor/index.mjs';
11
11
  export * from './constructor-parameters/index.mjs';
12
12
  export * from './date/index.mjs';
13
- export * from './deref/index.mjs';
14
13
  export * from './discard/index.mjs';
15
14
  export * from './enum/index.mjs';
16
15
  export * from './error/index.mjs';
@@ -29,6 +28,7 @@ export * from './iterator/index.mjs';
29
28
  export * from './keyof/index.mjs';
30
29
  export * from './literal/index.mjs';
31
30
  export * from './mapped/index.mjs';
31
+ export * from './module/index.mjs';
32
32
  export * from './never/index.mjs';
33
33
  export * from './not/index.mjs';
34
34
  export * from './null/index.mjs';
@@ -54,7 +54,6 @@ export * from './return-type/index.mjs';
54
54
  export * from './schema/index.mjs';
55
55
  export * from './sets/index.mjs';
56
56
  export * from './static/index.mjs';
57
- export * from './strict/index.mjs';
58
57
  export * from './string/index.mjs';
59
58
  export * from './symbol/index.mjs';
60
59
  export * from './symbols/index.mjs';
@@ -0,0 +1 @@
1
+ export * from './module.mjs';
@@ -0,0 +1 @@
1
+ export * from './module.mjs';
@@ -0,0 +1,71 @@
1
+ import { Ensure } from '../helpers/index.mjs';
2
+ import { Kind } from '../symbols/index.mjs';
3
+ import { SchemaOptions, TSchema } from '../schema/index.mjs';
4
+ import { TObject, TProperties } from '../object/index.mjs';
5
+ import { TConstructor } from '../constructor/index.mjs';
6
+ import { TFunction } from '../function/index.mjs';
7
+ import { TTuple } from '../tuple/index.mjs';
8
+ import { TIntersect } from '../intersect/index.mjs';
9
+ import { TUnion } from '../union/index.mjs';
10
+ import { TArray } from '../array/index.mjs';
11
+ import { TAsyncIterator } from '../async-iterator/index.mjs';
12
+ import { TIterator } from '../iterator/index.mjs';
13
+ import { TLiteral, TLiteralValue } from '../literal/index.mjs';
14
+ import { TAny } from '../any/index.mjs';
15
+ import { TBigInt } from '../bigint/index.mjs';
16
+ import { TBoolean } from '../boolean/index.mjs';
17
+ import { TDate } from '../date/index.mjs';
18
+ import { TInteger } from '../integer/index.mjs';
19
+ import { TNever } from '../never/index.mjs';
20
+ import { TNumber } from '../number/index.mjs';
21
+ import { TNull } from '../null/index.mjs';
22
+ import { TRef } from '../ref/index.mjs';
23
+ import { TRegExp } from '../regexp/index.mjs';
24
+ import { TString } from '../string/index.mjs';
25
+ import { TSymbol } from '../symbol/index.mjs';
26
+ import { TTemplateLiteral, TTemplateLiteralKind } from '../template-literal/index.mjs';
27
+ import { TUint8Array } from '../uint8array/index.mjs';
28
+ import { TUndefined } from '../undefined/index.mjs';
29
+ import { TUnknown } from '../unknown/index.mjs';
30
+ import { TVoid } from '../void/index.mjs';
31
+ import { Static } from '../static/index.mjs';
32
+ type InferImport<Properties extends TProperties, Key extends keyof Properties, ModuleProperties extends TProperties> = (Infer<Properties[Key], ModuleProperties>);
33
+ type InferRef<Ref extends string, Properties extends TProperties> = (Ref extends keyof Properties ? Infer<Properties[Ref], Properties> : never);
34
+ type InferObject<Properties extends TProperties, ModuleProperties extends TProperties> = {
35
+ [K in keyof Properties]: Infer<Properties[K], ModuleProperties>;
36
+ } & {};
37
+ type InferConstructor<Parameters extends TSchema[], InstanceType extends TSchema, Properties extends TProperties> = Ensure<new (...args: InferTuple<Parameters, Properties>) => Infer<InstanceType, Properties>>;
38
+ type InferFunction<Parameters extends TSchema[], ReturnType extends TSchema, Properties extends TProperties> = Ensure<(...args: InferTuple<Parameters, Properties>) => Infer<ReturnType, Properties>>;
39
+ type InferTuple<Types extends TSchema[], Properties extends TProperties, Result extends unknown[] = []> = (Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? InferTuple<R, Properties, [...Result, Infer<L, Properties>]> : Result);
40
+ type InferIntersect<Types extends TSchema[], Properties extends TProperties, Result extends unknown = unknown> = (Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? InferIntersect<R, Properties, Result & Infer<L, Properties>> : Result);
41
+ type InferUnion<Types extends TSchema[], Properties extends TProperties, Result extends unknown = never> = (Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? InferUnion<R, Properties, Result | Infer<L, Properties>> : Result);
42
+ type InferArray<Type extends TSchema, Module extends TProperties> = (Ensure<Array<Infer<Type, Module>>>);
43
+ type InferAsyncIterator<Type extends TSchema, Properties extends TProperties> = (Ensure<AsyncIterableIterator<Infer<Type, Properties>>>);
44
+ type InferIterator<Type extends TSchema, Properties extends TProperties> = (Ensure<IterableIterator<Infer<Type, Properties>>>);
45
+ type Infer<Type extends TSchema, Properties extends TProperties = {}> = (Type extends TImport<infer S extends TProperties, infer K extends string> ? InferImport<S, K, S> : Type extends TRef<infer S extends string> ? InferRef<S, Properties> : Type extends TObject<infer S extends TProperties> ? InferObject<S, Properties> : Type extends TConstructor<infer S extends TSchema[], infer R extends TSchema> ? InferConstructor<S, R, Properties> : Type extends TFunction<infer S extends TSchema[], infer R extends TSchema> ? InferFunction<S, R, Properties> : Type extends TTuple<infer S extends TSchema[]> ? InferTuple<S, Properties> : Type extends TIntersect<infer S extends TSchema[]> ? InferIntersect<S, Properties> : Type extends TUnion<infer S extends TSchema[]> ? InferUnion<S, Properties> : Type extends TArray<infer S extends TSchema> ? InferArray<S, Properties> : Type extends TAsyncIterator<infer S extends TSchema> ? InferAsyncIterator<S, Properties> : Type extends TIterator<infer S extends TSchema> ? InferIterator<S, Properties> : Type extends TTemplateLiteral<infer S extends TTemplateLiteralKind[]> ? Static<TTemplateLiteral<S>> : Type extends TLiteral<infer S extends TLiteralValue> ? S : Type extends TAny ? any : Type extends TBigInt ? bigint : Type extends TBoolean ? boolean : Type extends TDate ? Date : Type extends TInteger ? number : Type extends TNever ? never : Type extends TNumber ? number : Type extends TRegExp ? string : Type extends TString ? string : Type extends TSymbol ? symbol : Type extends TNull ? null : Type extends TUint8Array ? Uint8Array : Type extends TUndefined ? undefined : Type extends TUnknown ? unknown : Type extends TVoid ? void : never);
46
+ export interface TDefinitions<ModuleProperties extends TProperties> extends TSchema {
47
+ static: {
48
+ [K in keyof ModuleProperties]: Static<ModuleProperties[K]>;
49
+ };
50
+ $defs: ModuleProperties;
51
+ }
52
+ export interface TImport<ModuleProperties extends TProperties = {}, Key extends keyof ModuleProperties = keyof ModuleProperties> extends TSchema {
53
+ [Kind]: 'Import';
54
+ static: InferImport<ModuleProperties, Key, ModuleProperties>;
55
+ $defs: ModuleProperties;
56
+ $ref: Key;
57
+ }
58
+ export declare class TModule<Properties extends TProperties> {
59
+ private readonly $defs;
60
+ private readonly options;
61
+ constructor($defs: Properties, options?: SchemaOptions);
62
+ /** `[Json]` Returns the Type definitions for this module */
63
+ Defs(): TDefinitions<Properties>;
64
+ /** `[Json]` Imports a Type by Key. */
65
+ Import<Key extends keyof Properties>(key: Key, options?: SchemaOptions): TImport<Properties, Key>;
66
+ /** `[Internal]` For each definition, assign an `$id` property. */
67
+ private ResolveDefinitionsWithIdentifiers;
68
+ }
69
+ /** `[Json]` Creates a Type Definition Module. */
70
+ export declare function Module<Properties extends TProperties>(properties: Properties): TModule<Properties>;
71
+ export {};
@@ -0,0 +1,28 @@
1
+ import { CreateType } from '../create/index.mjs';
2
+ import { Kind } from '../symbols/index.mjs';
3
+ // ------------------------------------------------------------------
4
+ // Module
5
+ // ------------------------------------------------------------------
6
+ // prettier-ignore
7
+ export class TModule {
8
+ constructor($defs, options = {}) {
9
+ this.$defs = $defs;
10
+ this.options = options;
11
+ }
12
+ /** `[Json]` Returns the Type definitions for this module */
13
+ Defs() {
14
+ return CreateType({ $defs: this.ResolveDefinitionsWithIdentifiers() }, this.options);
15
+ }
16
+ /** `[Json]` Imports a Type by Key. */
17
+ Import(key, options) {
18
+ return CreateType({ [Kind]: 'Import', $defs: this.ResolveDefinitionsWithIdentifiers(), $ref: key }, options);
19
+ }
20
+ /** `[Internal]` For each definition, assign an `$id` property. */
21
+ ResolveDefinitionsWithIdentifiers() {
22
+ return globalThis.Object.getOwnPropertyNames(this.$defs).reduce((Result, Key) => ({ ...Result, [Key]: { ...this.$defs[Key], $id: Key } }), {});
23
+ }
24
+ }
25
+ /** `[Json]` Creates a Type Definition Module. */
26
+ export function Module(properties) {
27
+ return new TModule(properties);
28
+ }
@@ -1,12 +1,9 @@
1
1
  import type { TSchema, SchemaOptions } from '../schema/index.mjs';
2
- import type { Static } from '../static/index.mjs';
3
2
  import { Kind } from '../symbols/index.mjs';
4
- export interface TRef<T extends TSchema = TSchema> extends TSchema {
3
+ export interface TRef<Ref extends string = string> extends TSchema {
5
4
  [Kind]: 'Ref';
6
- static: Static<T, this['params']>;
7
- $ref: string;
5
+ static: unknown;
6
+ $ref: Ref;
8
7
  }
9
8
  /** `[Json]` Creates a Ref type. The referenced type must contain a $id */
10
- export declare function Ref<T extends TSchema>(schema: T, options?: SchemaOptions): TRef<T>;
11
- /** `[Json]` Creates a Ref type. */
12
- export declare function Ref<T extends TSchema>($ref: string, options?: SchemaOptions): TRef<T>;
9
+ export declare function Ref<Ref extends string>($ref: Ref, options?: SchemaOptions): TRef<Ref>;
@@ -1,14 +1,6 @@
1
1
  import { CreateType } from '../create/type.mjs';
2
2
  import { Kind } from '../symbols/index.mjs';
3
- // ------------------------------------------------------------------
4
- // ValueGuard
5
- // ------------------------------------------------------------------
6
- import { IsString, IsUndefined } from '../guard/value.mjs';
7
- /** `[Json]` Creates a Ref type. */
8
- export function Ref(unresolved, options) {
9
- if (IsString(unresolved))
10
- return CreateType({ [Kind]: 'Ref', $ref: unresolved }, options);
11
- if (IsUndefined(unresolved.$id))
12
- throw new Error('Reference target type must specify an $id');
13
- return CreateType({ [Kind]: 'Ref', $ref: unresolved.$id }, options);
3
+ /** `[Json]` Creates a Ref type. The referenced type must contain a $id */
4
+ export function Ref($ref, options) {
5
+ return CreateType({ [Kind]: 'Ref', $ref }, options);
14
6
  }
@@ -23,7 +23,7 @@ export type TDecodeProperties<T extends TProperties> = {
23
23
  [K in keyof T]: TDecodeType<T[K]>;
24
24
  };
25
25
  export type TDecodeRest<T extends TSchema[], Acc extends TSchema[] = []> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TDecodeRest<R, [...Acc, TDecodeType<L>]> : Acc;
26
- export type TDecodeType<T extends TSchema> = (T extends TOptional<infer S extends TSchema> ? TOptional<TDecodeType<S>> : T extends TReadonly<infer S extends TSchema> ? TReadonly<TDecodeType<S>> : T extends TTransform<infer _, infer R> ? TUnsafe<R> : T extends TArray<infer S extends TSchema> ? TArray<TDecodeType<S>> : T extends TAsyncIterator<infer S extends TSchema> ? TAsyncIterator<TDecodeType<S>> : T extends TConstructor<infer P extends TSchema[], infer R extends TSchema> ? TConstructor<TDecodeRest<P>, TDecodeType<R>> : T extends TEnum<infer S> ? TEnum<S> : T extends TFunction<infer P extends TSchema[], infer R extends TSchema> ? TFunction<TDecodeRest<P>, TDecodeType<R>> : T extends TIntersect<infer S extends TSchema[]> ? TIntersect<TDecodeRest<S>> : T extends TIterator<infer S extends TSchema> ? TIterator<TDecodeType<S>> : T extends TNot<infer S extends TSchema> ? TNot<TDecodeType<S>> : T extends TObject<infer S> ? TObject<Evaluate<TDecodeProperties<S>>> : T extends TPromise<infer S extends TSchema> ? TPromise<TDecodeType<S>> : T extends TRecord<infer K, infer S> ? TRecord<K, TDecodeType<S>> : T extends TRecursive<infer S extends TSchema> ? TRecursive<TDecodeType<S>> : T extends TRef<infer S extends TSchema> ? TRef<TDecodeType<S>> : T extends TTuple<infer S extends TSchema[]> ? TTuple<TDecodeRest<S>> : T extends TUnion<infer S extends TSchema[]> ? TUnion<TDecodeRest<S>> : T);
26
+ export type TDecodeType<T extends TSchema> = (T extends TOptional<infer S extends TSchema> ? TOptional<TDecodeType<S>> : T extends TReadonly<infer S extends TSchema> ? TReadonly<TDecodeType<S>> : T extends TTransform<infer _, infer R> ? TUnsafe<R> : T extends TArray<infer S extends TSchema> ? TArray<TDecodeType<S>> : T extends TAsyncIterator<infer S extends TSchema> ? TAsyncIterator<TDecodeType<S>> : T extends TConstructor<infer P extends TSchema[], infer R extends TSchema> ? TConstructor<TDecodeRest<P>, TDecodeType<R>> : T extends TEnum<infer S> ? TEnum<S> : T extends TFunction<infer P extends TSchema[], infer R extends TSchema> ? TFunction<TDecodeRest<P>, TDecodeType<R>> : T extends TIntersect<infer S extends TSchema[]> ? TIntersect<TDecodeRest<S>> : T extends TIterator<infer S extends TSchema> ? TIterator<TDecodeType<S>> : T extends TNot<infer S extends TSchema> ? TNot<TDecodeType<S>> : T extends TObject<infer S> ? TObject<Evaluate<TDecodeProperties<S>>> : T extends TPromise<infer S extends TSchema> ? TPromise<TDecodeType<S>> : T extends TRecord<infer K, infer S> ? TRecord<K, TDecodeType<S>> : T extends TRecursive<infer S extends TSchema> ? TRecursive<TDecodeType<S>> : T extends TRef<infer S extends string> ? TRef<S> : T extends TTuple<infer S extends TSchema[]> ? TTuple<TDecodeRest<S>> : T extends TUnion<infer S extends TSchema[]> ? TUnion<TDecodeRest<S>> : T);
27
27
  export type StaticDecodeIsAny<T> = boolean extends (T extends TSchema ? true : false) ? true : false;
28
28
  /** Creates an decoded static type from a TypeBox type */
29
29
  export type StaticDecode<T extends TSchema, P extends unknown[] = []> = StaticDecodeIsAny<T> extends true ? unknown : Static<TDecodeType<T>, P>;
@@ -3,7 +3,6 @@ import { type TArray, type ArrayOptions } from '../array/index.mjs';
3
3
  import { type TBoolean } from '../boolean/index.mjs';
4
4
  import { type TComposite } from '../composite/index.mjs';
5
5
  import { type TConst } from '../const/index.mjs';
6
- import { type TDeref } from '../deref/index.mjs';
7
6
  import { type TEnum, type TEnumKey, type TEnumValue } from '../enum/index.mjs';
8
7
  import { type TExclude, type TExcludeFromMappedResult, type TExcludeFromTemplateLiteral } from '../exclude/index.mjs';
9
8
  import { type TExtends, type TExtendsFromMappedKey, type TExtendsFromMappedResult } from '../extends/index.mjs';
@@ -19,6 +18,7 @@ import { type TNever } from '../never/index.mjs';
19
18
  import { type TNot } from '../not/index.mjs';
20
19
  import { type TNull } from '../null/index.mjs';
21
20
  import { type TMappedKey } from '../mapped/index.mjs';
21
+ import { TModule } from '../module/index.mjs';
22
22
  import { type TNumber, type NumberOptions } from '../number/index.mjs';
23
23
  import { type TObject, type TProperties, type ObjectOptions } from '../object/index.mjs';
24
24
  import { type TOmit, type TOmitFromMappedKey, type TOmitFromMappedResult } from '../omit/index.mjs';
@@ -33,7 +33,6 @@ import { type TRef } from '../ref/index.mjs';
33
33
  import { type TRequired, type TRequiredFromMappedResult } from '../required/index.mjs';
34
34
  import { type TRest } from '../rest/index.mjs';
35
35
  import { type TSchema, type SchemaOptions } from '../schema/index.mjs';
36
- import { type TStrict } from '../strict/index.mjs';
37
36
  import { type TString, type StringOptions } from '../string/index.mjs';
38
37
  import { type TTemplateLiteral, type TTemplateLiteralKind, type TTemplateLiteralSyntax } from '../template-literal/index.mjs';
39
38
  import { TransformDecodeBuilder } from '../transform/index.mjs';
@@ -43,16 +42,6 @@ import { type TUnknown } from '../unknown/index.mjs';
43
42
  import { type TUnsafe, type UnsafeOptions } from '../unsafe/index.mjs';
44
43
  /** Json Type Builder with Static Resolution for TypeScript */
45
44
  export declare class JsonTypeBuilder {
46
- /**
47
- * @deprecated `[Json]` Omits compositing symbols from this schema. It is recommended
48
- * to use the JSON parse/stringify to remove compositing symbols if needed. This
49
- * is how Strict works internally.
50
- *
51
- * ```typescript
52
- * JSON.parse(JSON.stringify(Type.String()))
53
- * ```
54
- */
55
- Strict<T extends TSchema>(schema: T): TStrict<T>;
56
45
  /** `[Json]` Creates a Readonly and Optional property */
57
46
  ReadonlyOptional<T extends TSchema>(schema: T): TReadonlyOptional<T>;
58
47
  /** `[Json]` Creates a Readonly property */
@@ -83,8 +72,6 @@ export declare class JsonTypeBuilder {
83
72
  Composite<T extends TSchema[]>(schemas: [...T], options?: ObjectOptions): TComposite<T>;
84
73
  /** `[JavaScript]` Creates a readonly const type from the given value. */
85
74
  Const</* const (not supported in 4.0) */ T>(value: T, options?: SchemaOptions): TConst<T>;
86
- /** `[Json]` Creates a dereferenced type */
87
- Deref<T extends TSchema>(schema: T, references: TSchema[]): TDeref<T>;
88
75
  /** `[Json]` Creates a Enum type */
89
76
  Enum<V extends TEnumValue, T extends Record<TEnumKey, V>>(item: T, options?: SchemaOptions): TEnum<T>;
90
77
  /** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */
@@ -129,6 +116,8 @@ export declare class JsonTypeBuilder {
129
116
  Mapped<K extends TSchema, I extends PropertyKey[] = TIndexPropertyKeys<K>, F extends TMappedFunction<I> = TMappedFunction<I>, R extends TMapped<I, F> = TMapped<I, F>>(key: K, map: F, options?: ObjectOptions): R;
130
117
  /** `[Json]` Creates a Mapped object type */
131
118
  Mapped<K extends PropertyKey[], F extends TMappedFunction<K> = TMappedFunction<K>, R extends TMapped<K, F> = TMapped<K, F>>(key: [...K], map: F, options?: ObjectOptions): R;
119
+ /** `[Json]` Creates a Type Definition Module. */
120
+ Module<Properties extends TProperties>(properties: Properties): TModule<Properties>;
132
121
  /** `[Json]` Creates a Never type */
133
122
  Never(options?: SchemaOptions): TNever;
134
123
  /** `[Json]` Creates a Not type */
@@ -163,10 +152,8 @@ export declare class JsonTypeBuilder {
163
152
  Record<K extends TSchema, T extends TSchema>(key: K, schema: T, options?: ObjectOptions): TRecordOrObject<K, T>;
164
153
  /** `[Json]` Creates a Recursive type */
165
154
  Recursive<T extends TSchema>(callback: (thisType: TThis) => T, options?: SchemaOptions): TRecursive<T>;
166
- /** `[Json]` Creates a Ref type. The referenced type must contain a $id */
167
- Ref<T extends TSchema>(schema: T, options?: SchemaOptions): TRef<T>;
168
155
  /** `[Json]` Creates a Ref type. */
169
- Ref<T extends TSchema>($ref: string, options?: SchemaOptions): TRef<T>;
156
+ Ref<Ref extends string>($ref: Ref, options?: SchemaOptions): TRef<Ref>;
170
157
  /** `[Json]` Constructs a type where all properties are required */
171
158
  Required<T extends TMappedResult>(T: T, options?: SchemaOptions): TRequiredFromMappedResult<T>;
172
159
  /** `[Json]` Constructs a type where all properties are required */
@@ -3,7 +3,6 @@ import { Array } from '../array/index.mjs';
3
3
  import { Boolean } from '../boolean/index.mjs';
4
4
  import { Composite } from '../composite/index.mjs';
5
5
  import { Const } from '../const/index.mjs';
6
- import { Deref } from '../deref/index.mjs';
7
6
  import { Enum } from '../enum/index.mjs';
8
7
  import { Exclude } from '../exclude/index.mjs';
9
8
  import { Extends } from '../extends/index.mjs';
@@ -18,6 +17,7 @@ import { Mapped } from '../mapped/index.mjs';
18
17
  import { Never } from '../never/index.mjs';
19
18
  import { Not } from '../not/index.mjs';
20
19
  import { Null } from '../null/index.mjs';
20
+ import { Module } from '../module/index.mjs';
21
21
  import { Number } from '../number/index.mjs';
22
22
  import { Object } from '../object/index.mjs';
23
23
  import { Omit } from '../omit/index.mjs';
@@ -31,7 +31,6 @@ import { Recursive } from '../recursive/index.mjs';
31
31
  import { Ref } from '../ref/index.mjs';
32
32
  import { Required } from '../required/index.mjs';
33
33
  import { Rest } from '../rest/index.mjs';
34
- import { Strict } from '../strict/index.mjs';
35
34
  import { String } from '../string/index.mjs';
36
35
  import { TemplateLiteral } from '../template-literal/index.mjs';
37
36
  import { Transform } from '../transform/index.mjs';
@@ -41,21 +40,6 @@ import { Unknown } from '../unknown/index.mjs';
41
40
  import { Unsafe } from '../unsafe/index.mjs';
42
41
  /** Json Type Builder with Static Resolution for TypeScript */
43
42
  export class JsonTypeBuilder {
44
- // ------------------------------------------------------------------------
45
- // Strict
46
- // ------------------------------------------------------------------------
47
- /**
48
- * @deprecated `[Json]` Omits compositing symbols from this schema. It is recommended
49
- * to use the JSON parse/stringify to remove compositing symbols if needed. This
50
- * is how Strict works internally.
51
- *
52
- * ```typescript
53
- * JSON.parse(JSON.stringify(Type.String()))
54
- * ```
55
- */
56
- Strict(schema) {
57
- return Strict(schema);
58
- }
59
43
  // ------------------------------------------------------------------------
60
44
  // Modifiers
61
45
  // ------------------------------------------------------------------------
@@ -98,10 +82,6 @@ export class JsonTypeBuilder {
98
82
  Const(value, options) {
99
83
  return Const(value, options);
100
84
  }
101
- /** `[Json]` Creates a dereferenced type */
102
- Deref(schema, references) {
103
- return Deref(schema, references);
104
- }
105
85
  /** `[Json]` Creates a Enum type */
106
86
  Enum(item, options) {
107
87
  return Enum(item, options);
@@ -146,6 +126,10 @@ export class JsonTypeBuilder {
146
126
  Mapped(key, map, options) {
147
127
  return Mapped(key, map, options);
148
128
  }
129
+ /** `[Json]` Creates a Type Definition Module. */
130
+ Module(properties) {
131
+ return Module(properties);
132
+ }
149
133
  /** `[Json]` Creates a Never type */
150
134
  Never(options) {
151
135
  return Never(options);
@@ -187,8 +171,8 @@ export class JsonTypeBuilder {
187
171
  return Recursive(callback, options);
188
172
  }
189
173
  /** `[Json]` Creates a Ref type. */
190
- Ref(unresolved, options) {
191
- return Ref(unresolved, options);
174
+ Ref($ref, options) {
175
+ return Ref($ref, options);
192
176
  }
193
177
  /** `[Json]` Constructs a type where all properties are required */
194
178
  Required(schema, options) {
@@ -9,7 +9,6 @@ export { Const } from '../const/index.mjs';
9
9
  export { Constructor } from '../constructor/index.mjs';
10
10
  export { ConstructorParameters } from '../constructor-parameters/index.mjs';
11
11
  export { Date } from '../date/index.mjs';
12
- export { Deref } from '../deref/index.mjs';
13
12
  export { Enum } from '../enum/index.mjs';
14
13
  export { Exclude } from '../exclude/index.mjs';
15
14
  export { Extends } from '../extends/index.mjs';
@@ -24,6 +23,7 @@ export { Iterator } from '../iterator/index.mjs';
24
23
  export { KeyOf } from '../keyof/index.mjs';
25
24
  export { Literal } from '../literal/index.mjs';
26
25
  export { Mapped } from '../mapped/index.mjs';
26
+ export { Module } from '../module/index.mjs';
27
27
  export { Never } from '../never/index.mjs';
28
28
  export { Not } from '../not/index.mjs';
29
29
  export { Null } from '../null/index.mjs';
@@ -45,7 +45,6 @@ export { Required } from '../required/index.mjs';
45
45
  export { Rest } from '../rest/index.mjs';
46
46
  export { ReturnType } from '../return-type/index.mjs';
47
47
  export { String } from '../string/index.mjs';
48
- export { Strict } from '../strict/index.mjs';
49
48
  export { Symbol } from '../symbol/index.mjs';
50
49
  export { TemplateLiteral } from '../template-literal/index.mjs';
51
50
  export { Transform } from '../transform/index.mjs';