CodeQL library for JavaScript/TypeScript
codeql/javascript-all 0.8.13 (changelog, source)

Predicate AccessPath::getAReferenceTo

Gets a node that refers to the given access path relative to the given root node, or root itself if the access path is empty.

This works for direct references as well as for aliases established through local data flow.

For example:

function f(x) {
  let a = x.f.g; // reference to (x, "f.g")
  let b = a.h;   // reference to (x, "f.g.h")

Import path

import javascript
Node getAReferenceTo(Root root, string path)