@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,14 +1,11 @@
1
1
  import { Kind, Hint, TransformKind } from '../symbols/index.mjs';
2
2
  import { TransformOptions } from '../transform/index.mjs';
3
- import type { TTemplateLiteral } from '../template-literal/index.mjs';
3
+ import type { TAny } from '../any/index.mjs';
4
+ import type { TArgument } from '../argument/index.mjs';
4
5
  import type { TArray } from '../array/index.mjs';
6
+ import type { TAsyncIterator } from '../async-iterator/index.mjs';
5
7
  import type { TBoolean } from '../boolean/index.mjs';
6
8
  import type { TComputed } from '../computed/index.mjs';
7
- import type { TRecord } from '../record/index.mjs';
8
- import type { TString } from '../string/index.mjs';
9
- import type { TUnion } from '../union/index.mjs';
10
- import type { TAny } from '../any/index.mjs';
11
- import type { TAsyncIterator } from '../async-iterator/index.mjs';
12
9
  import type { TBigInt } from '../bigint/index.mjs';
13
10
  import type { TConstructor } from '../constructor/index.mjs';
14
11
  import type { TFunction } from '../function/index.mjs';
@@ -26,14 +23,18 @@ import type { TObject, TProperties } from '../object/index.mjs';
26
23
  import type { TOptional } from '../optional/index.mjs';
27
24
  import type { TPromise } from '../promise/index.mjs';
28
25
  import type { TReadonly } from '../readonly/index.mjs';
26
+ import type { TRecord } from '../record/index.mjs';
29
27
  import type { TRef } from '../ref/index.mjs';
30
28
  import type { TRegExp } from '../regexp/index.mjs';
31
29
  import type { TSchema } from '../schema/index.mjs';
30
+ import type { TString } from '../string/index.mjs';
32
31
  import type { TSymbol } from '../symbol/index.mjs';
32
+ import type { TTemplateLiteral } from '../template-literal/index.mjs';
33
33
  import type { TTuple } from '../tuple/index.mjs';
34
34
  import type { TUint8Array } from '../uint8array/index.mjs';
35
35
  import type { TUndefined } from '../undefined/index.mjs';
36
36
  import type { TUnknown } from '../unknown/index.mjs';
37
+ import type { TUnion } from '../union/index.mjs';
37
38
  import type { TUnsafe } from '../unsafe/index.mjs';
38
39
  import type { TVoid } from '../void/index.mjs';
39
40
  import type { TDate } from '../date/index.mjs';
@@ -44,6 +45,8 @@ export declare function IsReadonly<T extends TSchema>(value: T): value is TReado
44
45
  export declare function IsOptional<T extends TSchema>(value: T): value is TOptional<T>;
45
46
  /** `[Kind-Only]` Returns true if the given value is TAny */
46
47
  export declare function IsAny(value: unknown): value is TAny;
48
+ /** `[Kind-Only]` Returns true if the given value is TArgument */
49
+ export declare function IsArgument(value: unknown): value is TArgument;
47
50
  /** `[Kind-Only]` Returns true if the given value is TArray */
48
51
  export declare function IsArray(value: unknown): value is TArray;
49
52
  /** `[Kind-Only]` Returns true if the given value is TAsyncIterator */
