typia 9.7.2 → 10.0.0-dev.20251107

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 (116) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +153 -153
  3. package/lib/factories/ProtobufFactory.js +1 -1
  4. package/lib/factories/ProtobufFactory.mjs +1 -1
  5. package/lib/programmers/internal/json_schema_station.d.mts +2 -2
  6. package/lib/programmers/internal/json_schema_station.d.ts +2 -2
  7. package/lib/programmers/llm/LlmApplicationProgrammer.js +5 -1
  8. package/lib/programmers/llm/LlmApplicationProgrammer.js.map +1 -1
  9. package/lib/programmers/llm/LlmApplicationProgrammer.mjs +5 -1
  10. package/lib/programmers/llm/LlmSchemaProgrammer.js +1 -4
  11. package/lib/programmers/llm/LlmSchemaProgrammer.js.map +1 -1
  12. package/lib/programmers/llm/LlmSchemaProgrammer.mjs +1 -35
  13. package/package.json +121 -121
  14. package/src/AssertionGuard.ts +41 -41
  15. package/src/CamelCase.ts +75 -75
  16. package/src/IRandomGenerator.ts +337 -337
  17. package/src/IReadableURLSearchParams.ts +9 -9
  18. package/src/PascalCase.ts +71 -71
  19. package/src/Primitive.ts +90 -90
  20. package/src/Resolved.ts +72 -72
  21. package/src/SnakeCase.ts +127 -127
  22. package/src/TypeGuardError.ts +216 -216
  23. package/src/factories/MetadataCollection.ts +270 -270
  24. package/src/factories/MetadataCommentTagFactory.ts +632 -632
  25. package/src/factories/MetadataFactory.ts +402 -402
  26. package/src/factories/ProtobufFactory.ts +873 -873
  27. package/src/functional.ts +705 -705
  28. package/src/http.ts +972 -972
  29. package/src/internal/_ProtobufReader.ts +188 -188
  30. package/src/internal/_ProtobufSizer.ts +137 -137
  31. package/src/internal/_ProtobufWriter.ts +135 -135
  32. package/src/internal/_jsonStringifyString.ts +42 -42
  33. package/src/json.ts +643 -643
  34. package/src/llm.ts +615 -615
  35. package/src/misc.ts +594 -594
  36. package/src/module.ts +889 -889
  37. package/src/notations.ts +751 -751
  38. package/src/programmers/FeatureProgrammer.ts +605 -605
  39. package/src/programmers/ImportProgrammer.ts +179 -179
  40. package/src/programmers/RandomProgrammer.ts +1195 -1195
  41. package/src/programmers/helpers/ProtobufWire.ts +34 -34
  42. package/src/programmers/internal/check_array_length.ts +43 -43
  43. package/src/programmers/internal/check_bigint.ts +46 -46
  44. package/src/programmers/internal/check_dynamic_key.ts +197 -197
  45. package/src/programmers/internal/check_dynamic_properties.ts +231 -231
  46. package/src/programmers/internal/check_everything.ts +21 -21
  47. package/src/programmers/internal/check_native.ts +23 -23
  48. package/src/programmers/internal/check_number.ts +108 -108
  49. package/src/programmers/internal/check_object.ts +72 -72
  50. package/src/programmers/internal/check_string.ts +46 -46
  51. package/src/programmers/internal/check_template.ts +46 -46
  52. package/src/programmers/internal/check_union_array_like.ts +331 -331
  53. package/src/programmers/internal/decode_union_object.ts +110 -110
  54. package/src/programmers/internal/feature_object_entries.ts +59 -59
  55. package/src/programmers/internal/json_schema_escaped.ts +78 -78
  56. package/src/programmers/internal/json_schema_object.ts +150 -150
  57. package/src/programmers/internal/json_schema_station.ts +2 -2
  58. package/src/programmers/internal/metadata_to_pattern.ts +40 -40
  59. package/src/programmers/internal/postfix_of_tuple.ts +3 -3
  60. package/src/programmers/internal/prune_object_properties.ts +69 -69
  61. package/src/programmers/internal/stringify_dynamic_properties.ts +158 -158
  62. package/src/programmers/internal/stringify_native.ts +5 -5
  63. package/src/programmers/internal/stringify_regular_properties.ts +77 -77
  64. package/src/programmers/internal/template_to_pattern.ts +21 -21
  65. package/src/programmers/internal/wrap_metadata_rest_tuple.ts +21 -21
  66. package/src/programmers/json/JsonStringifyProgrammer.ts +1124 -1124
  67. package/src/programmers/llm/LlmApplicationProgrammer.ts +10 -1
  68. package/src/programmers/llm/LlmSchemaProgrammer.ts +2 -7
  69. package/src/protobuf.ts +820 -820
  70. package/src/reflect.ts +46 -46
  71. package/src/schemas/json/IJsonApplication.ts +77 -77
  72. package/src/schemas/json/IJsonSchemaCollection.ts +212 -212
  73. package/src/schemas/json/IJsonSchemaUnit.ts +263 -263
  74. package/src/schemas/metadata/IMetadataTypeTag.ts +14 -14
  75. package/src/schemas/metadata/Metadata.ts +669 -669
  76. package/src/schemas/metadata/MetadataAliasType.ts +57 -57
  77. package/src/schemas/metadata/MetadataApplication.ts +40 -40
  78. package/src/schemas/metadata/MetadataArray.ts +47 -47
  79. package/src/schemas/metadata/MetadataArrayType.ts +51 -51
  80. package/src/schemas/metadata/MetadataAtomic.ts +85 -85
  81. package/src/schemas/metadata/MetadataEscaped.ts +45 -45
  82. package/src/schemas/metadata/MetadataFunction.ts +45 -45
  83. package/src/schemas/metadata/MetadataObject.ts +46 -46
  84. package/src/schemas/metadata/MetadataObjectType.ts +137 -137
  85. package/src/schemas/metadata/MetadataParameter.ts +52 -52
  86. package/src/schemas/metadata/MetadataProperty.ts +53 -53
  87. package/src/schemas/metadata/MetadataTemplate.ts +78 -78
  88. package/src/schemas/metadata/MetadataTuple.ts +28 -28
  89. package/src/schemas/metadata/MetadataTupleType.ts +61 -61
  90. package/src/tags/Constant.ts +47 -47
  91. package/src/tags/ContentMediaType.ts +27 -27
  92. package/src/tags/Default.ts +52 -52
  93. package/src/tags/Example.ts +56 -56
  94. package/src/tags/Examples.ts +56 -56
  95. package/src/tags/ExclusiveMaximum.ts +44 -44
  96. package/src/tags/ExclusiveMinimum.ts +44 -44
  97. package/src/tags/Format.ts +78 -78
  98. package/src/tags/JsonSchemaPlugin.ts +36 -36
  99. package/src/tags/MaxItems.ts +31 -31
  100. package/src/tags/MaxLength.ts +25 -25
  101. package/src/tags/Maximum.ts +39 -39
  102. package/src/tags/MinItems.ts +31 -31
  103. package/src/tags/MinLength.ts +25 -25
  104. package/src/tags/Minimum.ts +39 -39
  105. package/src/tags/MultipleOf.ts +42 -42
  106. package/src/tags/Pattern.ts +49 -49
  107. package/src/tags/Sequence.ts +37 -37
  108. package/src/tags/TagBase.ts +102 -102
  109. package/src/tags/Type.ts +64 -64
  110. package/src/tags/UniqueItems.ts +34 -34
  111. package/src/tags/internal/FormatCheatSheet.ts +71 -71
  112. package/src/transformers/ITransformOptions.ts +70 -70
  113. package/src/transformers/ImportTransformer.ts +253 -253
  114. package/src/transformers/NoTransformConfigurationError.ts +16 -16
  115. package/src/transformers/features/llm/LlmApplicationTransformer.ts +224 -224
  116. package/src/typings/Equal.ts +18 -18
