typia 6.7.3-dev.20240808 → 6.8.0-dev.20240811
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.
- package/lib/factories/TypeFactory.d.ts +0 -2
- package/lib/factories/TypeFactory.js +4 -83
- package/lib/factories/TypeFactory.js.map +1 -1
- package/lib/factories/internal/metadata/emplace_metadata_array_type.js +1 -5
- package/lib/factories/internal/metadata/emplace_metadata_array_type.js.map +1 -1
- package/lib/factories/internal/metadata/emplace_metadata_object.js +3 -4
- package/lib/factories/internal/metadata/emplace_metadata_object.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata.js +1 -2
- package/lib/factories/internal/metadata/iterate_metadata.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_array.js +1 -2
- package/lib/factories/internal/metadata/iterate_metadata_array.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_atomic.js +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_atomic.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_coalesce.js +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_coalesce.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_constant.js +2 -3
- package/lib/factories/internal/metadata/iterate_metadata_constant.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_intersection.js +2 -3
- package/lib/factories/internal/metadata/iterate_metadata_intersection.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_map.js +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_map.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_native.js +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_native.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_object.js +2 -3
- package/lib/factories/internal/metadata/iterate_metadata_object.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_set.js +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_set.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_template.js +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_template.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_union.js +1 -2
- package/lib/factories/internal/metadata/iterate_metadata_union.js.map +1 -1
- package/lib/programmers/internal/application_bigint.d.ts +1 -0
- package/lib/programmers/internal/application_bigint.js +14 -0
- package/lib/programmers/internal/application_bigint.js.map +1 -0
- package/lib/programmers/internal/application_v30_schema.js +10 -12
- package/lib/programmers/internal/application_v30_schema.js.map +1 -1
- package/lib/programmers/internal/application_v31_constant.js +3 -1
- package/lib/programmers/internal/application_v31_constant.js.map +1 -1
- package/lib/programmers/internal/application_v31_schema.js +10 -12
- package/lib/programmers/internal/application_v31_schema.js.map +1 -1
- package/lib/tags/Constant.d.ts +2 -2
- package/lib/tags/Default.d.ts +5 -1
- package/lib/tags/ExclusiveMaximum.d.ts +9 -5
- package/lib/tags/ExclusiveMinimum.d.ts +9 -5
- package/lib/tags/JsonSchemaPlugin.d.ts +1 -1
- package/lib/tags/Maximum.d.ts +8 -5
- package/lib/tags/Minimum.d.ts +8 -5
- package/lib/tags/MultipleOf.d.ts +7 -4
- package/lib/transformers/features/CreateRandomTransformer.js +1 -2
- package/lib/transformers/features/CreateRandomTransformer.js.map +1 -1
- package/lib/transformers/features/RandomTransformer.js +1 -2
- package/lib/transformers/features/RandomTransformer.js.map +1 -1
- package/lib/transformers/features/json/JsonApplicationTransformer.js +4 -5
- package/lib/transformers/features/json/JsonApplicationTransformer.js.map +1 -1
- package/lib/transformers/features/misc/MiscLiteralsTransformer.js +1 -2
- package/lib/transformers/features/misc/MiscLiteralsTransformer.js.map +1 -1
- package/lib/transformers/features/protobuf/ProtobufMessageTransformer.js +1 -2
- package/lib/transformers/features/protobuf/ProtobufMessageTransformer.js.map +1 -1
- package/lib/transformers/features/reflect/ReflectMetadataTransformer.js +1 -2
- package/lib/transformers/features/reflect/ReflectMetadataTransformer.js.map +1 -1
- package/lib/transformers/internal/GenericTransformer.js +2 -3
- package/lib/transformers/internal/GenericTransformer.js.map +1 -1
- package/package.json +2 -2
- package/src/factories/CommentFactory.ts +79 -79
- package/src/factories/MetadataCollection.ts +274 -274
- package/src/factories/MetadataFactory.ts +272 -272
- package/src/factories/TypeFactory.ts +118 -190
- package/src/factories/internal/metadata/emplace_metadata_array_type.ts +42 -42
- package/src/factories/internal/metadata/emplace_metadata_object.ts +176 -179
- package/src/factories/internal/metadata/iterate_metadata.ts +94 -96
- package/src/factories/internal/metadata/iterate_metadata_array.ts +63 -64
- package/src/factories/internal/metadata/iterate_metadata_atomic.ts +62 -62
- package/src/factories/internal/metadata/iterate_metadata_coalesce.ts +33 -33
- package/src/factories/internal/metadata/iterate_metadata_constant.ts +76 -77
- package/src/factories/internal/metadata/iterate_metadata_intersection.ts +213 -214
- package/src/factories/internal/metadata/iterate_metadata_map.ts +50 -50
- package/src/factories/internal/metadata/iterate_metadata_native.ts +220 -217
- package/src/factories/internal/metadata/iterate_metadata_object.ts +33 -34
- package/src/factories/internal/metadata/iterate_metadata_set.ts +41 -41
- package/src/factories/internal/metadata/iterate_metadata_template.ts +44 -44
- package/src/factories/internal/metadata/iterate_metadata_union.ts +27 -29
- package/src/programmers/internal/application_bigint.ts +25 -0
- package/src/programmers/internal/application_v30_alias.ts +52 -52
- package/src/programmers/internal/application_v30_object.ts +149 -149
- package/src/programmers/internal/application_v30_schema.ts +162 -159
- package/src/programmers/internal/application_v30_tuple.ts +33 -33
- package/src/programmers/internal/application_v31_constant.ts +4 -1
- package/src/programmers/internal/application_v31_schema.ts +159 -157
- package/src/programmers/json/JsonApplicationProgrammer.ts +82 -82
- package/src/tags/Constant.ts +2 -2
- package/src/tags/Default.ts +7 -3
- package/src/tags/ExclusiveMaximum.ts +12 -6
- package/src/tags/ExclusiveMinimum.ts +12 -6
- package/src/tags/JsonSchemaPlugin.ts +1 -1
- package/src/tags/Maximum.ts +9 -8
- package/src/tags/Minimum.ts +9 -8
- package/src/tags/MultipleOf.ts +9 -8
- package/src/transformers/FileTransformer.ts +91 -91
- package/src/transformers/features/CreateRandomTransformer.ts +40 -42
- package/src/transformers/features/RandomTransformer.ts +44 -46
- package/src/transformers/features/json/JsonApplicationTransformer.ts +124 -126
- package/src/transformers/features/misc/MiscLiteralsTransformer.ts +32 -34
- package/src/transformers/features/protobuf/ProtobufMessageTransformer.ts +33 -35
- package/src/transformers/features/reflect/ReflectMetadataTransformer.ts +62 -64
- package/src/transformers/internal/GenericTransformer.ts +2 -4
- package/lib/utils/TypePredicator.d.ts +0 -10
- package/lib/utils/TypePredicator.js +0 -36
- package/lib/utils/TypePredicator.js.map +0 -1
- package/src/utils/TypePredicator.ts +0 -32
|
@@ -1,34 +1,32 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { MiscLiteralsProgrammer } from "../../../programmers/misc/MiscLiteralsProgrammer";
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
34
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { MiscLiteralsProgrammer } from "../../../programmers/misc/MiscLiteralsProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
import { TransformerError } from "../../TransformerError";
|
|
7
|
+
|
|
8
|
+
export namespace MiscLiteralsTransformer {
|
|
9
|
+
export const transform =
|
|
10
|
+
(project: IProject) =>
|
|
11
|
+
(expression: ts.CallExpression): ts.Expression => {
|
|
12
|
+
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
13
|
+
if (!expression.typeArguments?.[0])
|
|
14
|
+
throw new TransformerError({
|
|
15
|
+
code: "typia.misc.literals",
|
|
16
|
+
message: "generic argument is not specified.",
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// GET TYPE INFO
|
|
20
|
+
const node: ts.TypeNode = expression.typeArguments[0];
|
|
21
|
+
const type: ts.Type = project.checker.getTypeFromTypeNode(node);
|
|
22
|
+
|
|
23
|
+
if (type.isTypeParameter())
|
|
24
|
+
throw new TransformerError({
|
|
25
|
+
code: "typia.misc.literals",
|
|
26
|
+
message: "non-specified generic argument.",
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// DO TRANSFORM
|
|
30
|
+
return MiscLiteralsProgrammer.write(project)(type);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -1,35 +1,33 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { ProtobufMessageProgrammer } from "../../../programmers/protobuf/ProtobufMessageProgrammer";
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { ProtobufMessageProgrammer } from "../../../programmers/protobuf/ProtobufMessageProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
import { TransformerError } from "../../TransformerError";
|
|
7
|
+
|
|
8
|
+
export namespace ProtobufMessageTransformer {
|
|
9
|
+
export const transform =
|
|
10
|
+
(project: IProject) =>
|
|
11
|
+
(_modulo: ts.LeftHandSideExpression) =>
|
|
12
|
+
(expression: ts.CallExpression): ts.Expression => {
|
|
13
|
+
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
14
|
+
if (!expression.typeArguments || !expression.typeArguments[0])
|
|
15
|
+
throw new TransformerError({
|
|
16
|
+
code: "typia.protobuf.message",
|
|
17
|
+
message: "generic argument is not specified.",
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// GET TYPE INFO
|
|
21
|
+
const type: ts.Type = project.checker.getTypeFromTypeNode(
|
|
22
|
+
expression.typeArguments[0],
|
|
23
|
+
);
|
|
24
|
+
if (type.isTypeParameter())
|
|
25
|
+
throw new TransformerError({
|
|
26
|
+
code: "tyipa.protobuf.message",
|
|
27
|
+
message: "non-specified generic argument.",
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// DO TRANSFORM
|
|
31
|
+
return ProtobufMessageProgrammer.write(project)(type);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -1,64 +1,62 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { LiteralFactory } from "../../../factories/LiteralFactory";
|
|
4
|
-
import { MetadataCollection } from "../../../factories/MetadataCollection";
|
|
5
|
-
import { MetadataFactory } from "../../../factories/MetadataFactory";
|
|
6
|
-
|
|
7
|
-
import { IMetadataApplication } from "../../../schemas/metadata/IMetadataApplication";
|
|
8
|
-
import { Metadata } from "../../../schemas/metadata/Metadata";
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
};
|
|
64
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { LiteralFactory } from "../../../factories/LiteralFactory";
|
|
4
|
+
import { MetadataCollection } from "../../../factories/MetadataCollection";
|
|
5
|
+
import { MetadataFactory } from "../../../factories/MetadataFactory";
|
|
6
|
+
|
|
7
|
+
import { IMetadataApplication } from "../../../schemas/metadata/IMetadataApplication";
|
|
8
|
+
import { Metadata } from "../../../schemas/metadata/Metadata";
|
|
9
|
+
|
|
10
|
+
import { IProject } from "../../IProject";
|
|
11
|
+
import { TransformerError } from "../../TransformerError";
|
|
12
|
+
|
|
13
|
+
export namespace ReflectMetadataTransformer {
|
|
14
|
+
export const transform =
|
|
15
|
+
(project: IProject) =>
|
|
16
|
+
(expression: ts.CallExpression): ts.Expression => {
|
|
17
|
+
if (!expression.typeArguments?.length)
|
|
18
|
+
throw new TransformerError({
|
|
19
|
+
code: "typia.reflect.metadata",
|
|
20
|
+
message: "no generic argument.",
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// VALIDATE TUPLE ARGUMENTS
|
|
24
|
+
const top: ts.Node = expression.typeArguments[0]!;
|
|
25
|
+
if (!ts.isTupleTypeNode(top)) return expression;
|
|
26
|
+
else if (top.elements.some((child) => !ts.isTypeNode(child)))
|
|
27
|
+
return expression;
|
|
28
|
+
|
|
29
|
+
// GET TYPES
|
|
30
|
+
const types: ts.Type[] = top.elements.map((child) =>
|
|
31
|
+
project.checker.getTypeFromTypeNode(child as ts.TypeNode),
|
|
32
|
+
);
|
|
33
|
+
if (types.some((t) => t.isTypeParameter()))
|
|
34
|
+
throw new TransformerError({
|
|
35
|
+
code: "typia.reflect.metadata",
|
|
36
|
+
message: "non-specified generic argument(s).",
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// METADATA
|
|
40
|
+
const collection: MetadataCollection = new MetadataCollection();
|
|
41
|
+
const metadatas: Array<Metadata> = types.map((type) => {
|
|
42
|
+
const result = MetadataFactory.analyze(
|
|
43
|
+
project.checker,
|
|
44
|
+
project.context,
|
|
45
|
+
)({
|
|
46
|
+
escape: true,
|
|
47
|
+
constant: true,
|
|
48
|
+
absorb: true,
|
|
49
|
+
})(collection)(type);
|
|
50
|
+
if (result.success === false)
|
|
51
|
+
throw TransformerError.from("typia.reflect.metadata")(result.errors);
|
|
52
|
+
return result.data;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// CONVERT TO PRIMITIVE TYPE
|
|
56
|
+
const app: IMetadataApplication = {
|
|
57
|
+
metadatas: metadatas.map((metadata) => metadata.toJSON()),
|
|
58
|
+
components: collection.toJSON(),
|
|
59
|
+
};
|
|
60
|
+
return LiteralFactory.generate(app);
|
|
61
|
+
};
|
|
62
|
+
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
|
|
3
|
-
import { TypePredicator } from "../../utils/TypePredicator";
|
|
4
|
-
|
|
5
3
|
import { IProject } from "../IProject";
|
|
6
4
|
import { TransformerError } from "../TransformerError";
|
|
7
5
|
|
|
@@ -38,7 +36,7 @@ export namespace GenericTransformer {
|
|
|
38
36
|
expression.arguments[0]!,
|
|
39
37
|
false,
|
|
40
38
|
];
|
|
41
|
-
if (
|
|
39
|
+
if (type.isTypeParameter())
|
|
42
40
|
throw new TransformerError({
|
|
43
41
|
code: `typia.${method}`,
|
|
44
42
|
message: `non-specified generic argument.`,
|
|
@@ -84,7 +82,7 @@ export namespace GenericTransformer {
|
|
|
84
82
|
const node: ts.TypeNode = expression.typeArguments[0];
|
|
85
83
|
const type: ts.Type = project.checker.getTypeFromTypeNode(node);
|
|
86
84
|
|
|
87
|
-
if (
|
|
85
|
+
if (type.isTypeParameter())
|
|
88
86
|
throw new TransformerError({
|
|
89
87
|
code: `typia.${method}`,
|
|
90
88
|
message: `non-specified generic argument.`,
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
export declare namespace TypePredicator {
|
|
3
|
-
const isLiteral: (type: ts.Type) => type is ts.LiteralType;
|
|
4
|
-
const isTypeParameter: (type: ts.Type) => type is ts.TypeParameter;
|
|
5
|
-
const isIntersection: (type: ts.Type) => type is ts.IntersectionType;
|
|
6
|
-
const isUnion: (type: ts.Type) => type is ts.UnionType;
|
|
7
|
-
const isUnionOrIntersection: (type: ts.Type) => type is ts.UnionOrIntersectionType;
|
|
8
|
-
const isClass: (type: ts.Type) => type is ts.InterfaceType;
|
|
9
|
-
const isInterfaceOrClass: (type: ts.Type) => type is ts.InterfaceType;
|
|
10
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.TypePredicator = void 0;
|
|
7
|
-
var typescript_1 = __importDefault(require("typescript"));
|
|
8
|
-
var TypePredicator;
|
|
9
|
-
(function (TypePredicator) {
|
|
10
|
-
TypePredicator.isLiteral = function (type) {
|
|
11
|
-
return !!(type.flags &
|
|
12
|
-
(typescript_1.default.TypeFlags.EnumLiteral |
|
|
13
|
-
typescript_1.default.TypeFlags.StringLiteral |
|
|
14
|
-
typescript_1.default.TypeFlags.NumberLiteral |
|
|
15
|
-
typescript_1.default.TypeFlags.BigIntLiteral));
|
|
16
|
-
};
|
|
17
|
-
TypePredicator.isTypeParameter = function (type) {
|
|
18
|
-
return !!(type.flags & typescript_1.default.TypeFlags.TypeParameter);
|
|
19
|
-
};
|
|
20
|
-
TypePredicator.isIntersection = function (type) {
|
|
21
|
-
return !!(type.flags & typescript_1.default.TypeFlags.Intersection);
|
|
22
|
-
};
|
|
23
|
-
TypePredicator.isUnion = function (type) {
|
|
24
|
-
return !!(type.flags & typescript_1.default.TypeFlags.Union);
|
|
25
|
-
};
|
|
26
|
-
TypePredicator.isUnionOrIntersection = function (type) {
|
|
27
|
-
return !!(type.flags & typescript_1.default.TypeFlags.UnionOrIntersection);
|
|
28
|
-
};
|
|
29
|
-
TypePredicator.isClass = function (type) {
|
|
30
|
-
return !!(typescript_1.default.getObjectFlags(type) & typescript_1.default.ObjectFlags.Class);
|
|
31
|
-
};
|
|
32
|
-
TypePredicator.isInterfaceOrClass = function (type) {
|
|
33
|
-
return !!(typescript_1.default.getObjectFlags(type) & typescript_1.default.ObjectFlags.ClassOrInterface);
|
|
34
|
-
};
|
|
35
|
-
})(TypePredicator || (exports.TypePredicator = TypePredicator = {}));
|
|
36
|
-
//# sourceMappingURL=TypePredicator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TypePredicator.js","sourceRoot":"","sources":["../../src/utils/TypePredicator.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAE5B,IAAiB,cAAc,CA6B9B;AA7BD,WAAiB,cAAc;IAChB,wBAAS,GAAG,UAAC,IAAa;QACrC,OAAA,CAAC,CAAC,CACA,IAAI,CAAC,KAAK;YACV,CAAC,oBAAE,CAAC,SAAS,CAAC,WAAW;gBACvB,oBAAE,CAAC,SAAS,CAAC,aAAa;gBAC1B,oBAAE,CAAC,SAAS,CAAC,aAAa;gBAC1B,oBAAE,CAAC,SAAS,CAAC,aAAa,CAAC,CAC9B;IAND,CAMC,CAAC;IAES,8BAAe,GAAG,UAAC,IAAa;QAC3C,OAAA,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,oBAAE,CAAC,SAAS,CAAC,aAAa,CAAC;IAA3C,CAA2C,CAAC;IAEjC,6BAAc,GAAG,UAAC,IAAa;QAC1C,OAAA,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,oBAAE,CAAC,SAAS,CAAC,YAAY,CAAC;IAA1C,CAA0C,CAAC;IAEhC,sBAAO,GAAG,UAAC,IAAa;QACnC,OAAA,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,oBAAE,CAAC,SAAS,CAAC,KAAK,CAAC;IAAnC,CAAmC,CAAC;IAEzB,oCAAqB,GAAG,UACnC,IAAa;QAEb,OAAA,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,oBAAE,CAAC,SAAS,CAAC,mBAAmB,CAAC;IAAjD,CAAiD,CAAC;IAEvC,sBAAO,GAAG,UAAC,IAAa;QACnC,OAAA,CAAC,CAAC,CAAC,oBAAE,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,oBAAE,CAAC,WAAW,CAAC,KAAK,CAAC;IAAlD,CAAkD,CAAC;IAExC,iCAAkB,GAAG,UAAC,IAAa;QAC9C,OAAA,CAAC,CAAC,CAAC,oBAAE,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,oBAAE,CAAC,WAAW,CAAC,gBAAgB,CAAC;IAA7D,CAA6D,CAAC;AAClE,CAAC,EA7BgB,cAAc,8BAAd,cAAc,QA6B9B"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
export namespace TypePredicator {
|
|
4
|
-
export const isLiteral = (type: ts.Type): type is ts.LiteralType =>
|
|
5
|
-
!!(
|
|
6
|
-
type.flags &
|
|
7
|
-
(ts.TypeFlags.EnumLiteral |
|
|
8
|
-
ts.TypeFlags.StringLiteral |
|
|
9
|
-
ts.TypeFlags.NumberLiteral |
|
|
10
|
-
ts.TypeFlags.BigIntLiteral)
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
export const isTypeParameter = (type: ts.Type): type is ts.TypeParameter =>
|
|
14
|
-
!!(type.flags & ts.TypeFlags.TypeParameter);
|
|
15
|
-
|
|
16
|
-
export const isIntersection = (type: ts.Type): type is ts.IntersectionType =>
|
|
17
|
-
!!(type.flags & ts.TypeFlags.Intersection);
|
|
18
|
-
|
|
19
|
-
export const isUnion = (type: ts.Type): type is ts.UnionType =>
|
|
20
|
-
!!(type.flags & ts.TypeFlags.Union);
|
|
21
|
-
|
|
22
|
-
export const isUnionOrIntersection = (
|
|
23
|
-
type: ts.Type,
|
|
24
|
-
): type is ts.UnionOrIntersectionType =>
|
|
25
|
-
!!(type.flags & ts.TypeFlags.UnionOrIntersection);
|
|
26
|
-
|
|
27
|
-
export const isClass = (type: ts.Type): type is ts.InterfaceType =>
|
|
28
|
-
!!(ts.getObjectFlags(type) & ts.ObjectFlags.Class);
|
|
29
|
-
|
|
30
|
-
export const isInterfaceOrClass = (type: ts.Type): type is ts.InterfaceType =>
|
|
31
|
-
!!(ts.getObjectFlags(type) & ts.ObjectFlags.ClassOrInterface);
|
|
32
|
-
}
|