@flint.fyi/typescript-language 0.18.4 → 0.19.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 (72) hide show
  1. package/{lib/types/ast.d.ts → dist/index.d.mts} +777 -3
  2. package/dist/index.mjs +1104 -0
  3. package/package.json +9 -7
  4. package/lib/_virtual/_rolldown/runtime.js +0 -13
  5. package/lib/collectReferencedFilePaths.d.ts +0 -3
  6. package/lib/collectReferencedFilePaths.js +0 -38
  7. package/lib/convertTypeScriptDiagnosticToLanguageReport.d.ts +0 -17
  8. package/lib/convertTypeScriptDiagnosticToLanguageReport.js +0 -112
  9. package/lib/createTypeScriptServerHost.d.ts +0 -3
  10. package/lib/createTypeScriptServerHost.js +0 -101
  11. package/lib/directives/parseDirectivesFromTypeScriptFile.d.ts +0 -12
  12. package/lib/directives/parseDirectivesFromTypeScriptFile.js +0 -64
  13. package/lib/getFirstEnumValues.d.ts +0 -35
  14. package/lib/getFirstEnumValues.js +0 -46
  15. package/lib/getTSNodeRange.d.ts +0 -8
  16. package/lib/getTSNodeRange.js +0 -9
  17. package/lib/getTypeScriptFileCacheImpacts.d.ts +0 -3
  18. package/lib/getTypeScriptFileCacheImpacts.js +0 -11
  19. package/lib/index.d.ts +0 -26
  20. package/lib/index.js +0 -22
  21. package/lib/language.d.ts +0 -414
  22. package/lib/language.js +0 -117
  23. package/lib/nodes.d.ts +0 -203
  24. package/lib/normalizeRange.d.ts +0 -3
  25. package/lib/normalizeRange.js +0 -17
  26. package/lib/orderTypeScriptFilePaths.d.ts +0 -2
  27. package/lib/orderTypeScriptFilePaths.js +0 -90
  28. package/lib/package.js +0 -5
  29. package/lib/scope/identifierReferences.d.ts +0 -3
  30. package/lib/scope/identifierReferences.js +0 -89
  31. package/lib/scope/scopeManager.d.ts +0 -14
  32. package/lib/scope/scopeManager.js +0 -153
  33. package/lib/scope/scopes.d.ts +0 -7
  34. package/lib/scope/scopes.js +0 -64
  35. package/lib/scope/types.d.ts +0 -45
  36. package/lib/types/checker.d.ts +0 -22
  37. package/lib/utils/containsGlobalDeclarations.d.ts +0 -6
  38. package/lib/utils/containsGlobalDeclarations.js +0 -17
  39. package/lib/utils/createRuleTesterTSConfig.d.ts +0 -7
  40. package/lib/utils/createRuleTesterTSConfig.js +0 -16
  41. package/lib/utils/declarationIncludesGlobal.d.ts +0 -6
  42. package/lib/utils/declarationIncludesGlobal.js +0 -7
  43. package/lib/utils/declarationsIncludeGlobal.d.ts +0 -2
  44. package/lib/utils/declarationsIncludeGlobal.js +0 -7
  45. package/lib/utils/forEachChild.d.ts +0 -7
  46. package/lib/utils/forEachChild.js +0 -5
  47. package/lib/utils/getDeclarationsIfGlobal.d.ts +0 -6
  48. package/lib/utils/getDeclarationsIfGlobal.js +0 -8
  49. package/lib/utils/getModifyingReferences.d.ts +0 -10
  50. package/lib/utils/getModifyingReferences.js +0 -13
  51. package/lib/utils/hasSameTokens.d.ts +0 -6
  52. package/lib/utils/hasSameTokens.js +0 -30
  53. package/lib/utils/isBuiltinArrayMethod.d.ts +0 -13
  54. package/lib/utils/isBuiltinArrayMethod.js +0 -7
  55. package/lib/utils/isFunction.d.ts +0 -6
  56. package/lib/utils/isFunction.js +0 -6
  57. package/lib/utils/isGlobalDeclaration.d.ts +0 -6
  58. package/lib/utils/isGlobalDeclaration.js +0 -7
  59. package/lib/utils/isGlobalDeclarationOfName.d.ts +0 -10
  60. package/lib/utils/isGlobalDeclarationOfName.js +0 -21
  61. package/lib/utils/isGlobalVariable.d.ts +0 -12
  62. package/lib/utils/isGlobalVariable.js +0 -17
  63. package/lib/utils/isInlineArrayCreation.d.ts +0 -11
  64. package/lib/utils/isInlineArrayCreation.js +0 -43
  65. package/lib/utils/isStaticString.d.ts +0 -5
  66. package/lib/utils/isStaticString.js +0 -7
  67. package/lib/utils/isStringRawNoSubstitution.d.ts +0 -7
  68. package/lib/utils/isStringRawNoSubstitution.js +0 -9
  69. package/lib/utils/unwrapParentParenthesizedExpressions.d.ts +0 -6
  70. package/lib/utils/unwrapParentParenthesizedExpressions.js +0 -7
  71. package/lib/utils/unwrapParenthesizedNode.d.ts +0 -6
  72. package/lib/utils/unwrapParenthesizedNode.js +0 -7
