@sinclair/typebox 0.34.15 → 0.34.17

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 (141) hide show
  1. package/build/cjs/compiler/compiler.js +5 -0
  2. package/build/cjs/errors/errors.js +3 -0
  3. package/build/cjs/index.d.ts +3 -0
  4. package/build/cjs/index.js +3 -0
  5. package/build/cjs/syntax/index.d.ts +1 -1
  6. package/build/cjs/syntax/index.js +1 -1
  7. package/build/cjs/syntax/runtime.d.ts +40 -54
  8. package/build/cjs/syntax/runtime.js +91 -203
  9. package/build/cjs/syntax/static.d.ts +80 -146
  10. package/build/cjs/syntax/syntax.d.ts +33 -0
  11. package/build/cjs/syntax/syntax.js +37 -0
  12. package/build/cjs/type/argument/argument.d.ts +9 -0
  13. package/build/cjs/type/argument/argument.js +10 -0
  14. package/build/cjs/type/argument/index.d.ts +1 -0
  15. package/build/cjs/type/argument/index.js +18 -0
  16. package/build/cjs/type/constructor-parameters/constructor-parameters.d.ts +3 -3
  17. package/build/cjs/type/constructor-parameters/constructor-parameters.js +3 -1
  18. package/build/cjs/type/guard/kind.d.ts +9 -6
  19. package/build/cjs/type/guard/kind.js +6 -0
  20. package/build/cjs/type/guard/type.d.ts +9 -6
  21. package/build/cjs/type/guard/type.js +9 -0
  22. package/build/cjs/type/index.d.ts +2 -0
  23. package/build/cjs/type/index.js +2 -0
  24. package/build/cjs/type/instance-type/instance-type.d.ts +5 -4
  25. package/build/cjs/type/instance-type/instance-type.js +3 -1
  26. package/build/cjs/type/instantiate/index.d.ts +1 -0
  27. package/build/cjs/type/instantiate/index.js +18 -0
  28. package/build/cjs/type/instantiate/instantiate.d.ts +25 -0
  29. package/build/cjs/type/instantiate/instantiate.js +32 -0
  30. package/build/cjs/type/parameters/parameters.d.ts +3 -3
  31. package/build/cjs/type/parameters/parameters.js +3 -1
  32. package/build/cjs/type/record/record.d.ts +16 -1
  33. package/build/cjs/type/record/record.js +53 -23
  34. package/build/cjs/type/remap/index.d.ts +1 -0
  35. package/build/cjs/type/remap/index.js +18 -0
  36. package/build/cjs/type/remap/remap.d.ts +19 -0
  37. package/build/cjs/type/remap/remap.js +35 -0
  38. package/build/cjs/type/return-type/return-type.d.ts +5 -4
  39. package/build/cjs/type/return-type/return-type.js +3 -1
  40. package/build/cjs/type/type/javascript.d.ts +10 -4
  41. package/build/cjs/type/type/javascript.js +44 -34
  42. package/build/cjs/type/type/type.d.ts +3 -0
  43. package/build/cjs/type/type/type.js +123 -117
  44. package/build/cjs/value/check/check.js +5 -0
  45. package/build/cjs/value/create/create.js +5 -0
  46. package/build/esm/compiler/compiler.mjs +5 -0
  47. package/build/esm/errors/errors.mjs +3 -0
  48. package/build/esm/index.d.mts +3 -0
  49. package/build/esm/index.mjs +3 -0
  50. package/build/esm/syntax/index.d.mts +1 -1
  51. package/build/esm/syntax/index.mjs +1 -1
  52. package/build/esm/syntax/runtime.d.mts +40 -54
  53. package/build/esm/syntax/runtime.mjs +91 -203
  54. package/build/esm/syntax/static.d.mts +80 -146
  55. package/build/esm/syntax/syntax.d.mts +33 -0
  56. package/build/esm/syntax/syntax.mjs +30 -0
  57. package/build/esm/type/argument/argument.d.mts +9 -0
  58. package/build/esm/type/argument/argument.mjs +6 -0
  59. package/build/esm/type/argument/index.d.mts +1 -0
  60. package/build/esm/type/argument/index.mjs +1 -0
  61. package/build/esm/type/constructor-parameters/constructor-parameters.d.mts +3 -3
  62. package/build/esm/type/constructor-parameters/constructor-parameters.mjs +3 -1
  63. package/build/esm/type/guard/kind.d.mts +9 -6
  64. package/build/esm/type/guard/kind.mjs +5 -0
  65. package/build/esm/type/guard/type.d.mts +9 -6
  66. package/build/esm/type/guard/type.mjs +8 -0
  67. package/build/esm/type/index.d.mts +2 -0
  68. package/build/esm/type/index.mjs +2 -0
  69. package/build/esm/type/instance-type/instance-type.d.mts +5 -4
  70. package/build/esm/type/instance-type/instance-type.mjs +3 -1
  71. package/build/esm/type/instantiate/index.d.mts +1 -0
  72. package/build/esm/type/instantiate/index.mjs +1 -0
  73. package/build/esm/type/instantiate/instantiate.d.mts +25 -0
  74. package/build/esm/type/instantiate/instantiate.mjs +28 -0
  75. package/build/esm/type/parameters/parameters.d.mts +3 -3
  76. package/build/esm/type/parameters/parameters.mjs +3 -1
  77. package/build/esm/type/record/record.d.mts +16 -1
  78. package/build/esm/type/record/record.mjs +35 -8
  79. package/build/esm/type/remap/index.d.mts +1 -0
  80. package/build/esm/type/remap/index.mjs +1 -0
  81. package/build/esm/type/remap/remap.d.mts +19 -0
  82. package/build/esm/type/remap/remap.mjs +31 -0
  83. package/build/esm/type/return-type/return-type.d.mts +5 -4
  84. package/build/esm/type/return-type/return-type.mjs +3 -1
  85. package/build/esm/type/type/javascript.d.mts +10 -4
  86. package/build/esm/type/type/javascript.mjs +10 -0
  87. package/build/esm/type/type/type.d.mts +3 -0
  88. package/build/esm/type/type/type.mjs +3 -0
  89. package/build/esm/value/check/check.mjs +5 -0
  90. package/build/esm/value/create/create.mjs +5 -0
  91. package/package.json +11 -1
  92. package/parser/package.json +4 -0
  93. package/readme.md +107 -184
  94. package/build/cjs/syntax/parse.d.ts +0 -15
  95. package/build/cjs/syntax/parse.js +0 -19
  96. package/build/esm/syntax/parse.d.mts +0 -15
  97. package/build/esm/syntax/parse.mjs +0 -14
  98. /package/build/cjs/{syntax/parsebox → parser}/index.d.ts +0 -0
  99. /package/build/cjs/{syntax/parsebox → parser}/index.js +0 -0
  100. /package/build/cjs/{syntax/parsebox → parser}/runtime/guard.d.ts +0 -0
  101. /package/build/cjs/{syntax/parsebox → parser}/runtime/guard.js +0 -0
  102. /package/build/cjs/{syntax/parsebox → parser}/runtime/index.d.ts +0 -0
  103. /package/build/cjs/{syntax/parsebox → parser}/runtime/index.js +0 -0
  104. /package/build/cjs/{syntax/parsebox → parser}/runtime/module.d.ts +0 -0
  105. /package/build/cjs/{syntax/parsebox → parser}/runtime/module.js +0 -0
  106. /package/build/cjs/{syntax/parsebox → parser}/runtime/parse.d.ts +0 -0
  107. /package/build/cjs/{syntax/parsebox → parser}/runtime/parse.js +0 -0
  108. /package/build/cjs/{syntax/parsebox → parser}/runtime/token.d.ts +0 -0
  109. /package/build/cjs/{syntax/parsebox → parser}/runtime/token.js +0 -0
  110. /package/build/cjs/{syntax/parsebox → parser}/runtime/types.d.ts +0 -0
  111. /package/build/cjs/{syntax/parsebox → parser}/runtime/types.js +0 -0
  112. /package/build/cjs/{syntax/parsebox → parser}/static/index.d.ts +0 -0
  113. /package/build/cjs/{syntax/parsebox → parser}/static/index.js +0 -0
  114. /package/build/cjs/{syntax/parsebox → parser}/static/parse.d.ts +0 -0
  115. /package/build/cjs/{syntax/parsebox → parser}/static/parse.js +0 -0
  116. /package/build/cjs/{syntax/parsebox → parser}/static/token.d.ts +0 -0
  117. /package/build/cjs/{syntax/parsebox → parser}/static/token.js +0 -0
  118. /package/build/cjs/{syntax/parsebox → parser}/static/types.d.ts +0 -0
  119. /package/build/cjs/{syntax/parsebox → parser}/static/types.js +0 -0
  120. /package/build/esm/{syntax/parsebox → parser}/index.d.mts +0 -0
  121. /package/build/esm/{syntax/parsebox → parser}/index.mjs +0 -0
  122. /package/build/esm/{syntax/parsebox → parser}/runtime/guard.d.mts +0 -0
  123. /package/build/esm/{syntax/parsebox → parser}/runtime/guard.mjs +0 -0
  124. /package/build/esm/{syntax/parsebox → parser}/runtime/index.d.mts +0 -0
  125. /package/build/esm/{syntax/parsebox → parser}/runtime/index.mjs +0 -0
  126. /package/build/esm/{syntax/parsebox → parser}/runtime/module.d.mts +0 -0
  127. /package/build/esm/{syntax/parsebox → parser}/runtime/module.mjs +0 -0
  128. /package/build/esm/{syntax/parsebox → parser}/runtime/parse.d.mts +0 -0
  129. /package/build/esm/{syntax/parsebox → parser}/runtime/parse.mjs +0 -0
  130. /package/build/esm/{syntax/parsebox → parser}/runtime/token.d.mts +0 -0
  131. /package/build/esm/{syntax/parsebox → parser}/runtime/token.mjs +0 -0
  132. /package/build/esm/{syntax/parsebox → parser}/runtime/types.d.mts +0 -0
  133. /package/build/esm/{syntax/parsebox → parser}/runtime/types.mjs +0 -0
  134. /package/build/esm/{syntax/parsebox → parser}/static/index.d.mts +0 -0
  135. /package/build/esm/{syntax/parsebox → parser}/static/index.mjs +0 -0
  136. /package/build/esm/{syntax/parsebox → parser}/static/parse.d.mts +0 -0
  137. /package/build/esm/{syntax/parsebox → parser}/static/parse.mjs +0 -0
  138. /package/build/esm/{syntax/parsebox → parser}/static/token.d.mts +0 -0
  139. /package/build/esm/{syntax/parsebox → parser}/static/token.mjs +0 -0
  140. /package/build/esm/{syntax/parsebox → parser}/static/types.d.mts +0 -0
  141. /package/build/esm/{syntax/parsebox → parser}/static/types.mjs +0 -0
