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

Class CanonicalName

A fully qualified name relative to a specific root, usually referring to a TypeScript namespace or type.

Canonical names are organized in a prefix tree, that is, the “parent” of a canonical name is the name corresponding to its prefix.

It is possible for two different canonical names to have the same qualified name, namely if they are rooted in different scopes. The hasQualifiedName predicates deal specifically with canonical names that are rooted in the global scope or in the scope of a named module.

This class is only populated when full TypeScript extraction is enabled.

Import path

import javascript

Direct supertypes

Known direct subtypes

Predicates

describeRoot

Gets a string describing the root scope of this canonical name.

getAChild

Gets a child of this canonical name, that is, an extension of its qualified name.

getADefinition

Gets a definition of the entity with this canonical name.

getAnAccess

Gets a use that refers to the entity with this canonical name.

getChild

Gets the child of this canonical name that has the given name, if any.

getExternalModuleName

Gets the name of the external module represented by this canonical name, if any.

getGlobalName

Gets the name of the global variable represented by this canonical name, if any.

getModule

Gets the module represented by this canonical name, if such a module exists and was extracted.

getName

Gets the name without prefix.

getParent

Gets the parent of this canonical name, that is, the prefix of its qualified name.

getRelativeName

Gets the qualified name without the root.

getRootScope

Gets the outermost scope from which this type can be accessed by a qualified name (without using an import).

hasChild

Holds if this canonical name has a child, i.e. an extension of its qualified name.

hasQualifiedName

Holds if this has the given qualified name, rooted in the global scope.

hasQualifiedName

Holds if this has the given qualified name, rooted in the given external module.

isExportedMember

Holds if this canonical name is exported by its parent.

isModuleRoot

Holds if this is the export namespace of a module.

isModuleRoot

Holds if this is the export namespace of the given module.

isRoot

True if this has no parent.

toString

Gets the fully qualified name, followed by the name of its enclosing module or file.