@@ -1,45 +0,0 @@
1
- import { AnyNode, ArrowFunction, ConstructorDeclaration, FunctionDeclaration, FunctionExpression, GetAccessorDeclaration, Identifier, MethodDeclaration, SetAccessorDeclaration } from "../types/ast.js";
2
-
3
- //#region src/scope/types.d.ts
4
- type FunctionWithParameters = ArrowFunction | ConstructorDeclaration | FunctionDeclaration | FunctionExpression | GetAccessorDeclaration | MethodDeclaration | SetAccessorDeclaration;
5
- interface Scope {
6
- block: AnyNode;
7
- childScopes: Scope[];
8
- references: ScopeReference[];
9
- upper: Scope | undefined;
10
- variables: ScopeVariable[];
11
- }
12
- interface ScopeDefinition {
13
- identifier: Identifier;
14
- kind: ScopeDefinitionKind;
15
- node: AnyNode;
16
- }
17
- type ScopeDefinitionKind = "catch" | "class" | "function" | "import" | "parameter" | "variable";
18
- interface ScopeInternal extends Scope {
19
- childScopes: ScopeInternal[];
20
- upper: ScopeInternal | undefined;
21
- variablesByName: Map<string, ScopeVariable>;
22
- }
23
- interface ScopeManager {
24
- findVariable(identifier: Identifier): ScopeVariable | undefined;
25
- getDeclaredVariables(node: AnyNode): ScopeVariable[];
26
- getReferencesInScope(node: AnyNode): ScopeReference[];
27
- getScope(node: AnyNode): Scope;
28
- globalScope: Scope;
29
- }
30
- interface ScopeReference {
31
- from: Scope;
32
- identifier: Identifier;
33
- isWrite: boolean;
34
- text: string;
35
- variable: ScopeVariable | undefined;
36
- }
37
- interface ScopeVariable {
38
- declarations: Identifier[];
39
- definitions: ScopeDefinition[];
40
- name: string;
41
- references: ScopeReference[];
42
- scope: Scope;
43
- }
44
- //#endregion
45
- export { FunctionWithParameters, Scope, ScopeDefinition, ScopeDefinitionKind, ScopeInternal, ScopeManager, ScopeReference, ScopeVariable };
@@ -1,22 +0,0 @@
1
- import { CallExpression, Decorator, JsxOpeningElement, JsxSelfClosingElement, NewExpression, TaggedTemplateExpression } from "./ast.js";
2
- import ts, { Node, Signature, TupleTypeReference, Type, TypeChecker, TypeReference } from "typescript";
3
-
4
- //#region src/types/checker.d.ts
5
- type Checker = CheckerOverrides & Omit<TypeChecker, keyof CheckerOverrides>;
6
- interface CheckerOverrides {
7
- getResolvedSignature(node: CallExpression | Decorator | JsxOpeningElement | JsxSelfClosingElement | NewExpression | TaggedTemplateExpression | ts.CallLikeExpression): Signature | undefined;
8
- /** Improve narrowing, borrow from typescript-eslint */
9
- isArrayType(type: Type): type is TypeReference;
10
- isTupleType(type: Type): type is TupleTypeReference;
11
- /**
12
- * TS internal api
13
- * Return the type of the given property in the given type, or undefined if no such property exists
14
- */
15
- getTypeOfPropertyOfType(type: Type, propertyName: string): Type | undefined;
16
- /**
17
- * TS internal api
18
- */
19
- getContextualTypeForArgumentAtIndex(node: Node, argIndex: number): Type;
20
- }
21
- //#endregion
22
- export { Checker };
@@ -1,6 +0,0 @@
1
- import ts from "typescript";
2
- /**
3
- * Inspects top-level statements of a TS source file to determine
4
- * if it introduces or modifies entities in the global scope.
5
- */
6
- export declare function containsGlobalDeclarations(sourceFileNode: ts.SourceFile): boolean;
@@ -1,17 +0,0 @@
1
- import ts from "typescript";
2
- //#region src/utils/containsGlobalDeclarations.ts
3
- /**
4
- * Inspects top-level statements of a TS source file to determine
5
- * if it introduces or modifies entities in the global scope.
6
- */
7
- function containsGlobalDeclarations(sourceFileNode) {
8
- const isModule = ts.isExternalModule(sourceFileNode);
9
- return sourceFileNode.statements.some((statement) => {
10
- if (ts.isModuleDeclaration(statement) && statement.name.text === "global") return true;
11
- if (isModule) return false;
12
- if (!ts.canHaveModifiers(statement)) return false;
13
- return ts.getModifiers(statement)?.some((mod) => mod.kind === ts.SyntaxKind.DeclareKeyword);
14
- });
15
- }
16
- //#endregion
17
- export { containsGlobalDeclarations };
@@ -1,7 +0,0 @@
1
- //#region src/utils/createRuleTesterTSConfig.d.ts
2
- declare function createRuleTesterTSConfig(defaultCompilerOptions?: Record<string, unknown>): {
3
- "tsconfig.base.json": string;
4
- "tsconfig.json": string;
5
- };
6
- //#endregion
7
- export { createRuleTesterTSConfig };
@@ -1,16 +0,0 @@
1
- //#region src/utils/createRuleTesterTSConfig.ts
2
- function createRuleTesterTSConfig(defaultCompilerOptions) {
3
- return {
4
- "tsconfig.base.json": JSON.stringify({ compilerOptions: {
5
- lib: ["esnext"],
6
- moduleResolution: "bundler",
7
- strict: true,
8
- target: "esnext",
9
- types: [],
10
- ...defaultCompilerOptions
11
- } }, null, 2),
12
- "tsconfig.json": JSON.stringify({ extends: "./tsconfig.base.json" }, null, 2)
13
- };
14
- }
15
- //#endregion
16
- export { createRuleTesterTSConfig };
@@ -1,6 +0,0 @@
1
- import ts from "typescript";
2
-
3
- //#region src/utils/declarationIncludesGlobal.d.ts
4
- declare function declarationIncludesGlobal(declaration: ts.Declaration): boolean;
5
- //#endregion
6
- export { declarationIncludesGlobal };
@@ -1,7 +0,0 @@
1
- //#region src/utils/declarationIncludesGlobal.ts
2
- function declarationIncludesGlobal(declaration) {
3
- const sourceFile = declaration.getSourceFile();
4
- return sourceFile.hasNoDefaultLib || /\/lib\.[^/]*\.d\.ts$/.test(sourceFile.fileName);
5
- }
6
- //#endregion
7
- export { declarationIncludesGlobal };
@@ -1,2 +0,0 @@
1
- import type ts from "typescript";
2
- export declare function declarationsIncludeGlobal(declarations: ts.Declaration[]): boolean;
@@ -1,7 +0,0 @@
1
- import { declarationIncludesGlobal } from "./declarationIncludesGlobal.js";
2
- //#region src/utils/declarationsIncludeGlobal.ts
3
- function declarationsIncludeGlobal(declarations) {
4
- return declarations.some(declarationIncludesGlobal);
5
- }
6
- //#endregion
7
- export { declarationsIncludeGlobal };
@@ -1,7 +0,0 @@
1
- import { AnyNode } from "../types/ast.js";
2
- import ts from "typescript";
3
-
4
- //#region src/utils/forEachChild.d.ts
5
- declare const forEachChild: <T>(node: AnyNode, cbNode: (node: AnyNode) => T | undefined, cbNodes?: (nodes: ts.NodeArray<AnyNode>) => T | undefined) => T | undefined;
6
- //#endregion
7
- export { forEachChild };
@@ -1,5 +0,0 @@
1
- import ts from "typescript";
2
- //#region src/utils/forEachChild.ts
3
- const forEachChild = ts.forEachChild;
4
- //#endregion
5
- export { forEachChild };
@@ -1,6 +0,0 @@
1
- import { Expression } from "../types/ast.js";
2
- import { Checker } from "../types/checker.js";
3
- //#region src/utils/getDeclarationsIfGlobal.d.ts
4
- declare function getDeclarationsIfGlobal(node: Expression, typeChecker: Checker): import("typescript").Declaration[] | undefined;
5
- //#endregion
6
- export { getDeclarationsIfGlobal };
@@ -1,8 +0,0 @@
1
- import { declarationsIncludeGlobal } from "./declarationsIncludeGlobal.js";
2
- //#region src/utils/getDeclarationsIfGlobal.ts
3
- function getDeclarationsIfGlobal(node, typeChecker) {
4
- const declarations = typeChecker.getSymbolAtLocation(node)?.getDeclarations();
5
- return !!declarations && declarationsIncludeGlobal(declarations) ? declarations : void 0;
6
- }
7
- //#endregion
8
- export { getDeclarationsIfGlobal };
@@ -1,10 +0,0 @@
1
- import { Identifier, SourceFile } from "../types/ast.js";
2
-
3
- //#region src/utils/getModifyingReferences.d.ts
4
- /**
5
- * Gets all references to a variable that modify it (assignments, increments, decrements).
6
- * @returns An array of identifier nodes that modify the variable.
7
- */
8
- declare function getModifyingReferences(identifier: Identifier, sourceFile: SourceFile): Identifier[];
9
- //#endregion
10
- export { getModifyingReferences };
@@ -1,13 +0,0 @@
1
- import { getScopeManager } from "../scope/scopeManager.js";
2
- //#region src/utils/getModifyingReferences.ts
3
- /**
4
- * Gets all references to a variable that modify it (assignments, increments, decrements).
5
- * @returns An array of identifier nodes that modify the variable.
6
- */
7
- function getModifyingReferences(identifier, sourceFile) {
8
- const variable = getScopeManager(sourceFile).findVariable(identifier);
9
- if (!variable || variable.declarations.length > 1) return [];
10
- return variable.references.filter((reference) => reference.isWrite).map((reference) => reference.identifier);
11
- }
12
- //#endregion
13
- export { getModifyingReferences };
@@ -1,6 +0,0 @@
1
- import { AnyNode, SourceFile } from "../types/ast.js";
2
-
3
- //#region src/utils/hasSameTokens.d.ts
4
- declare function hasSameTokens(nodeA: AnyNode, nodeB: AnyNode, sourceFile: SourceFile): boolean;
5
- //#endregion
6
- export { hasSameTokens };
@@ -1,30 +0,0 @@
1
- import { unwrapParenthesizedNode } from "./unwrapParenthesizedNode.js";
2
- import ts from "typescript";
3
- //#region src/utils/hasSameTokens.ts
4
- function hasSameTokens(nodeA, nodeB, sourceFile) {
5
- const queueA = [unwrapParenthesizedNode(nodeA)];
6
- const queueB = [unwrapParenthesizedNode(nodeB)];
7
- while (true) {
8
- const currentA = queueA.shift();
9
- const currentB = queueB.shift();
10
- if (!currentA || !currentB) break;
11
- if (currentA.kind !== currentB.kind) return false;
12
- if (ts.isTokenKind(currentA.kind)) {
13
- if (!areSameToken(currentA, currentB, sourceFile)) return false;
14
- continue;
15
- }
16
- const childrenA = currentA.getChildren(sourceFile);
17
- const childrenB = currentB.getChildren(sourceFile);
18
- if (childrenA.length !== childrenB.length) return false;
19
- queueA.push(...childrenA);
20
- queueB.push(...childrenB);
21
- }
22
- return queueA.length === queueB.length;
23
- }
24
- function areSameToken(nodeA, nodeB, sourceFile) {
25
- if (ts.isIdentifier(nodeA) || ts.isPrivateIdentifier(nodeA) || ts.isNumericLiteral(nodeA) || ts.isBigIntLiteral(nodeA) || ts.isStringLiteral(nodeA) || ts.isNoSubstitutionTemplateLiteral(nodeA)) return nodeA.text === nodeB.text;
26
- if (nodeA.kind === ts.SyntaxKind.RegularExpressionLiteral) return sourceFile.text.slice(nodeA.getStart(sourceFile), nodeA.getEnd()) === sourceFile.text.slice(nodeB.getStart(sourceFile), nodeB.getEnd());
27
- return true;
28
- }
29
- //#endregion
30
- export { hasSameTokens };
@@ -1,13 +0,0 @@
1
- import { CallExpression, PropertyAccessExpression } from "../types/ast.js";
2
- import { Checker } from "../types/checker.js";
3
- import ts from "typescript";
4
-
5
- //#region src/utils/isBuiltinArrayMethod.d.ts
6
- type BuiltInArrayMethodNode = CallExpression & {
7
- expression: PropertyAccessExpression & {
8
- expression: ts.Expression;
9
- };
10
- };
11
- declare function isBuiltinArrayMethod(name: string, node: CallExpression, typeChecker: Checker): node is BuiltInArrayMethodNode;
12
- //#endregion
13
- export { BuiltInArrayMethodNode, isBuiltinArrayMethod };
@@ -1,7 +0,0 @@
1
- import ts from "typescript";
2
- //#region src/utils/isBuiltinArrayMethod.ts
3
- function isBuiltinArrayMethod(name, node, typeChecker) {
4
- return ts.isPropertyAccessExpression(node.expression) && node.expression.name.text === name && typeChecker.isArrayType(typeChecker.getTypeAtLocation(node.expression.expression)) && !ts.isExpressionStatement(node.parent);
5
- }
6
- //#endregion
7
- export { isBuiltinArrayMethod };
@@ -1,6 +0,0 @@
1
- import { Expression } from "../types/ast.js";
2
- import { Checker } from "../types/checker.js";
3
- //#region src/utils/isFunction.d.ts
4
- declare function isFunction(node: Expression, typeChecker: Checker): boolean;
5
- //#endregion
6
- export { isFunction };
@@ -1,6 +0,0 @@
1
- //#region src/utils/isFunction.ts
2
- function isFunction(node, typeChecker) {
3
- return !!typeChecker.getTypeAtLocation(node).getCallSignatures().length;
4
- }
5
- //#endregion
6
- export { isFunction };
@@ -1,6 +0,0 @@
1
- import { Expression } from "../types/ast.js";
2
- import { Checker } from "../types/checker.js";
3
- //#region src/utils/isGlobalDeclaration.d.ts
4
- declare function isGlobalDeclaration(node: Expression, typeChecker: Checker): boolean;
5
- //#endregion
6
- export { isGlobalDeclaration };
@@ -1,7 +0,0 @@
1
- import { getDeclarationsIfGlobal } from "./getDeclarationsIfGlobal.js";
2
- //#region src/utils/isGlobalDeclaration.ts
3
- function isGlobalDeclaration(node, typeChecker) {
4
- return !!getDeclarationsIfGlobal(node, typeChecker);
5
- }
6
- //#endregion
7
- export { isGlobalDeclaration };
@@ -1,10 +0,0 @@
1
- import { Checker } from "../types/checker.js";
2
- import ts from "typescript";
3
-
4
- //#region src/utils/isGlobalDeclarationOfName.d.ts
5
- /**
6
- * TODO: Use a scope analyzer (#400).
7
- */
8
- declare function isGlobalDeclarationOfName(node: ts.Node, name: string, typeChecker: Checker): boolean;
9
- //#endregion
10
- export { isGlobalDeclarationOfName };
@@ -1,21 +0,0 @@
1
- import { declarationIncludesGlobal } from "./declarationIncludesGlobal.js";
2
- import ts from "typescript";
3
- //#region src/utils/isGlobalDeclarationOfName.ts
4
- /**
5
- * TODO: Use a scope analyzer (#400).
6
- */
7
- function isGlobalDeclarationOfName(node, name, typeChecker) {
8
- const declarations = typeChecker.getSymbolAtLocation(node)?.getDeclarations();
9
- if (!declarations) return false;
10
- return declarations.every((declaration) => {
11
- if (ts.isVariableDeclaration(declaration) && declaration.initializer && ts.isIdentifier(declaration.initializer)) return isGlobalDeclarationOfName(declaration.initializer, name, typeChecker);
12
- if (ts.isPropertySignature(declaration)) return isGlobalDeclarationOfName(declaration.parent, name, typeChecker);
13
- return isDeclarationOfName(declaration, name) && declarationIncludesGlobal(declaration);
14
- });
15
- }
16
- function isDeclarationOfName(node, name) {
17
- if (ts.isClassDeclaration(node) || ts.isFunctionDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isVariableDeclaration(node)) return node.name && ts.isIdentifier(node.name) && node.name.text === name;
18
- return false;
19
- }
20
- //#endregion
21
- export { isGlobalDeclarationOfName };
@@ -1,12 +0,0 @@
1
- import { Expression } from "../types/ast.js";
2
- import { Checker } from "../types/checker.js";
3
- //#region src/utils/isGlobalVariable.d.ts
4
- /**
5
- * Checks if a node is a reference to a global variable (e.g., Object, undefined, NaN).
6
- * Global variables are those declared in TypeScript's lib files or are global identifiers
7
- * like undefined which have symbols but no user-defined declarations.
8
- * TODO: Use a scope manager (#400).
9
- */
10
- declare function isGlobalVariable(node: Expression, typeChecker: Checker): boolean;
11
- //#endregion
12
- export { isGlobalVariable };
@@ -1,17 +0,0 @@
1
- import { declarationsIncludeGlobal } from "./declarationsIncludeGlobal.js";
2
- //#region src/utils/isGlobalVariable.ts
3
- /**
4
- * Checks if a node is a reference to a global variable (e.g., Object, undefined, NaN).
5
- * Global variables are those declared in TypeScript's lib files or are global identifiers
6
- * like undefined which have symbols but no user-defined declarations.
7
- * TODO: Use a scope manager (#400).
8
- */
9
- function isGlobalVariable(node, typeChecker) {
10
- const symbol = typeChecker.getSymbolAtLocation(node);
11
- if (!symbol) return false;
12
- const declarations = symbol.getDeclarations();
13
- if (!declarations?.length) return true;
14
- return declarationsIncludeGlobal(declarations);
15
- }
16
- //#endregion
17
- export { isGlobalVariable };
@@ -1,11 +0,0 @@
1
- import * as ts$1 from "typescript";
2
-
3
- //#region src/utils/isInlineArrayCreation.d.ts
4
- /**
5
- * Checks if a node represents an inline array creation expression.
6
- * These are cases where a new array is created immediately before the method call,
7
- * so mutating methods like .sort() or .reverse() are safe to use.
8
- */
9
- declare function isInlineArrayCreation(node: ts$1.Expression): boolean;
10
- //#endregion
11
- export { isInlineArrayCreation };
@@ -1,43 +0,0 @@
1
- import * as ts$1 from "typescript";
2
- //#region src/utils/isInlineArrayCreation.ts
3
- const methodsReturningNewArray = new Set([
4
- "concat",
5
- "entries",
6
- "filter",
7
- "flat",
8
- "flatMap",
9
- "from",
10
- "keys",
11
- "map",
12
- "of",
13
- "slice",
14
- "split",
15
- "values"
16
- ]);
17
- const objectStaticMethods = new Set([
18
- "entries",
19
- "keys",
20
- "values"
21
- ]);
22
- /**
23
- * Checks if a node represents an inline array creation expression.
24
- * These are cases where a new array is created immediately before the method call,
25
- * so mutating methods like .sort() or .reverse() are safe to use.
26
- */
27
- function isInlineArrayCreation(node) {
28
- if (ts$1.isArrayLiteralExpression(node)) return true;
29
- if (ts$1.isParenthesizedExpression(node)) return isInlineArrayCreation(node.expression);
30
- if (ts$1.isCallExpression(node)) {
31
- if (ts$1.isPropertyAccessExpression(node.expression)) {
32
- const methodName = node.expression.name.text;
33
- if (ts$1.isIdentifier(node.expression.expression) && node.expression.expression.text === "Object" && objectStaticMethods.has(methodName)) return true;
34
- if (ts$1.isIdentifier(node.expression.expression) && node.expression.expression.text === "Array" && (methodName === "from" || methodName === "of")) return true;
35
- if (methodsReturningNewArray.has(methodName)) return true;
36
- }
37
- if (ts$1.isIdentifier(node.expression) && node.expression.text === "Array" && ts$1.isNewExpression(node.parent)) return true;
38
- }
39
- if (ts$1.isNewExpression(node) && ts$1.isIdentifier(node.expression) && node.expression.text === "Array") return true;
40
- return false;
41
- }
42
- //#endregion
43
- export { isInlineArrayCreation };
@@ -1,5 +0,0 @@
1
- import { Expression, NoSubstitutionTemplateLiteral, StringLiteral } from "../types/ast.js";
2
- //#region src/utils/isStaticString.d.ts
3
- declare function isStaticString(node: Expression): node is NoSubstitutionTemplateLiteral | StringLiteral;
4
- //#endregion
5
- export { isStaticString };
@@ -1,7 +0,0 @@
1
- import { SyntaxKind } from "typescript";
2
- //#region src/utils/isStaticString.ts
3
- function isStaticString(node) {
4
- return node.kind === SyntaxKind.StringLiteral || node.kind === SyntaxKind.NoSubstitutionTemplateLiteral;
5
- }
6
- //#endregion
7
- export { isStaticString };
@@ -1,7 +0,0 @@
1
- import { Expression, NoSubstitutionTemplateLiteral, TaggedTemplateExpression } from "../types/ast.js";
2
- //#region src/utils/isStringRawNoSubstitution.d.ts
3
- declare function isStringRawNoSubstitution(node: Expression): node is TaggedTemplateExpression & {
4
- template: NoSubstitutionTemplateLiteral;
5
- };
6
- //#endregion
7
- export { isStringRawNoSubstitution };
@@ -1,9 +0,0 @@
1
- import { SyntaxKind } from "typescript";
2
- //#region src/utils/isStringRawNoSubstitution.ts
3
- function isStringRawNoSubstitution(node) {
4
- if (node.kind !== SyntaxKind.TaggedTemplateExpression) return false;
5
- const tag = node.tag;
6
- return tag.kind === SyntaxKind.PropertyAccessExpression && tag.expression.kind === SyntaxKind.Identifier && tag.expression.text === "String" && tag.name.kind === SyntaxKind.Identifier && tag.name.text === "raw" && node.template.kind === SyntaxKind.NoSubstitutionTemplateLiteral;
7
- }
8
- //#endregion
9
- export { isStringRawNoSubstitution };
@@ -1,6 +0,0 @@
1
- import { BinaryExpression, LeftHandSideExpressionParent, ParenthesizedExpression } from "../types/ast.js";
2
-
3
- //#region src/utils/unwrapParentParenthesizedExpressions.d.ts
4
- declare function unwrapParentParenthesizedExpressions(node: BinaryExpression | ParenthesizedExpression): LeftHandSideExpressionParent;
5
- //#endregion
6
- export { unwrapParentParenthesizedExpressions };
@@ -1,7 +0,0 @@
1
- import { SyntaxKind } from "typescript";
2
- //#region src/utils/unwrapParentParenthesizedExpressions.ts
3
- function unwrapParentParenthesizedExpressions(node) {
4
- return node.parent.kind === SyntaxKind.ParenthesizedExpression ? unwrapParentParenthesizedExpressions(node.parent) : node.parent;
5
- }
6
- //#endregion
7
- export { unwrapParentParenthesizedExpressions };
@@ -1,6 +0,0 @@
1
- import { AnyNode } from "../types/ast.js";
2
-
3
- //#region src/utils/unwrapParenthesizedNode.d.ts
4
- declare function unwrapParenthesizedNode(node: AnyNode): AnyNode;
5
- //#endregion
6
- export { unwrapParenthesizedNode };
@@ -1,7 +0,0 @@
1
- import { SyntaxKind } from "typescript";
2
- //#region src/utils/unwrapParenthesizedNode.ts
3
- function unwrapParenthesizedNode(node) {
4
- return node.kind === SyntaxKind.ParenthesizedExpression ? unwrapParenthesizedNode(node.expression) : node;
5
- }
6
- //#endregion
7
- export { unwrapParenthesizedNode };