@@ -1,5 +1,5 @@
1
- import { Static } from './parsebox/index.mjs';
2
- import * as Types from '../type/index.mjs';
1
+ import { Static } from '../parser/index.mjs';
2
+ import * as t from '../type/index.mjs';
3
3
  type Newline = '\n';
4
4
  type LBracket = '[';
5
5
  type RBracket = ']';
@@ -16,7 +16,6 @@ type SemiColon = ';';
16
16
  type SingleQuote = "'";
17
17
  type DoubleQuote = '"';
18
18
  type Tilde = '`';
19
- type Equals = '=';
20
19
  interface DelimitTailMapping<_ = unknown> extends Static.IMapping {
21
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 [_] ? [] : [
22
21
  ]);
@@ -42,98 +41,28 @@ type Delimit<Parser extends Static.IParser, Delimiter extends Static.IParser> =
42
41
  Static.Tuple<[Parser, DelimitTail<Parser, Delimiter>]>,
43
42
  Static.Tuple<[]>
44
43
  ], 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;
44
+ type Dereference<Context extends t.TProperties, Ref extends string> = (Ref extends keyof Context ? Context[Ref] : t.TRef<Ref>);
45
+ interface GenericReferenceMapping extends Static.IMapping {
46
+ output: this['context'] extends t.TProperties ? this['input'] extends [infer Reference extends string, LAngle, infer Parameters extends t.TSchema[], RAngle] ? t.TInstantiate<Dereference<this['context'], Reference>, [...Parameters]> : never : never;
48
47
  }
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'>,
48
+ type GenericReference = Static.Tuple<[
86
49
  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>;
50
+ Static.Const<LAngle>,
51
+ Elements,
52
+ Static.Const<RAngle>
53
+ ], GenericReferenceMapping>;
125
54
  interface ReferenceMapping extends Static.IMapping {
126
- output: this['context'] extends Types.TProperties ? this['input'] extends string ? Deref<this['context'], this['input']> : never : never;
55
+ output: this['context'] extends t.TProperties ? this['input'] extends string ? Dereference<this['context'], this['input']> : never : never;
127
56
  }