@@ -12,6 +12,10 @@ export function IsOptional(value) {
12
12
  export function IsAny(value) {
13
13
  return IsKindOf(value, 'Any');
14
14
  }
15
+ /** `[Kind-Only]` Returns true if the given value is TArgument */
16
+ export function IsArgument(value) {
17
+ return IsKindOf(value, 'Argument');
18
+ }
15
19
  /** `[Kind-Only]` Returns true if the given value is TArray */
16
20
  export function IsArray(value) {
17
21
  return IsKindOf(value, 'Array');
@@ -192,6 +196,7 @@ export function IsKind(value) {
192
196
  export function IsSchema(value) {
193
197
  // prettier-ignore
194
198
  return (IsAny(value) ||
199
+ IsArgument(value) ||
195
200
  IsArray(value) ||
196
201
  IsBoolean(value) ||
197
202
  IsBigInt(value) ||
@@ -1,15 +1,12 @@
1
1
  import { Kind, Hint, TransformKind } from '../symbols/index.mjs';
2
2
  import { TypeBoxError } from '../error/index.mjs';
3
3
  import { TransformOptions } from '../transform/index.mjs';
4
- import type { TTemplateLiteral } from '../template-literal/index.mjs';
4
+ import type { TAny } from '../any/index.mjs';
5
+ import type { TArgument } from '../argument/index.mjs';
5
6
  import type { TArray } from '../array/index.mjs';
7
+ import type { TAsyncIterator } from '../async-iterator/index.mjs';
6
8
  import type { TBoolean } from '../boolean/index.mjs';
7
9
  import type { TComputed } from '../computed/index.mjs';
8
- import type { TRecord } from '../record/index.mjs';
9
- import type { TString } from '../string/index.mjs';
10
- import type { TUnion } from '../union/index.mjs';
11
- import type { TAny } from '../any/index.mjs';
12
- import type { TAsyncIterator } from '../async-iterator/index.mjs';
13
10
  import type { TBigInt } from '../bigint/index.mjs';
14
11
  import type { TConstructor } from '../constructor/index.mjs';
15
12
  import type { TFunction } from '../function/index.mjs';
@@ -27,13 +24,17 @@ import type { TObject, TProperties } from '../object/index.mjs';
27
24
  import type { TOptional } from '../optional/index.mjs';
28
25
  import type { TPromise } from '../promise/index.mjs';
29
26
  import type { TReadonly } from '../readonly/index.mjs';
27
+ import type { TRecord } from '../record/index.mjs';
30
28
  import type { TRef } from '../ref/index.mjs';
31
29
  import type { TRegExp } from '../regexp/index.mjs';
32
30
  import type { TSchema } from '../schema/index.mjs';
31
+ import type { TString } from '../string/index.mjs';
33
32
  import type { TSymbol } from '../symbol/index.mjs';
33
+ import type { TTemplateLiteral } from '../template-literal/index.mjs';
34
34
  import type { TTuple } from '../tuple/index.mjs';
35
35
  import type { TUint8Array } from '../uint8array/index.mjs';
36
36
  import type { TUndefined } from '../undefined/index.mjs';
37
+ import type { TUnion } from '../union/index.mjs';
37
38
  import type { TUnknown } from '../unknown/index.mjs';
38
39
  import type { TUnsafe } from '../unsafe/index.mjs';
39
40
  import type { TVoid } from '../void/index.mjs';
@@ -47,6 +48,8 @@ export declare function IsReadonly<T extends TSchema>(value: T): value is TReado
47
48
  export declare function IsOptional<T extends TSchema>(value: T): value is TOptional<T>;
48
49
  /** Returns true if the given value is TAny */
49
50
  export declare function IsAny(value: unknown): value is TAny;
51
+ /** Returns true if the given value is TArgument */
52
+ export declare function IsArgument(value: unknown): value is TArgument;
50
53
  /** Returns true if the given value is TArray */
51
54
  export declare function IsArray(value: unknown): value is TArray;
52
55
  /** Returns true if the given value is TAsyncIterator */
@@ -4,6 +4,7 @@ import { TypeBoxError } from '../error/index.mjs';
4
4
  export class TypeGuardUnknownTypeError extends TypeBoxError {
5
5
  }
6
6
  const KnownTypes = [
7
+ 'Argument',
7
8
  'Any',
8
9
  'Array',
9
10
  'AsyncIterator',
@@ -103,6 +104,12 @@ export function IsAny(value) {
103
104
  return (IsKindOf(value, 'Any') &&
104
105
  IsOptionalString(value.$id));
105
106
  }
107
+ /** Returns true if the given value is TArgument */
108
+ export function IsArgument(value) {
109
+ // prettier-ignore
110
+ return (IsKindOf(value, 'Argument') &&
111
+ ValueGuard.IsNumber(value.index));
112
+ }
106
113
  /** Returns true if the given value is TArray */
107
114
  export function IsArray(value) {
108
115
  return (IsKindOf(value, 'Array') &&
@@ -463,6 +470,7 @@ export function IsKind(value) {
463
470
  export function IsSchema(value) {
464
471
  // prettier-ignore
465
472
  return (ValueGuard.IsObject(value)) && (IsAny(value) ||
473
+ IsArgument(value) ||
466
474
  IsArray(value) ||
467
475
  IsBoolean(value) ||
468
476
  IsBigInt(value) ||
@@ -1,4 +1,5 @@
1
1
  export * from './any/index.mjs';
2
+ export * from './argument/index.mjs';
2
3
  export * from './array/index.mjs';
3
4
  export * from './async-iterator/index.mjs';
4
5
  export * from './awaited/index.mjs';
@@ -21,6 +22,7 @@ export * from './guard/index.mjs';
21
22
  export * from './helpers/index.mjs';
22
23
  export * from './indexed/index.mjs';
23
24
  export * from './instance-type/index.mjs';
25
+ export * from './instantiate/index.mjs';
24
26
  export * from './integer/index.mjs';
25
27
  export * from './intersect/index.mjs';
26
28
  export * from './intrinsic/index.mjs';
@@ -1,4 +1,5 @@
1
1
  export * from './any/index.mjs';
2
+ export * from './argument/index.mjs';
2
3
  export * from './array/index.mjs';
3
4
  export * from './async-iterator/index.mjs';
4
5
  export * from './awaited/index.mjs';
@@ -21,6 +22,7 @@ export * from './guard/index.mjs';
21
22
  export * from './helpers/index.mjs';
22
23
  export * from './indexed/index.mjs';
23
24
  export * from './instance-type/index.mjs';
25
+ export * from './instantiate/index.mjs';
24
26
  export * from './integer/index.mjs';
25
27
  export * from './intersect/index.mjs';
26
28
  export * from './intrinsic/index.mjs';
@@ -1,5 +1,6 @@
1
- import type { TSchema, SchemaOptions } from '../schema/index.mjs';
2
- import type { TConstructor } from '../constructor/index.mjs';
3
- export type TInstanceType<T extends TConstructor<TSchema[], TSchema>> = T['returns'];
1
+ import { type TSchema, SchemaOptions } from '../schema/index.mjs';
2
+ import { type TConstructor } from '../constructor/index.mjs';
3
+ import { type TNever } from '../never/index.mjs';
4
+ export type TInstanceType<Type extends TSchema, Result extends TSchema = Type extends TConstructor<infer _Parameters extends TSchema[], infer InstanceType extends TSchema> ? InstanceType : TNever> = Result;
4
5
  /** `[JavaScript]` Extracts the InstanceType from the given Constructor type */
5
- export declare function InstanceType<T extends TConstructor<any[], any>>(schema: T, options?: SchemaOptions): TInstanceType<T>;
6
+ export declare function InstanceType<Type extends TSchema>(schema: Type, options?: SchemaOptions): TInstanceType<Type>;
@@ -1,5 +1,7 @@
1
1
  import { CreateType } from '../create/type.mjs';
2
+ import { Never } from '../never/index.mjs';
3
+ import * as KindGuard from '../guard/kind.mjs';
2
4
  /** `[JavaScript]` Extracts the InstanceType from the given Constructor type */
3
5
  export function InstanceType(schema, options) {
4
- return CreateType(schema.returns, options);
6
+ return (KindGuard.IsConstructor(schema) ? CreateType(schema.returns, options) : Never(options));
5
7
  }
@@ -0,0 +1 @@
1
+ export * from './instantiate.mjs';
@@ -0,0 +1 @@
1
+ export * from './instantiate.mjs';
@@ -0,0 +1,25 @@
1
+ import type { TSchema } from '../schema/index.mjs';
2
+ import type { TArgument } from '../argument/index.mjs';
3
+ import { type TNever } from '../never/index.mjs';
4
+ import { type TReadonlyOptional } from '../readonly-optional/index.mjs';
5
+ import { type TReadonly } from '../readonly/index.mjs';
6
+ import { type TOptional } from '../optional/index.mjs';
7
+ import { type TRemap, type TMapping as TRemapMapping } from '../remap/index.mjs';
8
+ type TInstantiateArgument<Argument extends TArgument, Type extends TSchema, IsArgumentReadonly extends number = Argument extends TReadonly<TSchema> ? 1 : 0, IsArgumentOptional extends number = Argument extends TOptional<TSchema> ? 1 : 0, Result extends TSchema = ([
9
+ IsArgumentReadonly,
10
+ IsArgumentOptional
11
+ ] extends [1, 1] ? TReadonlyOptional<Type> : [
12
+ IsArgumentReadonly,
13
+ IsArgumentOptional
14
+ ] extends [0, 1] ? TOptional<Type> : [
15
+ IsArgumentReadonly,
16
+ IsArgumentOptional
17
+ ] extends [1, 0] ? TReadonly<Type> : Type)> = Result;
18
+ interface TInstantiateArguments<Arguments extends TSchema[]> extends TRemapMapping {
19
+ output: (this['input'] extends TArgument<infer Index extends number> ? Index extends keyof Arguments ? Arguments[Index] extends TSchema ? TInstantiateArgument<this['input'], Arguments[Index]> : TNever : TNever : this['input']);
20
+ }
21
+ /** `[JavaScript]` Instantiates a type with the given parameters */
22
+ export type TInstantiate<Type extends TSchema, Arguments extends TSchema[]> = (TRemap<Type, TInstantiateArguments<Arguments>>);
23
+ /** `[JavaScript]` Instantiates a type with the given parameters */
24
+ export declare function Instantiate<Type extends TSchema, Arguments extends TSchema[]>(type: Type, args: [...Arguments]): TInstantiate<Type, Arguments>;
25
+ export {};
@@ -0,0 +1,28 @@
1
+ import { Never } from '../never/index.mjs';
2
+ import { ReadonlyOptional } from '../readonly-optional/index.mjs';
3
+ import { Readonly } from '../readonly/index.mjs';
4
+ import { Optional } from '../optional/index.mjs';
5
+ import { Remap } from '../remap/index.mjs';
6
+ import * as KindGuard from '../guard/kind.mjs';
7
+ // prettier-ignore
8
+ function InstantiateArgument(argument, type) {
9
+ const isReadonly = KindGuard.IsReadonly(argument);
10
+ const isOptional = KindGuard.IsOptional(argument);
11
+ return (isReadonly && isOptional ? ReadonlyOptional(type) :
12
+ isReadonly && !isOptional ? Readonly(type) :
13
+ !isReadonly && isOptional ? Optional(type) :
14
+ type);
15
+ }
16
+ /** `[JavaScript]` Instantiates a type with the given parameters */
17
+ // prettier-ignore
18
+ export function Instantiate(type, args) {
19
+ return Remap(type, (type) => {
20
+ return KindGuard.IsArgument(type)
21
+ ? type.index in args
22
+ ? KindGuard.IsSchema(args[type.index])
23
+ ? InstantiateArgument(type, args[type.index])
24
+ : Never()
25
+ : Never()
26
+ : type;
27
+ });
28
+ }
@@ -1,7 +1,7 @@
1
1
  import type { TSchema, SchemaOptions } from '../schema/index.mjs';
2
2
  import type { TFunction } from '../function/index.mjs';
3
- import type { Ensure } from '../helpers/index.mjs';
4
3
  import { type TTuple } from '../tuple/index.mjs';
5
- export type TParameters<T extends TFunction> = Ensure<TTuple<T['parameters']>>;
4
+ import { type TNever } from '../never/index.mjs';
5
+ export type TParameters<Type extends TSchema> = (Type extends TFunction<infer Parameters extends TSchema[], infer _ReturnType extends TSchema> ? TTuple<Parameters> : TNever);
6
6
  /** `[JavaScript]` Extracts the Parameters from the given Function type */
7
- export declare function Parameters<T extends TFunction<TSchema[], TSchema>>(schema: T, options?: SchemaOptions): TParameters<T>;
7
+ export declare function Parameters<Type extends TSchema>(schema: Type, options?: SchemaOptions): TParameters<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 Parameters from the given Function type */
3
5
  export function Parameters(schema, options) {
4
- return Tuple(schema.parameters, options);
6
+ return (KindGuard.IsFunction(schema) ? Tuple(schema.parameters, options) : Never());
5
7
  }
@@ -3,6 +3,7 @@ import type { TSchema } from '../schema/index.mjs';
3
3
  import type { Static } from '../static/index.mjs';
4
4
  import type { Evaluate, Ensure, Assert } from '../helpers/index.mjs';
5
5
  import { type TAny } from '../any/index.mjs';
6
+ import { type TBoolean } from '../boolean/index.mjs';
6
7
  import { type TComputed } from '../computed/index.mjs';
7
8
  import { type TEnumRecord, type TEnum } from '../enum/index.mjs';
8
9
  import { type TInteger } from '../integer/index.mjs';
@@ -38,6 +39,10 @@ type TFromRegExpKey<_Key extends TRegExp, Type extends TSchema> = (Ensure<TRecor
38
39
  type TFromStringKey<_Key extends TString, Type extends TSchema> = (Ensure<TRecord<TString, Type>>);
39
40
  type TFromAnyKey<_Key extends TAny, Type extends TSchema> = (Ensure<TRecord<TAny, Type>>);
40
41
  type TFromNeverKey<_Key extends TNever, Type extends TSchema> = (Ensure<TRecord<TNever, Type>>);
42
+ type TFromBooleanKey<_Key extends TBoolean, Type extends TSchema> = (Ensure<TObject<{
43
+ true: Type;
44
+ false: Type;
45
+ }>>);
41
46
  type TFromIntegerKey<_Key extends TSchema, Type extends TSchema> = (Ensure<TRecord<TNumber, Type>>);
42
47
  type TFromNumberKey<_Key extends TSchema, Type extends TSchema> = (Ensure<TRecord<TNumber, Type>>);
43
48
  type RecordStatic<Key extends TSchema, Type extends TSchema, P extends unknown[]> = (Evaluate<{
@@ -52,7 +57,17 @@ export interface TRecord<Key extends TSchema = TSchema, Type extends TSchema = T
52
57
  };
53
58
  additionalProperties: TAdditionalProperties;
54
59
  }
55
- export type TRecordOrObject<Key extends TSchema, Type extends TSchema> = (Type extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TComputed<'Record', [Key, TComputed<Target, Parameters>]> : Key extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TComputed<'Record', [TComputed<Target, Parameters>, Type]> : Key extends TRef<infer Ref extends string> ? TComputed<'Record', [TRef<Ref>, Type]> : Key extends TTemplateLiteral ? TFromTemplateLiteralKey<Key, Type> : Key extends TEnum<infer Enum extends TEnumRecord> ? TFromEnumKey<Enum, Type> : Key extends TUnion<infer Types extends TSchema[]> ? TFromUnionKey<Types, Type> : Key extends TLiteral<infer Value extends TLiteralValue> ? TFromLiteralKey<Value, Type> : Key extends TInteger ? TFromIntegerKey<Key, Type> : Key extends TNumber ? TFromNumberKey<Key, Type> : Key extends TRegExp ? TFromRegExpKey<Key, Type> : Key extends TString ? TFromStringKey<Key, Type> : Key extends TAny ? TFromAnyKey<Key, Type> : Key extends TNever ? TFromNeverKey<Key, Type> : TNever);
60
+ export type TRecordOrObject<Key extends TSchema, Type extends TSchema> = (Type extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TComputed<'Record', [Key, TComputed<Target, Parameters>]> : Key extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TComputed<'Record', [TComputed<Target, Parameters>, Type]> : Key extends TRef<infer Ref extends string> ? TComputed<'Record', [TRef<Ref>, Type]> : Key extends TTemplateLiteral ? TFromTemplateLiteralKey<Key, Type> : Key extends TEnum<infer Enum extends TEnumRecord> ? TFromEnumKey<Enum, Type> : Key extends TUnion<infer Types extends TSchema[]> ? TFromUnionKey<Types, Type> : Key extends TLiteral<infer Value extends TLiteralValue> ? TFromLiteralKey<Value, Type> : Key extends TBoolean ? TFromBooleanKey<Key, Type> : Key extends TInteger ? TFromIntegerKey<Key, Type> : Key extends TNumber ? TFromNumberKey<Key, Type> : Key extends TRegExp ? TFromRegExpKey<Key, Type> : Key extends TString ? TFromStringKey<Key, Type> : Key extends TAny ? TFromAnyKey<Key, Type> : Key extends TNever ? TFromNeverKey<Key, Type> : TNever);
56
61
  /** `[Json]` Creates a Record type */
57
62
  export declare function Record<Key extends TSchema, Type extends TSchema>(key: Key, type: Type, options?: ObjectOptions): TRecordOrObject<Key, Type>;
63
+ /** Gets the Records Pattern */
64
+ export declare function RecordPattern(record: TRecord): string;
65
+ /** Gets the Records Key Type */
66
+ export type TRecordKey<Type extends TRecord> = (Type extends TRecord<infer Key extends TSchema, TSchema> ? (Key extends TNumber ? TNumber : Key extends TString ? TString : TString) : TString);
67
+ /** Gets the Records Key Type */
68
+ export declare function RecordKey<Type extends TRecord>(type: Type): TRecordKey<Type>;
69
+ /** Gets a Record Value Type */
70
+ export type TRecordValue<Type extends TRecord> = (Type extends TRecord<TSchema, infer Value extends TSchema> ? Value : TNever);
71
+ /** Gets a Record Value Type */
72
+ export declare function RecordValue<Type extends TRecord>(type: Type): TRecordValue<Type>;
58
73
  export {};
@@ -2,8 +2,10 @@ import { CreateType } from '../create/type.mjs';
2
2
  import { Kind, Hint } from '../symbols/index.mjs';
3
3
  import { Computed } from '../computed/index.mjs';
4
4
  import { Never } from '../never/index.mjs';
5
+ import { Number } from '../number/index.mjs';
5
6
  import { Object } from '../object/index.mjs';
6
7
  import { Ref } from '../ref/index.mjs';
8
+ import { String } from '../string/index.mjs';
7
9
  import { Union } from '../union/index.mjs';
8
10
  import { IsTemplateLiteralFinite } from '../template-literal/index.mjs';
9
11
  import { PatternStringExact, PatternNumberExact, PatternNeverExact } from '../patterns/index.mjs';
@@ -15,7 +17,7 @@ import { IsUndefined } from '../guard/value.mjs';
15
17
  // ------------------------------------------------------------------
16
18
  // TypeGuard
17
19
  // ------------------------------------------------------------------
18
- import { IsInteger, IsLiteral, IsAny, IsNever, IsNumber, IsString, IsRegExp, IsTemplateLiteral, IsUnion, IsRef, IsComputed } from '../guard/kind.mjs';
20
+ import { IsInteger, IsLiteral, IsAny, IsBoolean, IsNever, IsNumber, IsString, IsRegExp, IsTemplateLiteral, IsUnion, IsRef, IsComputed } from '../guard/kind.mjs';
19
21
  // ------------------------------------------------------------------
20
22
  // RecordCreateFromPattern
21
23
  // ------------------------------------------------------------------
@@ -65,6 +67,10 @@ function FromNeverKey(_key, type, options) {
65
67
  return RecordCreateFromPattern(PatternNeverExact, type, options);
66
68
  }
67
69
  // prettier-ignore
70
+ function FromBooleanKey(_key, type, options) {
71
+ return Object({ true: type, false: type }, options);
72
+ }
73
+ // prettier-ignore
68
74
  function FromIntegerKey(_key, type, options) {
69
75
  return RecordCreateFromPattern(PatternNumberExact, type, options);
70
76
  }
@@ -84,11 +90,32 @@ export function Record(key, type, options = {}) {
84
90
  IsUnion(key) ? FromUnionKey(key.anyOf, type, options) :
85
91
  IsTemplateLiteral(key) ? FromTemplateLiteralKey(key, type, options) :
86
92
  IsLiteral(key) ? FromLiteralKey(key.const, type, options) :
87
- IsInteger(key) ? FromIntegerKey(key, type, options) :
88
- IsNumber(key) ? FromNumberKey(key, type, options) :
89
- IsRegExp(key) ? FromRegExpKey(key, type, options) :
90
- IsString(key) ? FromStringKey(key, type, options) :
91
- IsAny(key) ? FromAnyKey(key, type, options) :
92
- IsNever(key) ? FromNeverKey(key, type, options) :
93
- Never(options));
93
+ IsBoolean(key) ? FromBooleanKey(key, type, options) :
94
+ IsInteger(key) ? FromIntegerKey(key, type, options) :
95
+ IsNumber(key) ? FromNumberKey(key, type, options) :
96
+ IsRegExp(key) ? FromRegExpKey(key, type, options) :
97
+ IsString(key) ? FromStringKey(key, type, options) :
98
+ IsAny(key) ? FromAnyKey(key, type, options) :
99
+ IsNever(key) ? FromNeverKey(key, type, options) :
100
+ Never(options));
101
+ }
102
+ // ------------------------------------------------------------------
103
+ // Record Utilities
104
+ // ------------------------------------------------------------------
105
+ /** Gets the Records Pattern */
106
+ export function RecordPattern(record) {
107
+ return globalThis.Object.getOwnPropertyNames(record.patternProperties)[0];
108
+ }
109
+ /** Gets the Records Key Type */
110
+ // prettier-ignore
111
+ export function RecordKey(type) {
112
+ const pattern = RecordPattern(type);
113
+ return (pattern === PatternStringExact ? String() :
114
+ pattern === PatternNumberExact ? Number() :
115
+ String({ pattern }));
116
+ }
117
+ /** Gets a Record Value Type */
118
+ // prettier-ignore
119
+ export function RecordValue(type) {
120
+ return type.patternProperties[RecordPattern(type)];
94
121
  }
@@ -0,0 +1 @@
1
+ export * from './remap.mjs';
@@ -0,0 +1 @@
1
+ export * from './remap.mjs';
@@ -0,0 +1,19 @@
1
+ import * as t from '@sinclair/typebox.mjs';
2
+ export type TCallback = (schema: t.TSchema) => t.TSchema;
3
+ export interface TMapping {
4
+ input: unknown;
5
+ output: unknown;
6
+ }
7
+ type TApply<Type extends t.TSchema, Mapping extends TMapping, Mapped = (Mapping & {
8
+ input: Type;
9
+ })['output'], Result = Mapped extends t.TSchema ? Mapped : never> = Result;
10
+ type TFromProperties<Properties extends t.TProperties, Mapping extends TMapping, Result extends t.TProperties = {
11
+ [Key in keyof Properties]: TRemap<Properties[Key], Mapping>;
12
+ }> = Result;
13
+ type TFromTypes<Types extends t.TSchema[], Mapping extends TMapping, Result extends t.TSchema[] = []> = (Types extends [infer Left extends t.TSchema, ...infer Right extends t.TSchema[]] ? TFromTypes<Right, Mapping, [...Result, TRemap<Left, Mapping>]> : Result);
14
+ type TFromType<Type extends t.TSchema, Mapping extends TMapping, Result extends t.TSchema = (TApply<Type, Mapping>)> = Result;
15
+ /** `[Internal]` Applies a recursive conditional remapping of a type and its sub type constituents */
16
+ export type TRemap<Type extends t.TSchema, Mapping extends TMapping, Mapped extends t.TSchema = TFromType<Type, Mapping>, Result extends t.TSchema = (Mapped extends t.TConstructor<infer Parameters extends t.TSchema[], infer ReturnType extends t.TSchema> ? t.TConstructor<TFromTypes<Parameters, Mapping>, TFromType<ReturnType, Mapping>> : Mapped extends t.TFunction<infer Parameters extends t.TSchema[], infer ReturnType extends t.TSchema> ? t.TFunction<TFromTypes<Parameters, Mapping>, TFromType<ReturnType, Mapping>> : Mapped extends t.TIntersect<infer Types extends t.TSchema[]> ? t.TIntersect<TFromTypes<Types, Mapping>> : Mapped extends t.TUnion<infer Types extends t.TSchema[]> ? t.TUnion<TFromTypes<Types, Mapping>> : Mapped extends t.TTuple<infer Types extends t.TSchema[]> ? t.TTuple<TFromTypes<Types, Mapping>> : Mapped extends t.TArray<infer Type extends t.TSchema> ? t.TArray<TFromType<Type, Mapping>> : Mapped extends t.TAsyncIterator<infer Type extends t.TSchema> ? t.TAsyncIterator<TFromType<Type, Mapping>> : Mapped extends t.TIterator<infer Type extends t.TSchema> ? t.TIterator<TFromType<Type, Mapping>> : Mapped extends t.TPromise<infer Type extends t.TSchema> ? t.TPromise<TFromType<Type, Mapping>> : Mapped extends t.TObject<infer Properties extends t.TProperties> ? t.TObject<TFromProperties<Properties, Mapping>> : Mapped extends t.TRecord<infer Key extends t.TSchema, infer Value extends t.TSchema> ? t.TRecordOrObject<TFromType<Key, Mapping>, TFromType<Value, Mapping>> : Mapped)> = Result;
17
+ /** `[Internal]` Applies a recursive conditional remapping of a type and its sub type constituents */
18
+ export declare function Remap(type: t.TSchema, callback: TCallback): t.TSchema;
19
+ export {};
@@ -0,0 +1,31 @@
1
+ import * as t from '@sinclair/typebox.mjs';
2
+ function FromProperties(properties, func) {
3
+ return globalThis.Object.getOwnPropertyNames(properties).reduce((result, key) => {
4
+ return { ...result, [key]: Remap(properties[key], func) };
5
+ }, {});
6
+ }
7
+ function FromTypes(types, callback) {
8
+ return types.map((type) => Remap(type, callback));
9
+ }
10
+ function FromType(type, callback) {
11
+ return callback(type);
12
+ }
13
+ /** `[Internal]` Applies a recursive conditional remapping of a type and its sub type constituents */
14
+ // prettier-ignore
15
+ export function Remap(type, callback) {
16
+ // Map incoming type
17
+ const mapped = t.CloneType(FromType(type, callback));
18
+ // Return remapped interior
19
+ return (t.KindGuard.IsConstructor(type) ? t.Constructor(FromTypes(type.parameters, callback), FromType(type.returns, callback), mapped) :
20
+ t.KindGuard.IsFunction(type) ? t.Function(FromTypes(type.parameters, callback), FromType(type.returns, callback), mapped) :
21
+ t.KindGuard.IsIntersect(type) ? t.Intersect(FromTypes(type.allOf, callback), mapped) :
22
+ t.KindGuard.IsUnion(type) ? t.Union(FromTypes(type.anyOf, callback), mapped) :
23
+ t.KindGuard.IsTuple(type) ? t.Tuple(FromTypes(type.items || [], callback), mapped) :
24
+ t.KindGuard.IsArray(type) ? t.Array(FromType(type.items, callback), mapped) :
25
+ t.KindGuard.IsAsyncIterator(type) ? t.AsyncIterator(FromType(type.items, callback), mapped) :
26
+ t.KindGuard.IsIterator(type) ? t.Iterator(FromType(type.items, callback), mapped) :
27
+ t.KindGuard.IsPromise(type) ? t.Promise(FromType(type.items, callback), mapped) :
28
+ t.KindGuard.IsObject(type) ? t.Object(FromProperties(type.properties, callback), mapped) :
29
+ t.KindGuard.IsRecord(type) ? t.Record(FromType(t.RecordKey(type), callback), FromType(t.RecordValue(type), callback), mapped) :
30
+ t.CloneType(mapped));
31
+ }
@@ -1,5 +1,6 @@
1
- import type { SchemaOptions } from '../schema/index.mjs';
2
- import type { TFunction } from '../function/index.mjs';
3
- export type TReturnType<T extends TFunction> = T['returns'];
1
+ import { type TSchema, type SchemaOptions } from '../schema/index.mjs';
2
+ import { type TFunction } from '../function/index.mjs';
3
+ import { type TNever } from '../never/index.mjs';
4
+ export type TReturnType<Type extends TSchema, Result extends TSchema = Type extends TFunction<infer _Parameters extends TSchema[], infer ReturnType extends TSchema> ? ReturnType : TNever> = Result;
4
5
  /** `[JavaScript]` Extracts the ReturnType from the given Function type */
5
- export declare function ReturnType<T extends TFunction<any[], any>>(schema: T, options?: SchemaOptions): TReturnType<T>;
6
+ export declare function ReturnType<Type extends TSchema>(schema: Type, options?: SchemaOptions): TReturnType<Type>;
@@ -1,5 +1,7 @@
1
1
  import { CreateType } from '../create/type.mjs';
2
+ import { Never } from '../never/index.mjs';
3
+ import * as KindGuard from '../guard/kind.mjs';
2
4
  /** `[JavaScript]` Extracts the ReturnType from the given Function type */
3
5
  export function ReturnType(schema, options) {
4
- return CreateType(schema.returns, options);
6
+ return (KindGuard.IsFunction(schema) ? CreateType(schema.returns, options) : Never(options));
5
7
  }
@@ -1,4 +1,5 @@
1
1
  import { JsonTypeBuilder } from './json.mjs';
2
+ import { type TArgument } from '../argument/index.mjs';
2
3
  import { type TAsyncIterator } from '../async-iterator/index.mjs';
3
4
  import { type TAwaited } from '../awaited/index.mjs';
4
5
  import { type TBigInt, type BigIntOptions } from '../bigint/index.mjs';
@@ -7,6 +8,7 @@ import { type TConstructorParameters } from '../constructor-parameters/index.mjs
7
8
  import { type TDate, type DateOptions } from '../date/index.mjs';
8
9
  import { type TFunction } from '../function/index.mjs';
9
10
  import { type TInstanceType } from '../instance-type/index.mjs';
11
+ import { type TInstantiate } from '../instantiate/index.mjs';
10
12
  import { type TIterator } from '../iterator/index.mjs';
11
13
  import { type TParameters } from '../parameters/index.mjs';
12
14
  import { type TPromise } from '../promise/index.mjs';
@@ -19,6 +21,8 @@ import { type TUndefined } from '../undefined/index.mjs';
19
21
  import { type TVoid } from '../void/index.mjs';
20
22
  /** JavaScript Type Builder with Static Resolution for TypeScript */
21
23
  export declare class JavaScriptTypeBuilder extends JsonTypeBuilder {
24
+ /** `[JavaScript]` Creates a Generic Argument Type */
25
+ Argument<Index extends number>(index: Index): TArgument<Index>;
22
26
  /** `[JavaScript]` Creates a AsyncIterator type */
23
27
  AsyncIterator<Type extends TSchema>(items: Type, options?: SchemaOptions): TAsyncIterator<Type>;
24
28
  /** `[JavaScript]` Constructs a type by recursively unwrapping Promise types */
@@ -26,7 +30,7 @@ export declare class JavaScriptTypeBuilder extends JsonTypeBuilder {
26
30
  /** `[JavaScript]` Creates a BigInt type */
27
31
  BigInt(options?: BigIntOptions): TBigInt;
28
32
  /** `[JavaScript]` Extracts the ConstructorParameters from the given Constructor type */
29
- ConstructorParameters<Type extends TConstructor>(schema: Type, options?: SchemaOptions): TConstructorParameters<Type>;
33
+ ConstructorParameters<Type extends TSchema>(schema: Type, options?: SchemaOptions): TConstructorParameters<Type>;
30
34
  /** `[JavaScript]` Creates a Constructor type */
31
35
  Constructor<Parameters extends TSchema[], InstanceType extends TSchema>(parameters: [...Parameters], instanceType: InstanceType, options?: SchemaOptions): TConstructor<Parameters, InstanceType>;
32
36
  /** `[JavaScript]` Creates a Date type */
@@ -34,11 +38,13 @@ export declare class JavaScriptTypeBuilder extends JsonTypeBuilder {
34
38
  /** `[JavaScript]` Creates a Function type */
35
39
  Function<Parameters extends TSchema[], ReturnType extends TSchema>(parameters: [...Parameters], returnType: ReturnType, options?: SchemaOptions): TFunction<Parameters, ReturnType>;
36
40
  /** `[JavaScript]` Extracts the InstanceType from the given Constructor type */
37
- InstanceType<Type extends TConstructor>(schema: Type, options?: SchemaOptions): TInstanceType<Type>;
41
+ InstanceType<Type extends TSchema>(schema: Type, options?: SchemaOptions): TInstanceType<Type>;
42
+ /** `[JavaScript]` Instantiates a type with the given parameters */
43
+ Instantiate<Type extends TSchema, Parameters extends TSchema[]>(schema: Type, parameters: [...Parameters]): TInstantiate<Type, Parameters>;
38
44
  /** `[JavaScript]` Creates an Iterator type */
39
45
  Iterator<Type extends TSchema>(items: Type, options?: SchemaOptions): TIterator<Type>;
40
46
  /** `[JavaScript]` Extracts the Parameters from the given Function type */
41
- Parameters<Type extends TFunction>(schema: Type, options?: SchemaOptions): TParameters<Type>;
47
+ Parameters<Type extends TSchema>(schema: Type, options?: SchemaOptions): TParameters<Type>;
42
48
  /** `[JavaScript]` Creates a Promise type */
43
49
  Promise<Type extends TSchema>(item: Type, options?: SchemaOptions): TPromise<Type>;
44
50
  /** `[JavaScript]` Creates a RegExp type */
@@ -46,7 +52,7 @@ export declare class JavaScriptTypeBuilder extends JsonTypeBuilder {
46
52
  /** `[JavaScript]` Creates a RegExp type */
47
53
  RegExp(regex: RegExp, options?: RegExpOptions): TRegExp;
48
54
  /** `[JavaScript]` Extracts the ReturnType from the given Function type */
49
- ReturnType<Type extends TFunction>(type: Type, options?: SchemaOptions): TReturnType<Type>;
55
+ ReturnType<Type extends TSchema>(type: Type, options?: SchemaOptions): TReturnType<Type>;
50
56
  /** `[JavaScript]` Creates a Symbol type */
51
57
  Symbol(options?: SchemaOptions): TSymbol;
52
58
  /** `[JavaScript]` Creates a Undefined type */
@@ -1,4 +1,5 @@
1
1
  import { JsonTypeBuilder } from './json.mjs';
2
+ import { Argument } from '../argument/index.mjs';
2
3
  import { AsyncIterator } from '../async-iterator/index.mjs';
3
4
  import { Awaited } from '../awaited/index.mjs';
4
5
  import { BigInt } from '../bigint/index.mjs';
@@ -7,6 +8,7 @@ import { ConstructorParameters } from '../constructor-parameters/index.mjs';
7
8
  import { Date } from '../date/index.mjs';
8
9
  import { Function as FunctionType } from '../function/index.mjs';
9
10
  import { InstanceType } from '../instance-type/index.mjs';
11
+ import { Instantiate } from '../instantiate/index.mjs';
10
12
  import { Iterator } from '../iterator/index.mjs';
11
13
  import { Parameters } from '../parameters/index.mjs';
12
14
  import { Promise } from '../promise/index.mjs';
@@ -18,6 +20,10 @@ import { Undefined } from '../undefined/index.mjs';
18
20
  import { Void } from '../void/index.mjs';
19
21
  /** JavaScript Type Builder with Static Resolution for TypeScript */
20
22
  export class JavaScriptTypeBuilder extends JsonTypeBuilder {
23
+ /** `[JavaScript]` Creates a Generic Argument Type */
24
+ Argument(index) {
25
+ return Argument(index);
26
+ }
21
27
  /** `[JavaScript]` Creates a AsyncIterator type */
22
28
  AsyncIterator(items, options) {
23
29
  return AsyncIterator(items, options);
@@ -50,6 +56,10 @@ export class JavaScriptTypeBuilder extends JsonTypeBuilder {
50
56
  InstanceType(schema, options) {
51
57
  return InstanceType(schema, options);
52
58
  }
59
+ /** `[JavaScript]` Instantiates a type with the given parameters */
60
+ Instantiate(schema, parameters) {
61
+ return Instantiate(schema, parameters);
62
+ }
53
63
  /** `[JavaScript]` Creates an Iterator type */
54
64
  Iterator(items, options) {
55
65
  return Iterator(items, options);
@@ -1,4 +1,5 @@
1
1
  export { Any } from '../any/index.mjs';
2
+ export { Argument } from '../argument/index.mjs';
2
3
  export { Array } from '../array/index.mjs';
3
4
  export { AsyncIterator } from '../async-iterator/index.mjs';
4
5
  export { Awaited } from '../awaited/index.mjs';
@@ -16,6 +17,7 @@ export { Extract } from '../extract/index.mjs';
16
17
  export { Function } from '../function/index.mjs';
17
18
  export { Index } from '../indexed/index.mjs';
18
19
  export { InstanceType } from '../instance-type/index.mjs';
20
+ export { Instantiate } from '../instantiate/index.mjs';
19
21
  export { Integer } from '../integer/index.mjs';
20
22
  export { Intersect } from '../intersect/index.mjs';
21
23
  export { Capitalize, Uncapitalize, Lowercase, Uppercase } from '../intrinsic/index.mjs';
@@ -41,6 +43,7 @@ export { Record } from '../record/index.mjs';
41
43
  export { Recursive } from '../recursive/index.mjs';
42
44
  export { Ref } from '../ref/index.mjs';
43
45
  export { RegExp } from '../regexp/index.mjs';
46
+ export { Remap } from '../remap/index.mjs';
44
47
  export { Required } from '../required/index.mjs';
45
48
  export { Rest } from '../rest/index.mjs';
46
49
  export { ReturnType } from '../return-type/index.mjs';
@@ -2,6 +2,7 @@
2
2
  // Type: Module
3
3
  // ------------------------------------------------------------------
4
4
  export { Any } from '../any/index.mjs';
5
+ export { Argument } from '../argument/index.mjs';
5
6
  export { Array } from '../array/index.mjs';
6
7
  export { AsyncIterator } from '../async-iterator/index.mjs';
7
8
  export { Awaited } from '../awaited/index.mjs';
@@ -19,6 +20,7 @@ export { Extract } from '../extract/index.mjs';
19
20
  export { Function } from '../function/index.mjs';
20
21
  export { Index } from '../indexed/index.mjs';
21
22
  export { InstanceType } from '../instance-type/index.mjs';
23
+ export { Instantiate } from '../instantiate/index.mjs';
22
24
  export { Integer } from '../integer/index.mjs';
23
25
  export { Intersect } from '../intersect/index.mjs';
24
26
  export { Capitalize, Uncapitalize, Lowercase, Uppercase } from '../intrinsic/index.mjs';
@@ -44,6 +46,7 @@ export { Record } from '../record/index.mjs';
44
46
  export { Recursive } from '../recursive/index.mjs';
45
47
  export { Ref } from '../ref/index.mjs';
46
48
  export { RegExp } from '../regexp/index.mjs';
49
+ export { Remap } from '../remap/index.mjs';
47
50
  export { Required } from '../required/index.mjs';
48
51
  export { Rest } from '../rest/index.mjs';
49
52
  export { ReturnType } from '../return-type/index.mjs';