Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ predicate parseTypeString(string rawType, string package, string qualifiedName)
predicate isPackageUsed(string package) {
package = "global"
or
package = any(JS::Import imp).getImportedPathString()
// To simplify which dependencies are needed to construct DataFlow::Node, we don't want to rely on `Import` here.
// Just check all string literals.
package = any(JS::Expr imp).getStringValue()
Copy link

Copilot AI Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using any(JS::Expr imp).getStringValue() will iterate over all expressions in the codebase to find string values, which could be inefficient. Consider using a more specific expression type like JS::StringLiteral to reduce the search space.

Suggested change
package = any(JS::Expr imp).getStringValue()
package = any(JS::StringLiteral imp).getStringValue()

Copilot uses AI. Check for mistakes.
or
any(JS::TypeAnnotation t).hasUnderlyingType(package, _)
package = any(JS::StringLiteralTypeExpr t).getValue() // Can be used in `import("foo")`
or
exists(JS::PackageJson json | json.getPackageName() = package)
}
Expand Down
Loading