128
57
  type Reference = Static.Ident<ReferenceMapping>;
129
58
  interface LiteralBooleanMapping extends Static.IMapping {
130
- output: this['input'] extends `${infer S extends boolean}` ? Types.TLiteral<S> : never;
59
+ output: this['input'] extends `${infer S extends boolean}` ? t.TLiteral<S> : never;
131
60
  }
132
61
  interface LiteralNumberMapping extends Static.IMapping {
133
- output: this['input'] extends `${infer S extends number}` ? Types.TLiteral<S> : never;
62
+ output: this['input'] extends `${infer S extends number}` ? t.TLiteral<S> : never;
134
63
  }
135
64
  interface LiteralStringMapping extends Static.IMapping {
136
- output: this['input'] extends `${infer S extends string}` ? Types.TLiteral<S> : never;
65
+ output: this['input'] extends `${infer S extends string}` ? t.TLiteral<S> : never;
137
66
  }
138
67
  type Literal = Static.Union<[
139
68
  Static.Union<[Static.Const<'true'>, Static.Const<'false'>], LiteralBooleanMapping>,
@@ -141,18 +70,18 @@ type Literal = Static.Union<[
141
70
  Static.String<[DoubleQuote, SingleQuote, Tilde], LiteralStringMapping>
142
71
  ]>;
143
72
  type Keyword = Static.Union<[
144
- Static.Const<'any', Static.As<Types.TAny>>,
145
- Static.Const<'bigint', Static.As<Types.TBigInt>>,
146
- Static.Const<'boolean', Static.As<Types.TBoolean>>,
147
- Static.Const<'integer', Static.As<Types.TInteger>>,
148
- Static.Const<'never', Static.As<Types.TNever>>,
149
- Static.Const<'null', Static.As<Types.TNull>>,
150
- Static.Const<'number', Static.As<Types.TNumber>>,
151
- Static.Const<'string', Static.As<Types.TString>>,
152
- Static.Const<'symbol', Static.As<Types.TSymbol>>,
153
- Static.Const<'undefined', Static.As<Types.TUndefined>>,
154
- Static.Const<'unknown', Static.As<Types.TUnknown>>,
155
- Static.Const<'void', Static.As<Types.TVoid>>
73
+ Static.Const<'any', Static.As<t.TAny>>,
74
+ Static.Const<'bigint', Static.As<t.TBigInt>>,
75
+ Static.Const<'boolean', Static.As<t.TBoolean>>,
76
+ Static.Const<'integer', Static.As<t.TInteger>>,
77
+ Static.Const<'never', Static.As<t.TNever>>,
78
+ Static.Const<'null', Static.As<t.TNull>>,
79
+ Static.Const<'number', Static.As<t.TNumber>>,
80
+ Static.Const<'string', Static.As<t.TString>>,
81
+ Static.Const<'symbol', Static.As<t.TSymbol>>,
82
+ Static.Const<'undefined', Static.As<t.TUndefined>>,
83
+ Static.Const<'unknown', Static.As<t.TUnknown>>,
84
+ Static.Const<'void', Static.As<t.TVoid>>
156
85
  ]>;
157
86
  interface KeyOfMapping extends Static.IMapping {
158
87
  output: this['input'] extends [] ? false : true;
@@ -162,7 +91,7 @@ type KeyOf = Static.Union<[
162
91
  Static.Tuple<[]>
163
92
  ], KeyOfMapping>;
164
93
  interface IndexArrayMapping extends Static.IMapping {
165
- 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] : [
94
+ output: (this['input'] extends [LBracket, infer Type extends t.TSchema, RBracket, infer Rest extends unknown[]] ? [[Type], ...Rest] : this['input'] extends [LBracket, RBracket, infer Rest extends unknown[]] ? [[], ...Rest] : [
166
95
  ]);
167
96
  }
168
97
  type IndexArray = Static.Union<[
@@ -171,14 +100,14 @@ type IndexArray = Static.Union<[
171
100
  Static.Tuple<[]>
172
101
  ], IndexArrayMapping>;
173
102
  interface ExtendsMapping extends Static.IMapping {
174
- 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] : [];
103
+ output: this['input'] extends ['extends', infer Type extends t.TSchema, Question, infer True extends t.TSchema, Colon, infer False extends t.TSchema] ? [Type, True, False] : [];
175
104
  }
176
105
  type Extends = Static.Union<[
177
106
  Static.Tuple<[Static.Const<'extends'>, Type, Static.Const<Question>, Type, Static.Const<Colon>, Type]>,
178
107
  Static.Tuple<[]>
179
108
  ], ExtendsMapping>;
180
109
  interface BaseMapping extends Static.IMapping {
181
- output: (this['input'] extends [LParen, infer Type extends Types.TSchema, RParen] ? Type : this['input'] extends [infer Type extends Types.TSchema] ? Type : never);
110
+ output: (this['input'] extends [LParen, infer Type extends t.TSchema, RParen] ? Type : this['input'] extends [infer Type extends t.TSchema] ? Type : never);
182
111
  }
183
112
  type Base = Static.Union<[
184
113
  Static.Tuple<[
@@ -199,6 +128,7 @@ type Base = Static.Union<[
199
128
  Iterator,
200
129
  ConstructorParameters,
201
130
  FunctionParameters,
131
+ Argument,
202
132
  InstanceType,
203
133
  ReturnType,
204
134
  Awaited,
@@ -217,14 +147,15 @@ type Base = Static.Union<[
217
147
  Uncapitalize,
218
148
  Date,
219
149
  Uint8Array,
150
+ GenericReference,
220
151
  Reference
221
152
  ]>
222
153
  ]>
223
154
  ], BaseMapping>;
224
- 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);
225
- 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);
155
+ type FactorExtends<Type extends t.TSchema, Extends extends unknown[]> = (Extends extends [infer Right extends t.TSchema, infer True extends t.TSchema, infer False extends t.TSchema] ? t.TExtends<Type, Right, True, False> : Type);
156
+ type FactorIndexArray<Type extends t.TSchema, IndexArray extends unknown[]> = (IndexArray extends [...infer Left extends unknown[], infer Right extends t.TSchema[]] ? (Right extends [infer Indexer extends t.TSchema] ? t.TIndex<FactorIndexArray<Type, Left>, t.TIndexPropertyKeys<Indexer>> : Right extends [] ? t.TArray<FactorIndexArray<Type, Left>> : t.TNever) : Type);
226
157
  interface FactorMapping extends Static.IMapping {
227
- 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;
158
+ output: this['input'] extends [infer KeyOf extends boolean, infer Type extends t.TSchema, infer IndexArray extends unknown[], infer Extends extends unknown[]] ? KeyOf extends true ? FactorExtends<t.TKeyOf<FactorIndexArray<Type, IndexArray>>, Extends> : FactorExtends<FactorIndexArray<Type, IndexArray>, Extends> : never;
228
159
  }
229
160
  type Factor = Static.Tuple<[
230
161
  KeyOf,
@@ -232,9 +163,9 @@ type Factor = Static.Tuple<[
232
163
  IndexArray,
233
164
  Extends
234
165
  ], FactorMapping>;
235
- 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);
166
+ type ExprBinaryReduce<Left extends t.TSchema, Rest extends unknown[]> = (Rest extends [infer Operator extends unknown, infer Right extends t.TSchema, infer Next extends unknown[]] ? (ExprBinaryReduce<Right, Next> extends infer Schema extends t.TSchema ? (Operator extends '&' ? (Schema extends t.TIntersect<infer Types extends t.TSchema[]> ? t.TIntersect<[Left, ...Types]> : t.TIntersect<[Left, Schema]>) : Operator extends '|' ? (Schema extends t.TUnion<infer Types extends t.TSchema[]> ? t.TUnion<[Left, ...Types]> : t.TUnion<[Left, Schema]>) : never) : never) : Left);
236
167
  interface ExprBinaryMapping extends Static.IMapping {
237
- output: (this['input'] extends [infer Left extends Types.TSchema, infer Rest extends unknown[]] ? ExprBinaryReduce<Left, Rest> : []);
168
+ output: (this['input'] extends [infer Left extends t.TSchema, infer Rest extends unknown[]] ? ExprBinaryReduce<Left, Rest> : []);
238
169
  }
239
170
  type ExprTermTail = Static.Union<[
240
171
  Static.Tuple<[Static.Const<'&'>, Factor, ExprTermTail]>,
@@ -252,7 +183,7 @@ type Expr = Static.Tuple<[
252
183
  ExprTerm,
253
184
  ExprTail
254
185
  ], ExprBinaryMapping>;
255
- type Type = Expr;
186
+ export type Type = Expr;
256
187
  interface PropertyKeyStringMapping extends Static.IMapping {
257
188
  output: this['input'];
258
189
  }
@@ -267,17 +198,17 @@ interface OptionalMapping extends Static.IMapping {
267
198
  }
268
199
  type Optional = Static.Union<[Static.Tuple<[Static.Const<Question>]>, Static.Tuple<[]>], OptionalMapping>;
269
200
  interface PropertyMapping extends Static.IMapping {
270
- output: this['input'] extends [infer IsReadonly extends boolean, infer Key extends string, infer IsOptional extends boolean, string, infer Type extends Types.TSchema] ? {
201
+ output: this['input'] extends [infer IsReadonly extends boolean, infer Key extends string, infer IsOptional extends boolean, string, infer Type extends t.TSchema] ? {
271
202
  [_ in Key]: ([
272
203
  IsReadonly,
273
204
  IsOptional
274
- ] extends [true, true] ? Types.TReadonlyOptional<Type> : [
205
+ ] extends [true, true] ? t.TReadonlyOptional<Type> : [
275
206
  IsReadonly,
276
207
  IsOptional
277
- ] extends [true, false] ? Types.TReadonly<Type> : [
208
+ ] extends [true, false] ? t.TReadonly<Type> : [
278
209
  IsReadonly,
279
210
  IsOptional
280
- ] extends [false, true] ? Types.TOptional<Type> : Type);
211
+ ] extends [false, true] ? t.TOptional<Type> : Type);
281
212
  } : never;
282
213
  }
283
214
  type Property = Static.Tuple<[Readonly, PropertyKey, Optional, Static.Const<Colon>, Type], PropertyMapping>;
@@ -288,13 +219,13 @@ type PropertyDelimiter = Static.Union<[
288
219
  Static.Tuple<[Static.Const<SemiColon>]>,
289
220
  Static.Tuple<[Static.Const<Newline>]>
290
221
  ]>;
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);
222
+ type PropertiesReduce<PropertiesArray extends t.TProperties[], Result extends t.TProperties = {}> = (PropertiesArray extends [infer Left extends t.TProperties, ...infer Right extends t.TProperties[]] ? PropertiesReduce<Right, t.Evaluate<Result & Left>> : Result);
292
223
  interface PropertiesMapping extends Static.IMapping {
293
- output: this['input'] extends Types.TProperties[] ? PropertiesReduce<this['input']> : never;
224
+ output: this['input'] extends t.TProperties[] ? PropertiesReduce<this['input']> : never;
294
225
  }
