@lowgular/code-graph 0.1.1 → 0.1.2

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 (44) hide show
  1. package/bin/cli.js +2458 -5
  2. package/lib.js +2430 -0
  3. package/package.json +3 -2
  4. package/code-graph-v2/code.graph.js +0 -37
  5. package/code-graph-v2/config-from-query.js +0 -131
  6. package/code-graph-v2/extractors/extractor.js +0 -27
  7. package/code-graph-v2/extractors/index.js +0 -1
  8. package/code-graph-v2/graph-builder/code-graph.builder.js +0 -49
  9. package/code-graph-v2/graph-builder/index.js +0 -1
  10. package/code-graph-v2/graph-builder/node.processor.js +0 -22
  11. package/code-graph-v2/graph-builder/relationship.processor.js +0 -55
  12. package/code-graph-v2/graph-builder/type.processor.js +0 -21
  13. package/code-graph-v2/index.js +0 -4
  14. package/code-graph-v2/tools/build-code-graph.tool.js +0 -19
  15. package/code-graph-v2/utils.js +0 -34
  16. package/codegular/index.js +0 -5
  17. package/codegular/node.js +0 -71
  18. package/codegular/program.js +0 -100
  19. package/codegular/string.js +0 -121
  20. package/codegular/type-checker.js +0 -133
  21. package/codegular/type.js +0 -356
  22. package/codegular/utils.js +0 -335
  23. package/cypher/index.js +0 -1
  24. package/cypher/lib/executor/condition-evaluator.js +0 -135
  25. package/cypher/lib/executor/executor.js +0 -60
  26. package/cypher/lib/executor/graph.js +0 -0
  27. package/cypher/lib/executor/match-engine.js +0 -130
  28. package/cypher/lib/executor/pattern-matcher.js +0 -86
  29. package/cypher/lib/executor/relationship-navigator.js +0 -41
  30. package/cypher/lib/executor/result-formatter.js +0 -149
  31. package/cypher/lib/executor/traverse-engine.js +0 -141
  32. package/cypher/lib/executor/utils.js +0 -14
  33. package/cypher/lib/graph.stub.js +0 -38
  34. package/cypher/lib/index.js +0 -32
  35. package/cypher/lib/lexer.js +0 -376
  36. package/cypher/lib/parser.js +0 -586
  37. package/cypher/lib/validator/query-validator.js +0 -75
  38. package/cypher/lib/validator/supported-features.config.js +0 -83
  39. package/cypher/lib/validator/unsupported-features.config.js +0 -124
  40. package/cypher-cli.js +0 -41
  41. package/infra/code-graph.js +0 -147
  42. package/main.js +0 -0
  43. package/resources-cli.js +0 -75
  44. package/run-cli.js +0 -43
