@flowgram-vue/variable-core 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/LICENSE +22 -0
  2. package/dist/index.cjs +2630 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.ts +2293 -0
  5. package/dist/index.js +2592 -0
  6. package/dist/index.js.map +1 -0
  7. package/package.json +68 -0
  8. package/src/ast/ast-node.ts +374 -0
  9. package/src/ast/ast-registers.ts +129 -0
  10. package/src/ast/common/data-node.ts +63 -0
  11. package/src/ast/common/index.ts +8 -0
  12. package/src/ast/common/list-node.ts +70 -0
  13. package/src/ast/common/map-node.ts +89 -0
  14. package/src/ast/declaration/base-variable-field.ts +184 -0
  15. package/src/ast/declaration/index.ts +13 -0
  16. package/src/ast/declaration/property.ts +19 -0
  17. package/src/ast/declaration/variable-declaration-list.ts +112 -0
  18. package/src/ast/declaration/variable-declaration.ts +78 -0
  19. package/src/ast/expression/base-expression.ts +117 -0
  20. package/src/ast/expression/enumerate-expression.ts +77 -0
  21. package/src/ast/expression/index.ts +10 -0
  22. package/src/ast/expression/keypath-expression.ts +157 -0
  23. package/src/ast/expression/legacy-keypath-expression.ts +119 -0
  24. package/src/ast/expression/wrap-array-expression.ts +96 -0
  25. package/src/ast/factory.ts +163 -0
  26. package/src/ast/flags.ts +50 -0
  27. package/src/ast/index.ts +26 -0
  28. package/src/ast/match.ts +146 -0
  29. package/src/ast/type/array.ts +109 -0
  30. package/src/ast/type/base-type.ts +49 -0
  31. package/src/ast/type/boolean.ts +26 -0
  32. package/src/ast/type/custom-type.ts +70 -0
  33. package/src/ast/type/index.ts +19 -0
  34. package/src/ast/type/integer.ts +29 -0
  35. package/src/ast/type/map.ts +96 -0
  36. package/src/ast/type/number.ts +26 -0
  37. package/src/ast/type/object.ts +185 -0
  38. package/src/ast/type/string.ts +55 -0
  39. package/src/ast/type/union.ts +13 -0
  40. package/src/ast/types.ts +188 -0
  41. package/src/ast/utils/expression.ts +61 -0
  42. package/src/ast/utils/helpers.ts +73 -0
  43. package/src/ast/utils/inversify.ts +42 -0
  44. package/src/ast/utils/observable.ts +5 -0
  45. package/src/ast/utils/variable-field.ts +25 -0
  46. package/src/composables/index.ts +9 -0
  47. package/src/composables/scope-provider.ts +78 -0
  48. package/src/composables/use-available-variables.ts +39 -0
  49. package/src/composables/use-output-variables.ts +36 -0
  50. package/src/composables/use-scope-available.ts +32 -0
  51. package/src/index.ts +14 -0
  52. package/src/providers.ts +22 -0
  53. package/src/scope/datas/index.ts +8 -0
  54. package/src/scope/datas/scope-available-data.ts +234 -0
  55. package/src/scope/datas/scope-event-data.ts +67 -0
  56. package/src/scope/datas/scope-output-data.ts +151 -0
  57. package/src/scope/index.ts +9 -0
  58. package/src/scope/scope-chain.ts +69 -0
  59. package/src/scope/scope.ts +200 -0
  60. package/src/scope/types.ts +102 -0
  61. package/src/scope/variable-table.ts +203 -0
  62. package/src/services/index.ts +6 -0
  63. package/src/services/variable-field-key-rename-service.ts +131 -0
  64. package/src/utils/memo.ts +38 -0
  65. package/src/utils/toDisposable.ts +16 -0
  66. package/src/variable-container-module.ts +28 -0
  67. package/src/variable-engine.ts +197 -0
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { ASTKind } from './types';
7
+ import {
8
+ type StringType,
9
+ type NumberType,
10
+ type BooleanType,
11
+ type IntegerType,
12
+ type ObjectType,
13
+ type ArrayType,
14
+ type MapType,
15
+ type CustomType,
16
+ } from './type';
17
+ import { ASTNodeFlags } from './flags';
18
+ import {
19
+ type WrapArrayExpression,
20
+ type EnumerateExpression,
21
+ type KeyPathExpression,
22
+ } from './expression';
23
+ import {
24
+ type BaseVariableField,
25
+ type Property,
26
+ type VariableDeclaration,
27
+ type VariableDeclarationList,
28
+ } from './declaration';
29
+ import { type ASTNode } from './ast-node';
30
+
31
+ /**
32
+ * Variable-core ASTNode matchers.
33
+ *
34
+ * - Typescript code inside if statement will be type guarded.
35
+ */
36
+ export namespace ASTMatch {
37
+ /**
38
+ * # Type-related matchers.
39
+ */
40
+
41
+ /**
42
+ * Check if the node is a `StringType`.
43
+ */
44
+ export const isString = (node?: ASTNode): node is StringType => node?.kind === ASTKind.String;
45
+
46
+ /**
47
+ * Check if the node is a `NumberType`.
48
+ */
49
+ export const isNumber = (node?: ASTNode): node is NumberType => node?.kind === ASTKind.Number;
50
+
51
+ /**
52
+ * Check if the node is a `BooleanType`.
53
+ */
54
+ export const isBoolean = (node?: ASTNode): node is BooleanType => node?.kind === ASTKind.Boolean;
55
+
56
+ /**
57
+ * Check if the node is a `IntegerType`.
58
+ */
59
+ export const isInteger = (node?: ASTNode): node is IntegerType => node?.kind === ASTKind.Integer;
60
+
61
+ /**
62
+ * Check if the node is a `ObjectType`.
63
+ */
64
+ export const isObject = (node?: ASTNode): node is ObjectType => node?.kind === ASTKind.Object;
65
+
66
+ /**
67
+ * Check if the node is a `ArrayType`.
68
+ */
69
+ export const isArray = (node?: ASTNode): node is ArrayType => node?.kind === ASTKind.Array;
70
+
71
+ /**
72
+ * Check if the node is a `MapType`.
73
+ */
74
+ export const isMap = (node?: ASTNode): node is MapType => node?.kind === ASTKind.Map;
75
+
76
+ /**
77
+ * Check if the node is a `CustomType`.
78
+ */
79
+ export const isCustomType = (node?: ASTNode): node is CustomType =>
80
+ node?.kind === ASTKind.CustomType;
81
+
82
+ /**
83
+ * # Declaration-related matchers.
84
+ */
85
+
86
+ /**
87
+ * Check if the node is a `VariableDeclaration`.
88
+ */
89
+ export const isVariableDeclaration = <VariableMeta = any>(
90
+ node?: ASTNode
91
+ ): node is VariableDeclaration<VariableMeta> => node?.kind === ASTKind.VariableDeclaration;
92
+
93
+ /**
94
+ * Check if the node is a `Property`.
95
+ */
96
+ export const isProperty = <VariableMeta = any>(node?: ASTNode): node is Property<VariableMeta> =>
97
+ node?.kind === ASTKind.Property;
98
+
99
+ /**
100
+ * Check if the node is a `BaseVariableField`.
101
+ */
102
+ export const isBaseVariableField = (node?: ASTNode): node is BaseVariableField =>
103
+ !!(node?.flags || 0 & ASTNodeFlags.VariableField);
104
+
105
+ /**
106
+ * Check if the node is a `VariableDeclarationList`.
107
+ */
108
+ export const isVariableDeclarationList = (node?: ASTNode): node is VariableDeclarationList =>
109
+ node?.kind === ASTKind.VariableDeclarationList;
110
+
111
+ /**
112
+ * # Expression-related matchers.
113
+ */
114
+
115
+ /**
116
+ * Check if the node is a `EnumerateExpression`.
117
+ */
118
+ export const isEnumerateExpression = (node?: ASTNode): node is EnumerateExpression =>
119
+ node?.kind === ASTKind.EnumerateExpression;
120
+
121
+ /**
122
+ * Check if the node is a `WrapArrayExpression`.
123
+ */
124
+ export const isWrapArrayExpression = (node?: ASTNode): node is WrapArrayExpression =>
125
+ node?.kind === ASTKind.WrapArrayExpression;
126
+
127
+ /**
128
+ * Check if the node is a `KeyPathExpression`.
129
+ */
130
+ export const isKeyPathExpression = (node?: ASTNode): node is KeyPathExpression =>
131
+ node?.kind === ASTKind.KeyPathExpression;
132
+
133
+ /**
134
+ * Check ASTNode Match by ASTClass
135
+ *
136
+ * @param node ASTNode to be checked.
137
+ * @param targetType Target ASTNode class.
138
+ * @returns Whether the node is of the target type.
139
+ */
140
+ export function is<TargetASTNode extends ASTNode>(
141
+ node?: ASTNode,
142
+ targetType?: { kind: string; new (...args: any[]): TargetASTNode }
143
+ ): node is TargetASTNode {
144
+ return node?.kind === targetType?.kind;
145
+ }
146
+ }
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { parseTypeJsonOrKind } from '../utils/helpers';
7
+ import { ASTKind, ASTNodeJSON, ASTNodeJSONOrKind } from '../types';
8
+ import { ASTNodeFlags } from '../flags';
9
+ import { type BaseVariableField } from '../declaration';
10
+ import { BaseType } from './base-type';
11
+
12
+ /**
13
+ * ASTNodeJSON representation of `ArrayType`
14
+ */
15
+ export interface ArrayJSON {
16
+ /**
17
+ * The type of the items in the array.
18
+ */
19
+ items?: ASTNodeJSONOrKind;
20
+ }
21
+
22
+ /**
23
+ * Represents an array type.
24
+ */
25
+ export class ArrayType extends BaseType<ArrayJSON> {
26
+ public flags: ASTNodeFlags = ASTNodeFlags.DrilldownType | ASTNodeFlags.EnumerateType;
27
+
28
+ static kind: string = ASTKind.Array;
29
+
30
+ /**
31
+ * The type of the items in the array.
32
+ */
33
+ items: BaseType;
34
+
35
+ /**
36
+ * Deserializes the `ArrayJSON` to the `ArrayType`.
37
+ * @param json The `ArrayJSON` to deserialize.
38
+ */
39
+ fromJSON({ items }: ArrayJSON): void {
40
+ this.updateChildNodeByKey('items', parseTypeJsonOrKind(items));
41
+ }
42
+
43
+ /**
44
+ * Whether the items type can be drilled down.
45
+ */
46
+ get canDrilldownItems(): boolean {
47
+ return !!(this.items?.flags & ASTNodeFlags.DrilldownType);
48
+ }
49
+
50
+ /**
51
+ * Get a variable field by key path.
52
+ * @param keyPath The key path to search for.
53
+ * @returns The variable field if found, otherwise `undefined`.
54
+ */
55
+ getByKeyPath(keyPath: string[]): BaseVariableField | undefined {
56
+ const [curr, ...rest] = keyPath || [];
57
+
58
+ if (curr === '0' && this.canDrilldownItems) {
59
+ // The first item of the array.
60
+ return this.items.getByKeyPath(rest);
61
+ }
62
+
63
+ return undefined;
64
+ }
65
+
66
+ /**
67
+ * Check if the current type is equal to the target type.
68
+ * @param targetTypeJSONOrKind The type to compare with.
69
+ * @returns `true` if the types are equal, `false` otherwise.
70
+ */
71
+ public isTypeEqual(targetTypeJSONOrKind?: ASTNodeJSONOrKind): boolean {
72
+ const targetTypeJSON = parseTypeJsonOrKind(targetTypeJSONOrKind);
73
+ const isSuperEqual = super.isTypeEqual(targetTypeJSONOrKind);
74
+
75
+ if (targetTypeJSON?.weak || targetTypeJSON?.kind === ASTKind.Union) {
76
+ return isSuperEqual;
77
+ }
78
+
79
+ return (
80
+ targetTypeJSON &&
81
+ isSuperEqual &&
82
+ // Weak comparison, only need to compare the Kind.
83
+ (targetTypeJSON?.weak || this.customStrongEqual(targetTypeJSON))
84
+ );
85
+ }
86
+
87
+ /**
88
+ * Array strong comparison.
89
+ * @param targetTypeJSON The type to compare with.
90
+ * @returns `true` if the types are equal, `false` otherwise.
91
+ */
92
+ protected customStrongEqual(targetTypeJSON: ASTNodeJSON): boolean {
93
+ if (!this.items) {
94
+ return !(targetTypeJSON as ArrayJSON)?.items;
95
+ }
96
+ return this.items?.isTypeEqual((targetTypeJSON as ArrayJSON).items);
97
+ }
98
+
99
+ /**
100
+ * Serialize the `ArrayType` to `ArrayJSON`
101
+ * @returns The JSON representation of `ArrayType`.
102
+ */
103
+ toJSON() {
104
+ return {
105
+ kind: ASTKind.Array,
106
+ items: this.items?.toJSON(),
107
+ };
108
+ }
109
+ }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { parseTypeJsonOrKind } from '../utils/helpers';
7
+ import { ASTKind, ASTNodeJSON, ASTNodeJSONOrKind } from '../types';
8
+ import { ASTNodeFlags } from '../flags';
9
+ import { BaseVariableField } from '../declaration';
10
+ import { ASTNode } from '../ast-node';
11
+ import { UnionJSON } from './union';
12
+
13
+ /**
14
+ * Base class for all types.
15
+ *
16
+ * All other types should extend this class.
17
+ */
18
+ export abstract class BaseType<JSON extends ASTNodeJSON = any> extends ASTNode<JSON> {
19
+ public flags: number = ASTNodeFlags.BasicType;
20
+
21
+ /**
22
+ * Check if the current type is equal to the target type.
23
+ * @param targetTypeJSONOrKind The type to compare with.
24
+ * @returns `true` if the types are equal, `false` otherwise.
25
+ */
26
+ public isTypeEqual(targetTypeJSONOrKind?: ASTNodeJSONOrKind): boolean {
27
+ const targetTypeJSON = parseTypeJsonOrKind(targetTypeJSONOrKind);
28
+
29
+ // If it is a Union type, it is sufficient for one of the subtypes to be equal.
30
+ if (targetTypeJSON?.kind === ASTKind.Union) {
31
+ return ((targetTypeJSON as UnionJSON)?.types || [])?.some((_subType) =>
32
+ this.isTypeEqual(_subType)
33
+ );
34
+ }
35
+
36
+ return this.kind === targetTypeJSON?.kind;
37
+ }
38
+
39
+ /**
40
+ * Get a variable field by key path.
41
+ *
42
+ * This method should be implemented by drillable types.
43
+ * @param keyPath The key path to search for.
44
+ * @returns The variable field if found, otherwise `undefined`.
45
+ */
46
+ getByKeyPath(keyPath: string[] = []): BaseVariableField | undefined {
47
+ throw new Error(`Get By Key Path is not implemented for Type: ${this.kind}`);
48
+ }
49
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { ASTKind } from '../types';
7
+ import { BaseType } from './base-type';
8
+
9
+ /**
10
+ * Represents a boolean type.
11
+ */
12
+ export class BooleanType extends BaseType {
13
+ static kind: string = ASTKind.Boolean;
14
+
15
+ /**
16
+ * Deserializes the `BooleanJSON` to the `BooleanType`.
17
+ * @param json The `BooleanJSON` to deserialize.
18
+ */
19
+ fromJSON(): void {
20
+ // noop
21
+ }
22
+
23
+ toJSON() {
24
+ return {};
25
+ }
26
+ }
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { parseTypeJsonOrKind } from '../utils/helpers';
7
+ import { ASTKind, ASTNodeJSONOrKind } from '../types';
8
+ import { type UnionJSON } from './union';
9
+ import { BaseType } from './base-type';
10
+
11
+ /**
12
+ * ASTNodeJSON representation of `CustomType`
13
+ */
14
+ export interface CustomTypeJSON {
15
+ /**
16
+ * The name of the custom type.
17
+ */
18
+ typeName: string;
19
+ }
20
+
21
+ /**
22
+ * Represents a custom type.
23
+ */
24
+ export class CustomType extends BaseType<CustomTypeJSON> {
25
+ static kind: string = ASTKind.CustomType;
26
+
27
+ protected _typeName: string;
28
+
29
+ /**
30
+ * The name of the custom type.
31
+ */
32
+ get typeName(): string {
33
+ return this._typeName;
34
+ }
35
+
36
+ /**
37
+ * Deserializes the `CustomTypeJSON` to the `CustomType`.
38
+ * @param json The `CustomTypeJSON` to deserialize.
39
+ */
40
+ fromJSON(json: CustomTypeJSON): void {
41
+ if (this._typeName !== json.typeName) {
42
+ this._typeName = json.typeName;
43
+ this.fireChange();
44
+ }
45
+ }
46
+
47
+ /**
48
+ * Check if the current type is equal to the target type.
49
+ * @param targetTypeJSONOrKind The type to compare with.
50
+ * @returns `true` if the types are equal, `false` otherwise.
51
+ */
52
+ public isTypeEqual(targetTypeJSONOrKind?: ASTNodeJSONOrKind): boolean {
53
+ const targetTypeJSON = parseTypeJsonOrKind(targetTypeJSONOrKind);
54
+
55
+ // If it is a Union type, it is sufficient for one of the subtypes to be equal.
56
+ if (targetTypeJSON?.kind === ASTKind.Union) {
57
+ return ((targetTypeJSON as UnionJSON)?.types || [])?.some((_subType) =>
58
+ this.isTypeEqual(_subType)
59
+ );
60
+ }
61
+
62
+ return targetTypeJSON?.kind === this.kind && targetTypeJSON?.typeName === this.typeName;
63
+ }
64
+
65
+ toJSON() {
66
+ return {
67
+ typeName: this.typeName,
68
+ };
69
+ }
70
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ export { StringType } from './string';
7
+ export { IntegerType } from './integer';
8
+ export { BooleanType } from './boolean';
9
+ export { NumberType } from './number';
10
+ export { ArrayType } from './array';
11
+ export { MapType } from './map';
12
+ export {
13
+ type ObjectJSON as ObjectJSON,
14
+ ObjectType,
15
+ type ObjectPropertiesChangeAction,
16
+ } from './object';
17
+ export { BaseType } from './base-type';
18
+ export { type UnionJSON } from './union';
19
+ export { CustomType, type CustomTypeJSON } from './custom-type';
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { ASTKind } from '../types';
7
+ import { ASTNodeFlags } from '../flags';
8
+ import { BaseType } from './base-type';
9
+
10
+ /**
11
+ * Represents an integer type.
12
+ */
13
+ export class IntegerType extends BaseType {
14
+ public flags: ASTNodeFlags = ASTNodeFlags.BasicType;
15
+
16
+ static kind: string = ASTKind.Integer;
17
+
18
+ /**
19
+ * Deserializes the `IntegerJSON` to the `IntegerType`.
20
+ * @param json The `IntegerJSON` to deserialize.
21
+ */
22
+ fromJSON(): void {
23
+ // noop
24
+ }
25
+
26
+ toJSON() {
27
+ return {};
28
+ }
29
+ }
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { parseTypeJsonOrKind } from '../utils/helpers';
7
+ import { ASTKind, ASTNodeJSON, ASTNodeJSONOrKind } from '../types';
8
+ import { BaseType } from './base-type';
9
+
10
+ /**
11
+ * ASTNodeJSON representation of `MapType`
12
+ */
13
+ export interface MapJSON {
14
+ /**
15
+ * The type of the keys in the map.
16
+ */
17
+ keyType?: ASTNodeJSONOrKind;
18
+ /**
19
+ * The type of the values in the map.
20
+ */
21
+ valueType?: ASTNodeJSONOrKind;
22
+ }
23
+
24
+ /**
25
+ * Represents a map type.
26
+ */
27
+ export class MapType extends BaseType<MapJSON> {
28
+ static kind: string = ASTKind.Map;
29
+
30
+ /**
31
+ * The type of the keys in the map.
32
+ */
33
+ keyType: BaseType;
34
+
35
+ /**
36
+ * The type of the values in the map.
37
+ */
38
+ valueType: BaseType;
39
+
40
+ /**
41
+ * Deserializes the `MapJSON` to the `MapType`.
42
+ * @param json The `MapJSON` to deserialize.
43
+ */
44
+ fromJSON({ keyType = ASTKind.String, valueType }: MapJSON): void {
45
+ // Key defaults to String.
46
+ this.updateChildNodeByKey('keyType', parseTypeJsonOrKind(keyType));
47
+ this.updateChildNodeByKey('valueType', parseTypeJsonOrKind(valueType));
48
+ }
49
+
50
+ /**
51
+ * Check if the current type is equal to the target type.
52
+ * @param targetTypeJSONOrKind The type to compare with.
53
+ * @returns `true` if the types are equal, `false` otherwise.
54
+ */
55
+ public isTypeEqual(targetTypeJSONOrKind?: ASTNodeJSONOrKind): boolean {
56
+ const targetTypeJSON = parseTypeJsonOrKind(targetTypeJSONOrKind);
57
+ const isSuperEqual = super.isTypeEqual(targetTypeJSONOrKind);
58
+
59
+ if (targetTypeJSON?.weak || targetTypeJSON?.kind === ASTKind.Union) {
60
+ return isSuperEqual;
61
+ }
62
+
63
+ return (
64
+ targetTypeJSON &&
65
+ isSuperEqual &&
66
+ // Weak comparison, only need to compare the Kind.
67
+ (targetTypeJSON?.weak || this.customStrongEqual(targetTypeJSON))
68
+ );
69
+ }
70
+
71
+ /**
72
+ * Map strong comparison.
73
+ * @param targetTypeJSON The type to compare with.
74
+ * @returns `true` if the types are equal, `false` otherwise.
75
+ */
76
+ protected customStrongEqual(targetTypeJSON: ASTNodeJSON): boolean {
77
+ const { keyType = ASTKind.String, valueType } = targetTypeJSON as MapJSON;
78
+
79
+ const isValueTypeEqual =
80
+ (!valueType && !this.valueType) || this.valueType?.isTypeEqual(valueType);
81
+
82
+ return isValueTypeEqual && this.keyType?.isTypeEqual(keyType);
83
+ }
84
+
85
+ /**
86
+ * Serialize the node to a JSON object.
87
+ * @returns The JSON representation of the node.
88
+ */
89
+ toJSON() {
90
+ return {
91
+ kind: ASTKind.Map,
92
+ keyType: this.keyType?.toJSON(),
93
+ valueType: this.valueType?.toJSON(),
94
+ };
95
+ }
96
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { ASTKind } from '../types';
7
+ import { BaseType } from './base-type';
8
+
9
+ /**
10
+ * Represents a number type.
11
+ */
12
+ export class NumberType extends BaseType {
13
+ static kind: string = ASTKind.Number;
14
+
15
+ /**
16
+ * Deserializes the `NumberJSON` to the `NumberType`.
17
+ * @param json The `NumberJSON` to deserialize.
18
+ */
19
+ fromJSON(): void {
20
+ // noop
21
+ }
22
+
23
+ toJSON() {
24
+ return {};
25
+ }
26
+ }