295
226
  type Properties = Static.Union<[Delimit<Property, PropertyDelimiter>], PropertiesMapping>;
296
227
  interface ObjectMapping extends Static.IMapping {
297
- output: this['input'] extends [unknown, infer Properties extends Types.TProperties, unknown] ? Types.TObject<Properties> : never;
228
+ output: this['input'] extends [unknown, infer Properties extends t.TProperties, unknown] ? t.TObject<Properties> : never;
298
229
  }
299
230
  type Object = Static.Tuple<[
300
231
  Static.Const<LBrace>,
@@ -303,7 +234,7 @@ type Object = Static.Tuple<[
303
234
  ], ObjectMapping>;
304
235
  type Elements = Delimit<Type, Static.Const<Comma>>;
305
236
  interface TupleMapping extends Static.IMapping {
306
- output: this['input'] extends [unknown, infer Elements extends Types.TSchema[], unknown] ? Types.TTuple<Elements> : never;
237
+ output: this['input'] extends [unknown, infer Elements extends t.TSchema[], unknown] ? t.TTuple<Elements> : never;
307
238
  }
308
239
  type Tuple = Static.Tuple<[
309
240
  Static.Const<LBracket>,
@@ -311,7 +242,7 @@ type Tuple = Static.Tuple<[
311
242
  Static.Const<RBracket>
312
243
  ], TupleMapping>;
313
244
  interface ParameterMapping extends Static.IMapping {
314
- output: this['input'] extends [string, Colon, infer Type extends Types.TSchema] ? Type : never;
245
+ output: this['input'] extends [string, Colon, infer Type extends t.TSchema] ? Type : never;
315
246
  }
316
247
  type Parameter = Static.Tuple<[
317
248
  Static.Ident,
@@ -320,7 +251,7 @@ type Parameter = Static.Tuple<[
320
251
  ], ParameterMapping>;
321
252
  type Parameters = Delimit<Parameter, Static.Const<Comma>>;
322
253
  interface FunctionMapping extends Static.IMapping {
323
- output: this['input'] extends [LParen, infer Parameters extends Types.TSchema[], RParen, '=>', infer ReturnType extends Types.TSchema] ? Types.TFunction<Parameters, ReturnType> : never;
254
+ output: this['input'] extends [LParen, infer Parameters extends t.TSchema[], RParen, '=>', infer ReturnType extends t.TSchema] ? t.TFunction<Parameters, ReturnType> : never;
324
255
  }
325
256
  type Function = Static.Tuple<[
326
257
  Static.Const<LParen>,
@@ -330,7 +261,7 @@ type Function = Static.Tuple<[
330
261
  Type
331
262
  ], FunctionMapping>;
332
263
  interface ConstructorMapping extends Static.IMapping {
333
- output: this['input'] extends ['new', LParen, infer Parameters extends Types.TSchema[], RParen, '=>', infer InstanceType extends Types.TSchema] ? Types.TConstructor<Parameters, InstanceType> : never;
264
+ output: this['input'] extends ['new', LParen, infer Parameters extends t.TSchema[], RParen, '=>', infer InstanceType extends t.TSchema] ? t.TConstructor<Parameters, InstanceType> : never;
334
265
  }
335
266
  type Constructor = Static.Tuple<[
336
267
  Static.Const<'new'>,
@@ -341,7 +272,7 @@ type Constructor = Static.Tuple<[
341
272
  Type
342
273
  ], ConstructorMapping>;
343
274
  interface MappedMapping extends Static.IMapping {
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'];
275
+ output: this['input'] extends [LBrace, LBracket, infer _Key extends string, 'in', infer _Right extends t.TSchema, RBracket, Colon, infer Type extends t.TSchema, RBrace] ? t.TLiteral<'Mapped types not supported'> : this['input'];
345
276
  }
346
277
  type Mapped = Static.Tuple<[
347
278
  Static.Const<LBrace>,
@@ -355,7 +286,7 @@ type Mapped = Static.Tuple<[
355
286
  Static.Const<RBrace>
356
287
  ], MappedMapping>;
357
288
  interface ArrayMapping extends Static.IMapping {
358
- output: this['input'] extends ['Array', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TArray<Type> : never;
289
+ output: this['input'] extends ['Array', LAngle, infer Type extends t.TSchema, RAngle] ? t.TArray<Type> : never;
359
290
  }
360
291
  type Array = Static.Tuple<[
361
292
  Static.Const<'Array'>,
@@ -364,7 +295,7 @@ type Array = Static.Tuple<[
364
295
  Static.Const<RAngle>
365
296
  ], ArrayMapping>;
366
297
  interface AsyncIteratorMapping extends Static.IMapping {
367
- output: this['input'] extends ['AsyncIterator', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TAsyncIterator<Type> : never;
298
+ output: this['input'] extends ['AsyncIterator', LAngle, infer Type extends t.TSchema, RAngle] ? t.TAsyncIterator<Type> : never;
368
299
  }
369
300
  type AsyncIterator = Static.Tuple<[
370
301
  Static.Const<'AsyncIterator'>,
@@ -373,7 +304,7 @@ type AsyncIterator = Static.Tuple<[
373
304
  Static.Const<RAngle>
374
305
  ], AsyncIteratorMapping>;
375
306
  interface IteratorMapping extends Static.IMapping {
376
- output: this['input'] extends ['Iterator', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TIterator<Type> : never;
307
+ output: this['input'] extends ['Iterator', LAngle, infer Type extends t.TSchema, RAngle] ? t.TIterator<Type> : never;
377
308
  }
378
309
  type Iterator = Static.Tuple<[
379
310
  Static.Const<'Iterator'>,
@@ -382,7 +313,7 @@ type Iterator = Static.Tuple<[
382
313
  Static.Const<RAngle>
383
314
  ], IteratorMapping>;
384
315
  interface ConstructorParametersMapping extends Static.IMapping {
385
- output: this['input'] extends ['ConstructorParameters', LAngle, infer Type extends Types.TConstructor, RAngle] ? Types.TConstructorParameters<Type> : never;
316
+ output: this['input'] extends ['ConstructorParameters', LAngle, infer Type extends t.TSchema, RAngle] ? t.TConstructorParameters<Type> : never;
386
317
  }
387
318
  type ConstructorParameters = Static.Tuple<[
388
319
  Static.Const<'ConstructorParameters'>,
@@ -391,7 +322,7 @@ type ConstructorParameters = Static.Tuple<[
391
322
  Static.Const<RAngle>
392
323
  ], ConstructorParametersMapping>;
393
324
  interface FunctionParametersMapping extends Static.IMapping {
394
- output: this['input'] extends ['Parameters', LAngle, infer Type extends Types.TFunction, RAngle] ? Types.TParameters<Type> : never;
325
+ output: this['input'] extends ['Parameters', LAngle, infer Type extends t.TSchema, RAngle] ? t.TParameters<Type> : never;
395
326
  }
396
327
  type FunctionParameters = Static.Tuple<[
397
328
  Static.Const<'Parameters'>,
@@ -400,7 +331,7 @@ type FunctionParameters = Static.Tuple<[
400
331
  Static.Const<RAngle>
401
332
  ], FunctionParametersMapping>;
402
333
  interface InstanceTypeMapping extends Static.IMapping {
403
- output: this['input'] extends ['InstanceType', LAngle, infer Type extends Types.TConstructor, RAngle] ? Types.TInstanceType<Type> : never;
334
+ output: this['input'] extends ['InstanceType', LAngle, infer Type extends t.TSchema, RAngle] ? t.TInstanceType<Type> : never;
404
335
  }
405
336
  type InstanceType = Static.Tuple<[
406
337
  Static.Const<'InstanceType'>,
@@ -409,7 +340,7 @@ type InstanceType = Static.Tuple<[
409
340
  Static.Const<RAngle>
410
341
  ], InstanceTypeMapping>;
411
342
  interface ReturnTypeMapping extends Static.IMapping {
412
- output: this['input'] extends ['ReturnType', LAngle, infer Type extends Types.TFunction, RAngle] ? Types.TReturnType<Type> : never;
343
+ output: this['input'] extends ['ReturnType', LAngle, infer Type extends t.TSchema, RAngle] ? t.TReturnType<Type> : never;
413
344
  }
414
345
  type ReturnType = Static.Tuple<[
415
346
  Static.Const<'ReturnType'>,
@@ -417,8 +348,17 @@ type ReturnType = Static.Tuple<[
417
348
  Type,
418
349
  Static.Const<RAngle>
419
350
  ], ReturnTypeMapping>;
351
+ interface ArgumentMapping extends Static.IMapping {
352
+ output: this['input'] extends ['Argument', LAngle, infer Type extends t.TSchema, RAngle] ? Type extends t.TLiteral<infer Index extends number> ? t.TArgument<Index> : t.TNever : never;
353
+ }
354
+ type Argument = Static.Tuple<[
355
+ Static.Const<'Argument'>,
356
+ Static.Const<LAngle>,
357
+ Type,
358
+ Static.Const<RAngle>
359
+ ], ArgumentMapping>;
420
360
  interface AwaitedMapping extends Static.IMapping {
421
- output: this['input'] extends ['Awaited', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TAwaited<Type> : never;
361
+ output: this['input'] extends ['Awaited', LAngle, infer Type extends t.TSchema, RAngle] ? t.TAwaited<Type> : never;
422
362
  }
423
363
  type Awaited = Static.Tuple<[
424
364
  Static.Const<'Awaited'>,
@@ -427,7 +367,7 @@ type Awaited = Static.Tuple<[
427
367
  Static.Const<RAngle>
428
368
  ], AwaitedMapping>;
429
369
  interface PromiseMapping extends Static.IMapping {
430
- output: this['input'] extends ['Promise', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TPromise<Type> : never;
370
+ output: this['input'] extends ['Promise', LAngle, infer Type extends t.TSchema, RAngle] ? t.TPromise<Type> : never;
431
371
  }
432
372
  type Promise = Static.Tuple<[
433
373
  Static.Const<'Promise'>,
@@ -436,7 +376,7 @@ type Promise = Static.Tuple<[
436
376
  Static.Const<RAngle>
437
377
  ], PromiseMapping>;
438
378
  interface RecordMapping extends Static.IMapping {
439
- output: this['input'] extends ['Record', LAngle, infer Key extends Types.TSchema, Comma, infer Type extends Types.TSchema, RAngle] ? Types.TRecord<Key, Type> : never;
379
+ output: this['input'] extends ['Record', LAngle, infer Key extends t.TSchema, Comma, infer Type extends t.TSchema, RAngle] ? t.TRecord<Key, Type> : never;
440
380
  }
441
381
  type Record = Static.Tuple<[
442
382
  Static.Const<'Record'>,
@@ -447,7 +387,7 @@ type Record = Static.Tuple<[
447
387
  Static.Const<RAngle>
448
388
  ], RecordMapping>;
449
389
  interface PartialMapping extends Static.IMapping {
450
- output: this['input'] extends ['Partial', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TPartial<Type> : never;
390
+ output: this['input'] extends ['Partial', LAngle, infer Type extends t.TSchema, RAngle] ? t.TPartial<Type> : never;
451
391
  }
452
392
  type Partial = Static.Tuple<[
453
393
  Static.Const<'Partial'>,
@@ -456,7 +396,7 @@ type Partial = Static.Tuple<[
456
396
  Static.Const<RAngle>
457
397
  ], PartialMapping>;
458
398
  interface RequiredMapping extends Static.IMapping {
459
- output: this['input'] extends ['Required', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TRequired<Type> : never;
399
+ output: this['input'] extends ['Required', LAngle, infer Type extends t.TSchema, RAngle] ? t.TRequired<Type> : never;
460
400
  }
461
401
  type Required = Static.Tuple<[
462
402
  Static.Const<'Required'>,
@@ -465,7 +405,7 @@ type Required = Static.Tuple<[
465
405
  Static.Const<RAngle>
466
406
  ], RequiredMapping>;
467
407
  interface PickMapping extends Static.IMapping {
468
- output: this['input'] extends ['Pick', LAngle, infer Type extends Types.TSchema, Comma, infer Key extends Types.TSchema, RAngle] ? Types.TPick<Type, Key> : never;
408
+ output: this['input'] extends ['Pick', LAngle, infer Type extends t.TSchema, Comma, infer Key extends t.TSchema, RAngle] ? t.TPick<Type, Key> : never;
469
409
  }
470
410
  type Pick = Static.Tuple<[
471
411
  Static.Const<'Pick'>,
@@ -476,7 +416,7 @@ type Pick = Static.Tuple<[
476
416
  Static.Const<RAngle>
477
417
  ], PickMapping>;
478
418
  interface OmitMapping extends Static.IMapping {
479
- output: this['input'] extends ['Omit', LAngle, infer Type extends Types.TSchema, Comma, infer Key extends Types.TSchema, RAngle] ? Types.TOmit<Type, Key> : never;
419
+ output: this['input'] extends ['Omit', LAngle, infer Type extends t.TSchema, Comma, infer Key extends t.TSchema, RAngle] ? t.TOmit<Type, Key> : never;
480
420
  }
481
421
  type Omit = Static.Tuple<[
482
422
  Static.Const<'Omit'>,
@@ -487,7 +427,7 @@ type Omit = Static.Tuple<[
487
427
  Static.Const<RAngle>
488
428
  ], OmitMapping>;
489
429
  interface ExcludeMapping extends Static.IMapping {
490
- output: this['input'] extends ['Exclude', LAngle, infer Type extends Types.TSchema, Comma, infer PropertyKey extends Types.TSchema, RAngle] ? Types.TExclude<Type, PropertyKey> : never;
430
+ output: this['input'] extends ['Exclude', LAngle, infer Type extends t.TSchema, Comma, infer PropertyKey extends t.TSchema, RAngle] ? t.TExclude<Type, PropertyKey> : never;
491
431
  }
492
432
  type Exclude = Static.Tuple<[
493
433
  Static.Const<'Exclude'>,
@@ -498,7 +438,7 @@ type Exclude = Static.Tuple<[
498
438
  Static.Const<RAngle>
499
439
  ], ExcludeMapping>;
500
440
  interface ExtractMapping extends Static.IMapping {
501
- output: this['input'] extends ['Extract', LAngle, infer Type extends Types.TSchema, Comma, infer PropertyKey extends Types.TSchema, RAngle] ? Types.TExtract<Type, PropertyKey> : never;
441
+ output: this['input'] extends ['Extract', LAngle, infer Type extends t.TSchema, Comma, infer PropertyKey extends t.TSchema, RAngle] ? t.TExtract<Type, PropertyKey> : never;
502
442
  }
503
443
  type Extract = Static.Tuple<[
504
444
  Static.Const<'Extract'>,
@@ -509,7 +449,7 @@ type Extract = Static.Tuple<[
509
449
  Static.Const<RAngle>
510
450
  ], ExtractMapping>;
511
451
  interface UppercaseMapping extends Static.IMapping {
512
- output: this['input'] extends ['Uppercase', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TUppercase<Type> : never;
452
+ output: this['input'] extends ['Uppercase', LAngle, infer Type extends t.TSchema, RAngle] ? t.TUppercase<Type> : never;
513
453
  }
514
454
  type Uppercase = Static.Tuple<[
515
455
  Static.Const<'Uppercase'>,
@@ -518,7 +458,7 @@ type Uppercase = Static.Tuple<[
518
458
  Static.Const<RAngle>
519
459
  ], UppercaseMapping>;
520
460
  interface LowercaseMapping extends Static.IMapping {
521
- output: this['input'] extends ['Lowercase', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TLowercase<Type> : never;
461
+ output: this['input'] extends ['Lowercase', LAngle, infer Type extends t.TSchema, RAngle] ? t.TLowercase<Type> : never;
522
462
  }
523
463
  type Lowercase = Static.Tuple<[
524
464
  Static.Const<'Lowercase'>,
@@ -527,7 +467,7 @@ type Lowercase = Static.Tuple<[
527
467
  Static.Const<RAngle>
528
468
  ], LowercaseMapping>;
529
469
  interface CapitalizeMapping extends Static.IMapping {
530
- output: this['input'] extends ['Capitalize', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TCapitalize<Type> : never;
470
+ output: this['input'] extends ['Capitalize', LAngle, infer Type extends t.TSchema, RAngle] ? t.TCapitalize<Type> : never;
531
471
  }
532
472
  type Capitalize = Static.Tuple<[
533
473
  Static.Const<'Capitalize'>,
@@ -536,7 +476,7 @@ type Capitalize = Static.Tuple<[
536
476
  Static.Const<RAngle>
537
477
  ], CapitalizeMapping>;
538
478
  interface UncapitalizeMapping extends Static.IMapping {
539
- output: this['input'] extends ['Uncapitalize', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TUncapitalize<Type> : never;
479
+ output: this['input'] extends ['Uncapitalize', LAngle, infer Type extends t.TSchema, RAngle] ? t.TUncapitalize<Type> : never;
540
480
  }
541
481
  type Uncapitalize = Static.Tuple<[
542
482
  Static.Const<'Uncapitalize'>,
@@ -544,12 +484,6 @@ type Uncapitalize = Static.Tuple<[
544
484
  Type,
545
485
  Static.Const<RAngle>
546
486
  ], UncapitalizeMapping>;
547
- type Date = Static.Const<'Date', Static.As<Types.TDate>>;
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
- ]>;
487
+ type Date = Static.Const<'Date', Static.As<t.TDate>>;
488
+ type Uint8Array = Static.Const<'Uint8Array', Static.As<t.TUint8Array>>;
555
489
  export {};
@@ -0,0 +1,33 @@
1
+ import * as Types from '../type/index.mjs';
2
+ import { Static } from '../parser/index.mjs';
3
+ import { Type } from './static.mjs';
4
+ /** Parses a TSchema type from TypeScript syntax but does not infer schematics */
5
+ export declare function NoInfer<Context extends Record<PropertyKey, Types.TSchema>, Code extends string>(context: Context, code: Code, options?: Types.SchemaOptions): Types.TSchema | undefined;
6
+ /** Parses a TSchema type from TypeScript syntax but does not infer schematics */
7
+ export declare function NoInfer<Code extends string>(code: Code, options?: Types.SchemaOptions): Types.TSchema | undefined;
8
+ /** Infers a TSchema type from TypeScript syntax. */
9
+ export type TSyntax<Context extends Record<PropertyKey, Types.TSchema>, Code extends string> = (Static.Parse<Type, Code, Context> extends [infer Type extends Types.TSchema, string] ? Type : Types.TNever);
10
+ /** Parses a TSchema type from TypeScript syntax */
11
+ export declare function Syntax<Context extends Record<PropertyKey, Types.TSchema>, Code extends string>(context: Context, code: Code, options?: Types.SchemaOptions): TSyntax<Context, Code>;
12
+ /** Parses a TSchema type from TypeScript syntax */
13
+ export declare function Syntax<Code extends string>(code: Code, options?: Types.SchemaOptions): TSyntax<{}, Code>;
14
+ /**
15
+ * Parses a TSchema type from Syntax.
16
+ * @deprecated Use Syntax() function
17
+ */
18
+ export declare function Parse<Context extends Record<PropertyKey, Types.TSchema>, Code extends string>(context: Context, code: Code, options?: Types.SchemaOptions): TSyntax<Context, Code>;
19
+ /**
20
+ * Parses a TSchema type from Syntax.
21
+ * @deprecated Use Syntax() function
22
+ */
23
+ export declare function Parse<Code extends string>(code: Code, options?: Types.SchemaOptions): TSyntax<{}, Code>;
24
+ /**
25
+ * Parses a TSchema from TypeScript Syntax
26
+ * @deprecated Use NoInfer() function
27
+ */
28
+ export declare function ParseOnly<Context extends Record<PropertyKey, Types.TSchema>, Code extends string>(context: Context, code: Code, options?: Types.SchemaOptions): Types.TSchema | undefined;
29
+ /**
30
+ * Parses a TSchema from TypeScript Syntax
31
+ * @deprecated Use NoInfer() function
32
+ */
33
+ export declare function ParseOnly<Code extends string>(code: Code, options?: Types.SchemaOptions): Types.TSchema | undefined;
@@ -0,0 +1,30 @@
1
+ import * as Types from '../type/index.mjs';
2
+ import { Module } from './runtime.mjs';
3
+ /** Parses a TSchema type from TypeScript syntax but does not infer schematics */
4
+ // prettier-ignore
5
+ export function NoInfer(...args) {
6
+ const withContext = typeof args[0] === 'string' ? false : true;
7
+ const [context, code, options] = withContext ? [args[0], args[1], args[2] || {}] : [{}, args[0], args[1] || {}];
8
+ const type = Module.Parse('Type', code, context)[0];
9
+ return Types.KindGuard.IsSchema(type)
10
+ ? Types.CloneType(type, options)
11
+ : Types.Never(options);
12
+ }
13
+ /** Parses a TSchema type from TypeScript syntax */
14
+ export function Syntax(...args) {
15
+ return NoInfer.apply(null, args);
16
+ }
17
+ /**
18
+ * Parses a TSchema type from Syntax.
19
+ * @deprecated Use Syntax() function
20
+ */
21
+ export function Parse(...args) {
22
+ return NoInfer.apply(null, args);
23
+ }
24
+ /**
25
+ * Parses a TSchema from TypeScript Syntax
26
+ * @deprecated Use NoInfer() function
27
+ */
28
+ export function ParseOnly(...args) {
29
+ return NoInfer.apply(null, args);
30
+ }
@@ -0,0 +1,9 @@
1
+ import type { TSchema } from '../schema/index.mjs';
2
+ import { Kind } from '../symbols/index.mjs';
3
+ export interface TArgument<Index extends number = number> extends TSchema {
4
+ [Kind]: 'Argument';
5
+ static: unknown;
6
+ index: Index;
7
+ }
8
+ /** `[JavaScript]` Creates an Argument Type. */
9
+ export declare function Argument<Index extends number>(index: Index): TArgument<Index>;
@@ -0,0 +1,6 @@
1
+ import { CreateType } from '../create/type.mjs';
2
+ import { Kind } from '../symbols/index.mjs';
3
+ /** `[JavaScript]` Creates an Argument Type. */
4
+ export function Argument(index) {
5
+ return CreateType({ [Kind]: 'Argument', index });
6
+ }
@@ -0,0 +1 @@
1
+ export * from './argument.mjs';
@@ -0,0 +1 @@
1
+ export * from './argument.mjs';
@@ -1,7 +1,7 @@
1
1
  import type { TSchema, SchemaOptions } from '../schema/index.mjs';
2
- import type { Ensure } from '../helpers/index.mjs';
3
2
  import type { TConstructor } from '../constructor/index.mjs';
4
3
  import { type TTuple } from '../tuple/index.mjs';
5
- export type TConstructorParameters<T extends TConstructor<TSchema[], TSchema>> = (Ensure<TTuple<T['parameters']>>);
4
+ import { type TNever } from '../never/index.mjs';
5
+ export type TConstructorParameters<Type extends TSchema> = (Type extends TConstructor<infer Parameters extends TSchema[], infer _InstanceType extends TSchema> ? TTuple<Parameters> : TNever);
6
6
  /** `[JavaScript]` Extracts the ConstructorParameters from the given Constructor type */
7
- export declare function ConstructorParameters<T extends TConstructor<TSchema[], TSchema>>(schema: T, options?: SchemaOptions): TConstructorParameters<T>;
7
+ export declare function ConstructorParameters<Type extends TSchema>(schema: Type, options?: SchemaOptions): TConstructorParameters<Type>;
@@ -1,5 +1,7 @@
1
1
  import { Tuple } from '../tuple/index.mjs';
2
+ import { Never } from '../never/index.mjs';
3
+ import * as KindGuard from '../guard/kind.mjs';
2
4
  /** `[JavaScript]` Extracts the ConstructorParameters from the given Constructor type */
3
5
  export function ConstructorParameters(schema, options) {
4
- return Tuple(schema.parameters, options);
6
+ return (KindGuard.IsConstructor(schema) ? Tuple(schema.parameters, options) : Never(options));
5
7
  }