Package-level declarations
Types
A set of one or more available refactoring actions, grouped under a parent refactoring.
Reports config file diagnostics
Class and interface types (ObjectFlags.Class and ObjectFlags.Interface).
Navigation bar interface designed for visual studio's dual-column layout. This does not form a proper tree. The navbar is returned as a list of top-level items, each of which has a list of child items. Child items always have an empty array for their childItems.
Node in a tree of nested declarations in a file. The top node is always a script or module node.
Stored map from non-relative module name to a table: directory -> result of module lookup in this directory We support only non-relative module names because resolution of relative module names is usually more deterministic and thus less expensive.
Interface extending ParseConfigHost to support ParseConfigFile that reads config file and reports errors
Either a parsed command line or a parsed tsconfig.json
Cached resolutions per containing directory. This assumes that any module id will have the same resolution for sibling files located in the same folder.
Represents a single refactoring action - for example, the "Extract Method..." refactor might offer several actions, each corresponding to a surround class or closure to extract into.
A set of edits to make in response to a refactor action, plus an optional location where renaming should be invoked from
Represents the result of module resolution. Module resolution will pick up tsx/jsx/js files even if '--jsx' and '--allowJs' are turned off. The Program will then filter results based on these flags.
ResolvedModule with an explicitly provided extension property. Prefer this over ResolvedModule. If changing this, remember to change moduleResolutionIsEqualTo.
Signals that the signature help request came from a user typing a character. Depending on the character and the syntactic context, the request may or may not be served a result.
Signals that the user manually requested signature help. The language service will unconditionally attempt to provide a result.
Represents a single signature to show in signature help. The id is used for subsequent calls into the language service to ask questions about the signature help item in the context of any documents that have been updated. i.e. after an edit has happened, while signature help is still active, the host can ask important questions like 'what parameter is the user currently contained within?'.
Represents a set of signature help items, and the preferred item that should be selected.
Signature help information for a single parameter
Signals that this signature help request came from typing a character or moving the cursor. This should only occur if a signature help session was already active and the editor needs to see if it should adjust. The language service will unconditionally attempt to provide a result. triggerCharacter can be undefined for a retrigger caused by a cursor move.
SymbolTable based on ES6 Map interface.
Type references (ObjectFlags.Reference). When a class or interface has type parameters or a "this" type, references to the class or interface are made using type references. The typeArguments property specifies the types to substitute for the type parameters of the class or interface and optionally includes an extra element that specifies the type to substitute for "this" in the resulting instantiation. When no extra argument is present, the type reference itself is substituted for "this". The typeArguments property is undefined if the class or interface has no type parameters and the reference isn't specifying an explicit "this" argument.
Properties
Functions
Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' that represent a compilation unit.
Given a set of options, returns the set of type directive names that should be included for this program automatically. This list could either come from the config file, and/or from enumerating the types root + initial secondary types lookup location given "*" compat wildcard. More type directives might appear in the program later as a result of loading actual source files; this list is only the set of defaults that are implicitly included.
Get the path of the default library files (lib.d.ts) as distributed with the typescript node package. The functionality is not supported if the ts module is consumed outside of a node module.
A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the options parameter.
Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file.
Use program.getModeForResolutionAtIndex, which retrieves the correct compilerOptions, instead of this function whenever possible. Calculates the final resolution mode for an import at some index within a file's imports list. This is the resolution mode explicitly provided via import attributes, if present, or the syntax the usage would have if emitted to JavaScript. In --module node16 or nodenext, this may depend on the file's impliedNodeFormat. In --module preserve, it depends only on the input syntax of the reference. In other module modes, when overriding import attributes are not provided, this function returns undefined, as the result would have no impact on module resolution, emit, or type checking.
Use program.getModeForUsageLocation, which retrieves the correct compilerOptions, instead of this function whenever possible. Calculates the final resolution mode for a given module reference node. This function only returns a result when module resolution settings allow differing resolution between ESM imports and CJS requires, or when a mode is explicitly provided via import attributes, which cause an import or require condition to be used during resolution regardless of module resolution settings. In absence of overriding attributes, and in modes that support differing resolution, the result indicates the syntax the usage would emit to JavaScript. Some examples:
Reads the config file, reports errors if any and exits if the config file cannot be found