@@ -1,231 +1,231 @@
1
- import ts from "typescript";
2
-
3
- import { ExpressionFactory } from "../../factories/ExpressionFactory";
4
- import { IdentifierFactory } from "../../factories/IdentifierFactory";
5
- import { StatementFactory } from "../../factories/StatementFactory";
6
-
7
- import { ITypiaContext } from "../../transformers/ITypiaContext";
8
-
9
- import { IExpressionEntry } from "../helpers/IExpressionEntry";
10
- import { check_dynamic_key } from "./check_dynamic_key";
11
- import { check_everything } from "./check_everything";
12
- import { check_object } from "./check_object";
13
-
14
- /** @internal */
15
- export const check_dynamic_properties = (props: {
16
- config: check_object.IConfig;
17
- context: ITypiaContext;
18
- regular: IExpressionEntry<ts.Expression>[];
19
- dynamic: IExpressionEntry<ts.Expression>[];
20
- input: ts.Expression;
21
- }): ts.Expression => {
22
- const length = IdentifierFactory.access(
23
- ts.factory.createCallExpression(
24
- ts.factory.createIdentifier("Object.keys"),
25
- undefined,
26
- [props.input],
27
- ),
28
- "length",
29
- );
30
- const left: ts.Expression | null =
31
- props.config.equals === true && props.dynamic.length === 0
32
- ? props.config.undefined === true ||
33
- props.regular.every((r) => r.meta.isRequired())
34
- ? ts.factory.createStrictEquality(
35
- ExpressionFactory.number(
36
- props.regular.filter((r) => r.meta.isRequired()).length,
37
- ),
38
- length,
39
- )
40
- : ts.factory.createCallExpression(
41
- props.context.importer.internal("isBetween"),
42
- [],
43
- [
44
- length,
45
- ExpressionFactory.number(
46
- props.regular.filter((r) => r.meta.isRequired()).length,
47
- ),
48
- ExpressionFactory.number(props.regular.length),
49
- ],
50
- )
51
- : null;
52
- if (
53
- left !== null &&
54
- props.config.undefined === false &&
55
- props.regular.every((r) => r.meta.isRequired())
56
- )
57
- return left;
58
-
59
- const criteria: ts.CallExpression = props.config.entries
60
- ? ts.factory.createCallExpression(props.config.entries, undefined, [
61
- ts.factory.createCallExpression(
62
- ts.factory.createIdentifier("Object.keys"),
63
- undefined,
64
- [props.input],
65
- ),
66
- check_dynamic_property(props),
67
- ])
68
- : ts.factory.createCallExpression(
69
- IdentifierFactory.access(
70
- ts.factory.createCallExpression(
71
- ts.factory.createIdentifier("Object.keys"),
72
- undefined,
73
- [props.input],
74
- ),
75
- props.config.assert ? "every" : "map",
76
- ),
77
- undefined,
78
- [check_dynamic_property(props)],
79
- );
80
- const right: ts.Expression = (props.config.halt || ((elem) => elem))(
81
- props.config.assert ? criteria : check_everything(criteria),
82
- );
83
- return left
84
- ? (props.config.undefined
85
- ? ts.factory.createLogicalOr
86
- : ts.factory.createLogicalAnd)(left, right)
87
- : right;
88
- };
89
-
90
- /** @internal */
91
- const check_dynamic_property = (props: {
92
- config: check_object.IConfig;
93
- context: ITypiaContext;
94
- regular: IExpressionEntry<ts.Expression>[];
95
- dynamic: IExpressionEntry<ts.Expression>[];
96
- input: ts.Expression;
97
- }) => {
98
- //----
99
- // IF CONDITIONS
100
- //----
101
- // PREPARE ASSETS
102
- const key = ts.factory.createIdentifier("key");
103
- const value = ts.factory.createIdentifier("value");
104
-
105
- const statements: ts.Statement[] = [];
106
- const add = (expression: ts.Expression, output: ts.Expression) =>
107
- statements.push(
108
- ts.factory.createIfStatement(
109
- expression,
110
- ts.factory.createReturnStatement(output),
111
- ),
112
- );
113
- const broken = { value: false };
114
-
115
- // GATHER CONDITIONS
116
- if (props.regular.length)
117
- add(is_regular_property(props.regular), props.config.positive);
118
- statements.push(
119
- StatementFactory.constant({
120
- name: "value",
121
- value: ts.factory.createElementAccessExpression(props.input, key),
122
- }),
123
- );
124
- if (props.config.undefined === true)
125
- add(
126
- ts.factory.createStrictEquality(
127
- ts.factory.createIdentifier("undefined"),
128
- value,
129
- ),
130
- props.config.positive,
131
- );
132
-
133
- for (const entry of props.dynamic) {
134
- const condition: ts.Expression = check_dynamic_key({
135
- context: props.context,
136
- metadata: entry.key,
137
- input: key,
138
- });
139
- if (condition.kind === ts.SyntaxKind.TrueKeyword) {
140
- statements.push(ts.factory.createReturnStatement(entry.expression));
141
- broken.value = true;
142
- break;
143
- } else add(condition, entry.expression);
144
- }
145
-
146
- //----
147
- // FUNCTION BODY
148
- //----
149
- // CLOSURE BLOCK
150
- const block: ts.Block = ts.factory.createBlock(
151
- [
152
- ...statements,
153
- ...(broken.value
154
- ? []
155
- : [
156
- ts.factory.createReturnStatement(
157
- props.config.equals === true
158
- ? props.config.superfluous(
159
- value,
160
- ts.factory.createCallExpression(
161
- ts.factory.createPropertyAccessExpression(
162
- ts.factory.createArrayLiteralExpression(
163
- [
164
- ts.factory.createTemplateExpression(
165
- ts.factory.createTemplateHead("The property `"),
166
- [
167
- ts.factory.createTemplateSpan(
168
- ts.factory.createIdentifier("key"),
169
- ts.factory.createTemplateTail(
170
- "` is not defined in the object type.",
171
- ),
172
- ),
173
- ],
174
- ),
175
- ts.factory.createStringLiteral(""),
176
- ts.factory.createStringLiteral(
177
- "Please remove the property next time.",
178
- ),
179
- ],
180
- true,
181
- ),
182
- "join",
183
- ),
184
- undefined,
185
- [ts.factory.createStringLiteral("\n")],
186
- ),
187
- )
188
- : props.config.positive,
189
- ),
190
- ]),
191
- ],
192
- true,
193
- );
194
-
195
- // RETURNS
196
- return ts.factory.createArrowFunction(
197
- undefined,
198
- undefined,
199
- [IdentifierFactory.parameter("key")],
200
- undefined,
201
- undefined,
202
- block,
203
- );
204
- };
205
-
206
- /** @internal */
207
- const is_regular_property = (regular: IExpressionEntry[]) =>
208
- ts.factory.createCallExpression(
209
- IdentifierFactory.access(
210
- ts.factory.createArrayLiteralExpression(
211
- regular.map((entry) =>
212
- ts.factory.createStringLiteral(entry.key.getSoleLiteral()!),
213
- ),
214
- ),
215
- "some",
216
- ),
217
- undefined,
218
- [
219
- ts.factory.createArrowFunction(
220
- undefined,
221
- undefined,
222
- [IdentifierFactory.parameter("prop")],
223
- undefined,
224
- undefined,
225
- ts.factory.createStrictEquality(
226
- ts.factory.createIdentifier("key"),
227
- ts.factory.createIdentifier("prop"),
228
- ),
229
- ),
230
- ],
231
- );
1
+ import ts from "typescript";
2
+
3
+ import { ExpressionFactory } from "../../factories/ExpressionFactory";
4
+ import { IdentifierFactory } from "../../factories/IdentifierFactory";
5
+ import { StatementFactory } from "../../factories/StatementFactory";
6
+
7
+ import { ITypiaContext } from "../../transformers/ITypiaContext";
8
+
9
+ import { IExpressionEntry } from "../helpers/IExpressionEntry";
10
+ import { check_dynamic_key } from "./check_dynamic_key";
11
+ import { check_everything } from "./check_everything";
12
+ import { check_object } from "./check_object";
13
+
14
+ /** @internal */
15
+ export const check_dynamic_properties = (props: {
16
+ config: check_object.IConfig;
17
+ context: ITypiaContext;
18
+ regular: IExpressionEntry<ts.Expression>[];
19
+ dynamic: IExpressionEntry<ts.Expression>[];
20
+ input: ts.Expression;
21
+ }): ts.Expression => {
22
+ const length = IdentifierFactory.access(
23
+ ts.factory.createCallExpression(
24
+ ts.factory.createIdentifier("Object.keys"),
25
+ undefined,
26
+ [props.input],
27
+ ),
28
+ "length",
29
+ );
30
+ const left: ts.Expression | null =
31
+ props.config.equals === true && props.dynamic.length === 0
32
+ ? props.config.undefined === true ||
33
+ props.regular.every((r) => r.meta.isRequired())
34
+ ? ts.factory.createStrictEquality(
35
+ ExpressionFactory.number(
36
+ props.regular.filter((r) => r.meta.isRequired()).length,
37
+ ),
38
+ length,
39
+ )
40
+ : ts.factory.createCallExpression(
41
+ props.context.importer.internal("isBetween"),
42
+ [],
43
+ [
44
+ length,
45
+ ExpressionFactory.number(
46
+ props.regular.filter((r) => r.meta.isRequired()).length,
47
+ ),
48
+ ExpressionFactory.number(props.regular.length),
49
+ ],
50
+ )
51
+ : null;
52
+ if (
53
+ left !== null &&
54
+ props.config.undefined === false &&
55
+ props.regular.every((r) => r.meta.isRequired())
56
+ )
57
+ return left;
58
+
59
+ const criteria: ts.CallExpression = props.config.entries
60
+ ? ts.factory.createCallExpression(props.config.entries, undefined, [
61
+ ts.factory.createCallExpression(
62
+ ts.factory.createIdentifier("Object.keys"),
63
+ undefined,
64
+ [props.input],
65
+ ),
66
+ check_dynamic_property(props),
67
+ ])
68
+ : ts.factory.createCallExpression(
69
+ IdentifierFactory.access(
70
+ ts.factory.createCallExpression(
71
+ ts.factory.createIdentifier("Object.keys"),
72
+ undefined,
73
+ [props.input],
74
+ ),
75
+ props.config.assert ? "every" : "map",
76
+ ),
77
+ undefined,
78
+ [check_dynamic_property(props)],
79
+ );
80
+ const right: ts.Expression = (props.config.halt || ((elem) => elem))(
81
+ props.config.assert ? criteria : check_everything(criteria),
82
+ );
83
+ return left
84
+ ? (props.config.undefined
85
+ ? ts.factory.createLogicalOr
86
+ : ts.factory.createLogicalAnd)(left, right)
87
+ : right;
88
+ };
89
+
90
+ /** @internal */
91
+ const check_dynamic_property = (props: {
92
+ config: check_object.IConfig;
93
+ context: ITypiaContext;
94
+ regular: IExpressionEntry<ts.Expression>[];
95
+ dynamic: IExpressionEntry<ts.Expression>[];
96
+ input: ts.Expression;
97
+ }) => {
98
+ //----
99
+ // IF CONDITIONS
100
+ //----
101
+ // PREPARE ASSETS
102
+ const key = ts.factory.createIdentifier("key");
103
+ const value = ts.factory.createIdentifier("value");
104
+
105
+ const statements: ts.Statement[] = [];
106
+ const add = (expression: ts.Expression, output: ts.Expression) =>
107
+ statements.push(
108
+ ts.factory.createIfStatement(
109
+ expression,
110
+ ts.factory.createReturnStatement(output),
111
+ ),
112
+ );
113
+ const broken = { value: false };
114
+
115
+ // GATHER CONDITIONS
116
+ if (props.regular.length)
117
+ add(is_regular_property(props.regular), props.config.positive);
118
+ statements.push(
119
+ StatementFactory.constant({
120
+ name: "value",
121
+ value: ts.factory.createElementAccessExpression(props.input, key),
122
+ }),
123
+ );
124
+ if (props.config.undefined === true)
125
+ add(
126
+ ts.factory.createStrictEquality(
127
+ ts.factory.createIdentifier("undefined"),
128
+ value,
129
+ ),
130
+ props.config.positive,
131
+ );
132
+
133
+ for (const entry of props.dynamic) {
134
+ const condition: ts.Expression = check_dynamic_key({
135
+ context: props.context,
136
+ metadata: entry.key,
137
+ input: key,
138
+ });
139
+ if (condition.kind === ts.SyntaxKind.TrueKeyword) {
140
+ statements.push(ts.factory.createReturnStatement(entry.expression));
141
+ broken.value = true;
142
+ break;
143
+ } else add(condition, entry.expression);
144
+ }
145
+
146
+ //----
147
+ // FUNCTION BODY
148
+ //----
149
+ // CLOSURE BLOCK
150
+ const block: ts.Block = ts.factory.createBlock(
151
+ [
152
+ ...statements,
153
+ ...(broken.value
154
+ ? []
155
+ : [
156
+ ts.factory.createReturnStatement(
157
+ props.config.equals === true
158
+ ? props.config.superfluous(
159
+ value,
160
+ ts.factory.createCallExpression(
161
+ ts.factory.createPropertyAccessExpression(
162
+ ts.factory.createArrayLiteralExpression(
163
+ [
164
+ ts.factory.createTemplateExpression(
165
+ ts.factory.createTemplateHead("The property `"),
166
+ [
167
+ ts.factory.createTemplateSpan(
168
+ ts.factory.createIdentifier("key"),
169
+ ts.factory.createTemplateTail(
170
+ "` is not defined in the object type.",
171
+ ),
172
+ ),
173
+ ],
174
+ ),
175
+ ts.factory.createStringLiteral(""),
176
+ ts.factory.createStringLiteral(
177
+ "Please remove the property next time.",
178
+ ),
179
+ ],
180
+ true,
181
+ ),
182
+ "join",
183
+ ),
184
+ undefined,
185
+ [ts.factory.createStringLiteral("\n")],
186
+ ),
187
+ )
188
+ : props.config.positive,
189
+ ),
190
+ ]),
191
+ ],
192
+ true,
193
+ );
194
+
195
+ // RETURNS
196
+ return ts.factory.createArrowFunction(
197
+ undefined,
198
+ undefined,
199
+ [IdentifierFactory.parameter("key")],
200
+ undefined,
201
+ undefined,
202
+ block,
203
+ );
204
+ };
205
+
206
+ /** @internal */
207
+ const is_regular_property = (regular: IExpressionEntry[]) =>
208
+ ts.factory.createCallExpression(
209
+ IdentifierFactory.access(
210
+ ts.factory.createArrayLiteralExpression(
211
+ regular.map((entry) =>
212
+ ts.factory.createStringLiteral(entry.key.getSoleLiteral()!),
213
+ ),
214
+ ),
215
+ "some",
216
+ ),
217
+ undefined,
218
+ [
219
+ ts.factory.createArrowFunction(
220
+ undefined,
221
+ undefined,
222
+ [IdentifierFactory.parameter("prop")],
223
+ undefined,
224
+ undefined,
225
+ ts.factory.createStrictEquality(
226
+ ts.factory.createIdentifier("key"),
227
+ ts.factory.createIdentifier("prop"),
228
+ ),
229
+ ),
230
+ ],
231
+ );
@@ -1,21 +1,21 @@
1
- import ts from "typescript";
2
-
3
- import { IdentifierFactory } from "../../factories/IdentifierFactory";
4
- import { TypeFactory } from "../../factories/TypeFactory";
5
-
6
- /** @internal */
7
- export const check_everything = (array: ts.Expression) =>
8
- ts.factory.createCallExpression(
9
- IdentifierFactory.access(array, "every"),
10
- undefined,
11
- [
12
- ts.factory.createArrowFunction(
13
- undefined,
14
- undefined,
15
- [IdentifierFactory.parameter("flag", TypeFactory.keyword("boolean"))],
16
- undefined,
17
- undefined,
18
- ts.factory.createIdentifier("flag"),
19
- ),
20
- ],
21
- );
1
+ import ts from "typescript";
2
+
3
+ import { IdentifierFactory } from "../../factories/IdentifierFactory";
4
+ import { TypeFactory } from "../../factories/TypeFactory";
5
+
6
+ /** @internal */
7
+ export const check_everything = (array: ts.Expression) =>
8
+ ts.factory.createCallExpression(
9
+ IdentifierFactory.access(array, "every"),
10
+ undefined,
11
+ [
12
+ ts.factory.createArrowFunction(
13
+ undefined,
14
+ undefined,
15
+ [IdentifierFactory.parameter("flag", TypeFactory.keyword("boolean"))],
16
+ undefined,
17
+ undefined,
18
+ ts.factory.createIdentifier("flag"),
19
+ ),
20
+ ],
21
+ );
@@ -1,23 +1,23 @@
1
- import ts from "typescript";
2
-
3
- import { ExpressionFactory } from "../../factories/ExpressionFactory";
4
-
5
- /** @internal */
6
- export const check_native = (props: {
7
- name: string;
8
- input: ts.Expression;
9
- }): ts.Expression => {
10
- const instanceOf = ExpressionFactory.isInstanceOf(props.name, props.input);
11
- return ATOMIC_LIKE.has(props.name)
12
- ? ts.factory.createLogicalOr(
13
- ts.factory.createStrictEquality(
14
- ts.factory.createStringLiteral(props.name.toLowerCase()),
15
- ts.factory.createTypeOfExpression(props.input),
16
- ),
17
- instanceOf,
18
- )
19
- : instanceOf;
20
- };
21
-
22
- /** @internal */
23
- const ATOMIC_LIKE = new Set(["Boolean", "Number", "String"]);
1
+ import ts from "typescript";
2
+
3
+ import { ExpressionFactory } from "../../factories/ExpressionFactory";
4
+
5
+ /** @internal */
6
+ export const check_native = (props: {
7
+ name: string;
8
+ input: ts.Expression;
9
+ }): ts.Expression => {
10
+ const instanceOf = ExpressionFactory.isInstanceOf(props.name, props.input);
11
+ return ATOMIC_LIKE.has(props.name)
12
+ ? ts.factory.createLogicalOr(
13
+ ts.factory.createStrictEquality(
14
+ ts.factory.createStringLiteral(props.name.toLowerCase()),
15
+ ts.factory.createTypeOfExpression(props.input),
16
+ ),
17
+ instanceOf,
18
+ )
19
+ : instanceOf;
20
+ };
21
+
22
+ /** @internal */
23
+ const ATOMIC_LIKE = new Set(["Boolean", "Number", "String"]);