@@ -1,121 +0,0 @@
1
- import * as ts from "typescript";
2
- import { findChildrenByKind } from "./utils.js";
3
- const { SyntaxKind } = ts;
4
- const throwUndefined = (val, message) => {
5
- if (val === void 0) {
6
- throw new Error(message);
7
- }
8
- return val;
9
- };
10
- const getText = (n) => n.getText(n.getSourceFile());
11
- const getTextOrThrow = (n) => throwUndefined(getText(n), `Could not get text`);
12
- const getNameByIdentifier = (n) => {
13
- if (n.kind === SyntaxKind.Identifier) {
14
- return getText(n);
15
- }
16
- const [nameNode] = findChildrenByKind(n, SyntaxKind.Identifier);
17
- return nameNode ? getText(nameNode) : void 0;
18
- };
19
- const getInitializerText = (node) => {
20
- return getText(node.initializer);
21
- };
22
- const getPropertyType = (node) => {
23
- const typeNode = node.type;
24
- if (typeNode) {
25
- return typeNode.getText(node.getSourceFile());
26
- }
27
- return void 0;
28
- };
29
- function getTypeFromInitializer(initializer) {
30
- if (ts.isStringLiteral(initializer)) {
31
- return "string";
32
- }
33
- if (ts.isNumericLiteral(initializer)) {
34
- return "number";
35
- }
36
- if (initializer.kind === ts.SyntaxKind.TrueKeyword || initializer.kind === ts.SyntaxKind.FalseKeyword) {
37
- return "boolean";
38
- }
39
- if (ts.isArrayLiteralExpression(initializer)) {
40
- return "any[]";
41
- }
42
- if (ts.isObjectLiteralExpression(initializer)) {
43
- return "object";
44
- }
45
- if (ts.isIdentifier(initializer)) {
46
- return initializer.text;
47
- }
48
- if (ts.isCallExpression(initializer)) {
49
- return "any";
50
- }
51
- if ("members" in initializer && initializer.members) {
52
- return "object";
53
- }
54
- return "any";
55
- }
56
- const getRange = (n) => {
57
- const s = n.getSourceFile();
58
- return {
59
- start: s.getLineAndCharacterOfPosition(n.getStart()),
60
- end: s.getLineAndCharacterOfPosition(n.getEnd())
61
- };
62
- };
63
- const getFilePath = (n) => {
64
- return n.getSourceFile().fileName;
65
- };
66
- const getStartLine = (n) => {
67
- const s = n.getSourceFile();
68
- return s.getLineAndCharacterOfPosition(n.getStart()).line;
69
- };
70
- const getEndLine = (n) => {
71
- const s = n.getSourceFile();
72
- return s.getLineAndCharacterOfPosition(n.getEnd()).line;
73
- };
74
- const getEndCharacter = (n) => {
75
- const s = n.getSourceFile();
76
- return s.getLineAndCharacterOfPosition(n.getEnd()).character;
77
- };
78
- const getStartCharacter = (n) => {
79
- const s = n.getSourceFile();
80
- return s.getLineAndCharacterOfPosition(n.getStart()).character;
81
- };
82
- function rangeDistance(outer, inner) {
83
- function toFlat(x) {
84
- return x.line * 1e6 + x.character;
85
- }
86
- const startDistance = toFlat(inner.start) - toFlat(outer.start);
87
- const endDistance = toFlat(outer.end) - toFlat(inner.end);
88
- if (startDistance < 0 || endDistance < 0) {
89
- console.log("rangeDistance: ", startDistance, endDistance);
90
- return void 0;
91
- }
92
- return startDistance + endDistance;
93
- }
94
- const getNameAndRange = (n) => {
95
- const [nameNode] = findChildrenByKind(n, SyntaxKind.Identifier);
96
- if (!nameNode) {
97
- return void 0;
98
- }
99
- return {
100
- text: getText(nameNode),
101
- range: getRange(nameNode)
102
- };
103
- };
104
- const getNameOrThrow = (n) => throwUndefined(getNameByIdentifier(n), `Could not get name`);
105
- export {
106
- getEndCharacter,
107
- getEndLine,
108
- getFilePath,
109
- getInitializerText,
110
- getNameAndRange,
111
- getNameByIdentifier,
112
- getNameOrThrow,
113
- getPropertyType,
114
- getRange,
115
- getStartCharacter,
116
- getStartLine,
117
- getText,
118
- getTextOrThrow,
119
- rangeDistance,
120
- throwUndefined
121
- };
@@ -1,133 +0,0 @@
1
- import * as ts from "typescript";
2
- const getDeclarationFromSymbol = (symbol, context) => {
3
- let aliasedSymbol = symbol;
4
- try {
5
- if (symbol.flags & ts.SymbolFlags.Alias) {
6
- aliasedSymbol = context.typeChecker.getAliasedSymbol(symbol) || symbol;
7
- }
8
- } catch (error) {
9
- aliasedSymbol = symbol;
10
- }
11
- const declarations = aliasedSymbol.getDeclarations();
12
- if (declarations && declarations.length > 0) {
13
- return declarations[declarations.length - 1];
14
- }
15
- return aliasedSymbol.valueDeclaration;
16
- };
17
- const getDeclarationFromType = (type, context) => {
18
- if (type.aliasSymbol) {
19
- const aliasDeclarations = type.aliasSymbol.getDeclarations();
20
- if (aliasDeclarations && aliasDeclarations.length > 0) {
21
- return aliasDeclarations[aliasDeclarations.length - 1];
22
- }
23
- if (type.aliasSymbol.valueDeclaration) {
24
- return type.aliasSymbol.valueDeclaration;
25
- }
26
- }
27
- const baseType = type.target || type;
28
- const typeSymbol = baseType.symbol;
29
- if (typeSymbol) {
30
- const declarations = typeSymbol.getDeclarations();
31
- if (declarations && declarations.length > 0) {
32
- return declarations[declarations.length - 1];
33
- }
34
- if (typeSymbol.valueDeclaration) {
35
- return typeSymbol.valueDeclaration;
36
- }
37
- }
38
- return void 0;
39
- };
40
- const getDeclarationFromTypeReference = (node, context) => {
41
- const symbol = context.typeChecker.getSymbolAtLocation(node.typeName);
42
- if (!symbol) {
43
- return void 0;
44
- }
45
- return getDeclarationFromSymbol(symbol, context);
46
- };
47
- const getDeclarationFromValueSymbol = (node, context) => {
48
- const symbol = context.typeChecker.getSymbolAtLocation(node);
49
- if (!symbol) {
50
- return void 0;
51
- }
52
- return getDeclarationFromSymbol(symbol, context);
53
- };
54
- const getDeclarationFromTypeLocation = (node, context) => {
55
- try {
56
- const type = context.typeChecker.getTypeAtLocation(node);
57
- if (!type) {
58
- return void 0;
59
- }
60
- return getDeclarationFromType(type, context);
61
- } catch (error) {
62
- return void 0;
63
- }
64
- };
65
- const getDeclarationsFromSymbol = (symbol, context) => {
66
- let aliasedSymbol = symbol;
67
- try {
68
- if (symbol.flags & ts.SymbolFlags.Alias) {
69
- aliasedSymbol = context.typeChecker.getAliasedSymbol(symbol) || symbol;
70
- }
71
- } catch (error) {
72
- aliasedSymbol = symbol;
73
- }
74
- const declarations = aliasedSymbol.getDeclarations();
75
- if (declarations && declarations.length > 0) {
76
- return declarations;
77
- }
78
- if (aliasedSymbol.valueDeclaration) {
79
- return [aliasedSymbol.valueDeclaration];
80
- }
81
- return [];
82
- };
83
- const getDeclarations = (node, typeChecker) => {
84
- if ("kind" in node) {
85
- const currentNode = node;
86
- if (ts.isTypeReferenceNode(node)) {
87
- const symbol = typeChecker.getSymbolAtLocation(node.typeName);
88
- if (symbol) {
89
- return getDeclarationsFromSymbol(symbol, { typeChecker });
90
- }
91
- return [];
92
- }
93
- try {
94
- const symbol = typeChecker.getSymbolAtLocation(currentNode);
95
- if (symbol) {
96
- return getDeclarationsFromSymbol(symbol, { typeChecker });
97
- }
98
- } catch (error) {
99
- }
100
- try {
101
- const type2 = typeChecker.getTypeAtLocation(currentNode);
102
- if (type2) {
103
- return getDeclarations(type2, typeChecker);
104
- }
105
- } catch (error) {
106
- }
107
- return [];
108
- }
109
- const type = node;
110
- const declarations = [];
111
- if (type.aliasSymbol) {
112
- const aliasDeclarations = type.aliasSymbol.getDeclarations();
113
- if (aliasDeclarations && aliasDeclarations.length > 0) {
114
- declarations.push(...aliasDeclarations);
115
- } else if (type.aliasSymbol.valueDeclaration) {
116
- declarations.push(type.aliasSymbol.valueDeclaration);
117
- }
118
- }
119
- const baseType = type.target || type;
120
- const typeSymbol = baseType.symbol;
121
- if (typeSymbol) {
122
- const typeDecls = getDeclarationsFromSymbol(typeSymbol, { typeChecker });
123
- declarations.push(...typeDecls);
124
- }
125
- return declarations;
126
- };
127
- export {
128
- getDeclarationFromType,
129
- getDeclarationFromTypeLocation,
130
- getDeclarationFromTypeReference,
131
- getDeclarationFromValueSymbol,
132
- getDeclarations
133
- };
package/codegular/type.js DELETED
@@ -1,356 +0,0 @@
1
- import * as ts from "typescript";
2
- import { getDeclarationFromType } from "./type-checker";
3
- var TypeInfoAbstraction = /* @__PURE__ */ ((TypeInfoAbstraction2) => {
4
- TypeInfoAbstraction2["VOID"] = "VoidType";
5
- TypeInfoAbstraction2["NULLISH"] = "NullishType";
6
- TypeInfoAbstraction2["PRIMITIVE"] = "PrimitiveType";
7
- TypeInfoAbstraction2["OBJECT"] = "ObjectType";
8
- TypeInfoAbstraction2["FUNCTION"] = "FunctionType";
9
- TypeInfoAbstraction2["DECLARATION"] = "DeclarationType";
10
- TypeInfoAbstraction2["UNKNOWN"] = "unknown";
11
- return TypeInfoAbstraction2;
12
- })(TypeInfoAbstraction || {});
13
- const resolveFromType = (type, typeChecker) => {
14
- if (type.flags & ts.TypeFlags.Void) {
15
- return {
16
- abstraction: "VoidType" /* VOID */,
17
- declaration: void 0
18
- };
19
- }
20
- if (type.flags & (ts.TypeFlags.Null | ts.TypeFlags.Undefined)) {
21
- return {
22
- abstraction: "NullishType" /* NULLISH */,
23
- declaration: void 0
24
- };
25
- }
26
- if (type.flags & (ts.TypeFlags.String | ts.TypeFlags.Number | ts.TypeFlags.Boolean | ts.TypeFlags.BigInt | ts.TypeFlags.ESSymbol | ts.TypeFlags.UniqueESSymbol | ts.TypeFlags.StringLiteral | ts.TypeFlags.NumberLiteral | ts.TypeFlags.BooleanLiteral | ts.TypeFlags.BigIntLiteral)) {
27
- return {
28
- abstraction: "PrimitiveType" /* PRIMITIVE */,
29
- declaration: void 0
30
- };
31
- }
32
- const declaration = getDeclarationFromType(type, {
33
- typeChecker
34
- });
35
- if (declaration) {
36
- if (ts.isTypeAliasDeclaration(declaration) || ts.isInterfaceDeclaration(declaration) || ts.isClassDeclaration(declaration) || ts.isEnumDeclaration(declaration) || ts.isVariableDeclaration(declaration) || ts.isFunctionDeclaration(declaration)) {
37
- return {
38
- abstraction: "DeclarationType" /* DECLARATION */,
39
- declaration
40
- };
41
- }
42
- }
43
- if (type.getCallSignatures().length > 0) {
44
- return {
45
- abstraction: "FunctionType" /* FUNCTION */,
46
- declaration: void 0
47
- };
48
- }
49
- if (type.flags & ts.TypeFlags.Object) {
50
- return {
51
- abstraction: "ObjectType" /* OBJECT */,
52
- declaration: void 0
53
- };
54
- }
55
- return {
56
- abstraction: "unknown" /* UNKNOWN */,
57
- declaration: void 0
58
- };
59
- };
60
- class TypeResolutionTracker {
61
- constructor() {
62
- // Cache for resolved types - maps ts.Type to TypeInfoImpl
63
- this._typeCache = /* @__PURE__ */ new WeakMap();
64
- // Cache for resolved types from nodes - maps ts.Node to TypeInfoImpl
65
- this._nodeCache = /* @__PURE__ */ new WeakMap();
66
- }
67
- /**
68
- * Gets the cached TypeInfoImpl for a type, or undefined if not cached.
69
- */
70
- get(type) {
71
- return this._typeCache.get(type);
72
- }
73
- /**
74
- * Caches a TypeInfoImpl for a type.
75
- */
76
- set(type, value) {
77
- this._typeCache.set(type, value);
78
- }
79
- /**
80
- * Gets the cached TypeInfoImpl for a node, or undefined if not cached.
81
- */
82
- getFromNode(node) {
83
- return this._nodeCache.get(node);
84
- }
85
- /**
86
- * Caches a TypeInfoImpl for a node.
87
- */
88
- setFromNode(node, value) {
89
- this._nodeCache.set(node, value);
90
- }
91
- }
92
- const cacheDecorator = (cb, node, typeResolutionTracker) => {
93
- const cached = typeResolutionTracker.getFromNode(node);
94
- if (cached !== void 0) {
95
- return cached;
96
- }
97
- const result = cb(node);
98
- if (result) {
99
- typeResolutionTracker.setFromNode(node, result);
100
- }
101
- return result;
102
- };
103
- const getType = (node, typeChecker, typeResolutionTracker) => {
104
- const context = {
105
- typeChecker,
106
- typeResolutionTracker
107
- };
108
- const typeImpl = cacheDecorator(
109
- (node2) => {
110
- try {
111
- if (ts.isMethodDeclaration(node2)) {
112
- return fromMethodReturnType(node2, context);
113
- }
114
- if (ts.isPropertyDeclaration(node2)) {
115
- if (node2.type) {
116
- return fromTsNode(node2.type, context);
117
- }
118
- if (node2.initializer) {
119
- return fromPropertyInitializer(node2.initializer, context);
120
- }
121
- return void 0;
122
- }
123
- if (ts.isTypeNode(node2)) {
124
- return fromExplicitTypeAnnotation(node2, context);
125
- }
126
- if (ts.isExpression(node2)) {
127
- return fromPropertyInitializer(node2, context);
128
- }
129
- const type = context.typeChecker.getTypeAtLocation(node2);
130
- if (!type) {
131
- return void 0;
132
- }
133
- return fromInferredType(type, context);
134
- } catch (error) {
135
- console.error("error", error);
136
- return void 0;
137
- }
138
- },
139
- node,
140
- typeResolutionTracker
141
- );
142
- if (!typeImpl) {
143
- return [];
144
- }
145
- console.log("typeImpl", typeImpl.type.symbol?.name);
146
- return [typeImpl.type];
147
- };
148
- function fromTsNode(node, context) {
149
- return cacheDecorator(
150
- (node2) => {
151
- try {
152
- if (ts.isMethodDeclaration(node2)) {
153
- return fromMethodReturnType(node2, context);
154
- }
155
- if (ts.isPropertyDeclaration(node2)) {
156
- if (node2.type) {
157
- return fromTsNode(node2.type, context);
158
- }
159
- if (node2.initializer) {
160
- return fromPropertyInitializer(node2.initializer, context);
161
- }
162
- return void 0;
163
- }
164
- if (ts.isTypeNode(node2)) {
165
- return fromExplicitTypeAnnotation(node2, context);
166
- }
167
- if (ts.isExpression(node2)) {
168
- return fromPropertyInitializer(node2, context);
169
- }
170
- const type = context.typeChecker.getTypeAtLocation(node2);
171
- if (!type) {
172
- return void 0;
173
- }
174
- return fromInferredType(type, context);
175
- } catch (error) {
176
- console.error("error", error);
177
- return void 0;
178
- }
179
- },
180
- node,
181
- context.typeResolutionTracker
182
- );
183
- }
184
- function fromMethodReturnType(methodNode, context) {
185
- try {
186
- const cached = context.typeResolutionTracker.getFromNode(methodNode);
187
- if (cached !== void 0) {
188
- return cached;
189
- }
190
- if (methodNode.type) {
191
- const result = fromExplicitTypeAnnotation(methodNode.type, context);
192
- if (result) {
193
- context.typeResolutionTracker.setFromNode(methodNode, result);
194
- }
195
- return result;
196
- }
197
- const methodType = context.typeChecker.getTypeAtLocation(methodNode);
198
- const signatures = methodType.getCallSignatures();
199
- if (signatures.length > 0) {
200
- const returnType = signatures[signatures.length - 1].getReturnType();
201
- if (returnType.symbol) {
202
- const result2 = fromTypeWithSymbol(returnType, context);
203
- if (result2) {
204
- context.typeResolutionTracker.setFromNode(methodNode, result2);
205
- }
206
- return result2;
207
- }
208
- const result = fromInferredType(returnType, context);
209
- if (result) {
210
- context.typeResolutionTracker.setFromNode(methodNode, result);
211
- }
212
- return result;
213
- }
214
- return void 0;
215
- } catch (error) {
216
- return void 0;
217
- }
218
- }
219
- function fromPropertyInitializer(initializer, context) {
220
- try {
221
- const cached = context.typeResolutionTracker.getFromNode(
222
- initializer
223
- );
224
- if (cached !== void 0) {
225
- return cached;
226
- }
227
- if (ts.isIdentifier(initializer)) {
228
- const symbol = context.typeChecker.getSymbolAtLocation(initializer);
229
- if (symbol) {
230
- const declarations = symbol.getDeclarations();
231
- const varDecl = declarations?.find((d) => ts.isVariableDeclaration(d));
232
- if (varDecl) {
233
- const varType = varDecl.initializer ? context.typeChecker.getTypeAtLocation(varDecl.initializer) : context.typeChecker.getTypeAtLocation(varDecl);
234
- if (varType) {
235
- const result2 = fromInferredType(varType, context);
236
- if (result2) {
237
- context.typeResolutionTracker.setFromNode(initializer, result2);
238
- }
239
- return result2;
240
- }
241
- }
242
- }
243
- }
244
- const type = context.typeChecker.getTypeAtLocation(initializer);
245
- if (!type) {
246
- return void 0;
247
- }
248
- const result = fromInferredType(type, context);
249
- if (result) {
250
- context.typeResolutionTracker.setFromNode(initializer, result);
251
- }
252
- return result;
253
- } catch (error) {
254
- return void 0;
255
- }
256
- }
257
- function fromTypeWithSymbol(type, context) {
258
- try {
259
- const cached = context.typeResolutionTracker.get(type);
260
- if (cached !== void 0) {
261
- return cached;
262
- }
263
- const baseType = type.target || type;
264
- const typeSymbol = baseType.symbol;
265
- if (typeSymbol) {
266
- const declarations = typeSymbol.getDeclarations();
267
- const declaration = declarations && declarations.length > 0 ? declarations[declarations.length - 1] : typeSymbol.valueDeclaration;
268
- if (declaration) {
269
- if (ts.isTypeAliasDeclaration(declaration) || ts.isInterfaceDeclaration(declaration) || ts.isClassDeclaration(declaration) || ts.isEnumDeclaration(declaration) || ts.isVariableDeclaration(declaration) || ts.isFunctionDeclaration(declaration)) {
270
- return new TypeImplementation(
271
- type,
272
- // TypeInfoAbstraction.DECLARATION,
273
- declaration,
274
- void 0,
275
- context
276
- );
277
- }
278
- }
279
- }
280
- return void 0;
281
- } catch (error) {
282
- return void 0;
283
- }
284
- }
285
- function fromInferredType(type, context) {
286
- try {
287
- const cached = context.typeResolutionTracker.get(type);
288
- if (cached !== void 0) {
289
- return cached;
290
- }
291
- const resolved = resolveFromType(type, context.typeChecker);
292
- const typeArgs = type.typeArguments;
293
- const typeArguments = typeArgs ? typeArgs.map((arg) => fromInferredType(arg, context)).filter((arg) => arg !== void 0) : void 0;
294
- const result = new TypeImplementation(
295
- type,
296
- // resolved.abstraction,
297
- resolved.declaration,
298
- typeArguments,
299
- context
300
- );
301
- context.typeResolutionTracker.set(type, result);
302
- return result;
303
- } catch (error) {
304
- return void 0;
305
- }
306
- }
307
- function fromExplicitTypeAnnotation(typeNode, context) {
308
- try {
309
- if (ts.isTypeReferenceNode(typeNode)) {
310
- const declaration = void 0;
311
- if (declaration) {
312
- if (ts.isTypeAliasDeclaration(declaration) || ts.isInterfaceDeclaration(declaration) || ts.isClassDeclaration(declaration) || ts.isEnumDeclaration(declaration) || ts.isVariableDeclaration(declaration) || ts.isFunctionDeclaration(declaration)) {
313
- const underlyingType = context.typeChecker.getTypeAtLocation(typeNode);
314
- const typeArgs = underlyingType && underlyingType.typeArguments;
315
- const typeArguments = typeArgs ? typeArgs.map((arg) => fromInferredType(arg, context)).filter((arg) => arg !== void 0) : void 0;
316
- return new TypeImplementation(
317
- underlyingType,
318
- // TypeInfoAbstraction.DECLARATION,
319
- declaration,
320
- typeArguments,
321
- context
322
- );
323
- }
324
- }
325
- }
326
- const type = context.typeChecker.getTypeAtLocation(typeNode);
327
- if (!type) {
328
- return void 0;
329
- }
330
- return fromInferredType(type, context);
331
- } catch (error) {
332
- return void 0;
333
- }
334
- }
335
- class TypeImplementation {
336
- // public readonly typeArgumentAbstraction: TypeInfoAbstraction | undefined;
337
- constructor(type, declaration, typeArguments, context) {
338
- this.type = type;
339
- this.baseTypes = [];
340
- this.name = context.typeChecker.typeToString(type);
341
- const baseTypes = type.getBaseTypes();
342
- if (baseTypes) {
343
- this.baseTypes = baseTypes.map((baseType) => {
344
- return fromInferredType(baseType, context);
345
- });
346
- }
347
- this.kind = "Type";
348
- this.typeArguments = typeArguments;
349
- }
350
- }
351
- export {
352
- TypeInfoAbstraction,
353
- TypeResolutionTracker,
354
- cacheDecorator,
355
- getType
356
- };