UNPKG

3 kBTypeScriptView Raw
1import * as ts from 'typescript';
2/**
3 * Exposes the TypeScript compiler internals for detecting global variable names.
4 */
5export interface IGlobalVariableAnalyzer {
6 hasGlobalName(name: string): boolean;
7}
8export declare class TypeScriptInternals {
9 static getImmediateAliasedSymbol(symbol: ts.Symbol, typeChecker: ts.TypeChecker): ts.Symbol;
10 /**
11 * Returns the Symbol for the provided Declaration. This is a workaround for a missing
12 * feature of the TypeScript Compiler API. It is the only apparent way to reach
13 * certain data structures, and seems to always work, but is not officially documented.
14 *
15 * @returns The associated Symbol. If there is no semantic information (e.g. if the
16 * declaration is an extra semicolon somewhere), then "undefined" is returned.
17 */
18 static tryGetSymbolForDeclaration(declaration: ts.Declaration, checker: ts.TypeChecker): ts.Symbol | undefined;
19 /**
20 * Returns whether the provided Symbol is a TypeScript "late-bound" Symbol (i.e. was created by the Checker
21 * for a computed property based on its type, rather than by the Binder).
22 */
23 static isLateBoundSymbol(symbol: ts.Symbol): boolean;
24 /**
25 * Retrieves the comment ranges associated with the specified node.
26 */
27 static getJSDocCommentRanges(node: ts.Node, text: string): ts.CommentRange[] | undefined;
28 /**
29 * Retrieves the (unescaped) value of an string literal, numeric literal, or identifier.
30 */
31 static getTextOfIdentifierOrLiteral(node: ts.Identifier | ts.StringLiteralLike | ts.NumericLiteral): string;
32 /**
33 * Retrieves the (cached) module resolution information for a module name that was exported from a SourceFile.
34 * The compiler populates this cache as part of analyzing the source file.
35 */
36 static getResolvedModule(sourceFile: ts.SourceFile, moduleNameText: string, mode: ts.ModuleKind.CommonJS | ts.ModuleKind.ESNext | undefined): ts.ResolvedModuleFull | undefined;
37 /**
38 * Gets the mode required for module resolution required with the addition of Node16/nodenext
39 */
40 static getModeForUsageLocation(file: {
41 impliedNodeFormat?: ts.SourceFile['impliedNodeFormat'];
42 }, usage: ts.StringLiteralLike | undefined): ts.ModuleKind.CommonJS | ts.ModuleKind.ESNext | undefined;
43 /**
44 * Returns ts.Symbol.parent if it exists.
45 */
46 static getSymbolParent(symbol: ts.Symbol): ts.Symbol | undefined;
47 /**
48 * In an statement like `export default class X { }`, the `Symbol.name` will be `default`
49 * whereas the `localSymbol` is `X`.
50 */
51 static tryGetLocalSymbol(declaration: ts.Declaration): ts.Symbol | undefined;
52 static getGlobalVariableAnalyzer(program: ts.Program): IGlobalVariableAnalyzer;
53 /**
54 * Returns whether a variable is declared with the const keyword
55 */
56 static isVarConst(node: ts.VariableDeclaration | ts.VariableDeclarationList): boolean;
57}
58//# sourceMappingURL=TypeScriptInternals.d.ts.map
\No newline at end of file