UNPKG

@microsoft/api-extractor

Version:

Validate, document, and review the exported API for a TypeScript library

50 lines (49 loc) 1.9 kB
import * as ts from 'typescript'; import { AstImport } from './AstImport'; /** * Return value for DtsRollupGenerator._followAliases() */ export interface IFollowAliasesResult { /** * The original symbol that defined this entry, after following any aliases. */ readonly followedSymbol: ts.Symbol; /** * The original name used where it was defined. */ readonly localName: string; /** * True if this is an ambient definition, e.g. from a "typings" folder. */ readonly isAmbient: boolean; /** * If this followedSymbol was reached by traversing */ readonly astImport: AstImport | undefined; } /** * This is a helper class for DtsRollupGenerator and AstSymbolTable. * Its main role is to provide an expanded version of TypeScriptHelpers.followAliases() * that supports tracking of imports from eternal packages. */ export declare class SymbolAnalyzer { /** * This function determines which ts.Node kinds will generate an AstDeclaration. * These correspond to the definitions that we can add AEDoc to. */ static isAstDeclaration(kind: ts.SyntaxKind): boolean; /** * For the given symbol, follow imports and type alias to find the symbol that represents * the original definition. */ static followAliases(symbol: ts.Symbol, typeChecker: ts.TypeChecker): IFollowAliasesResult; /** * Helper function for _followAliases(), for handling ts.ExportDeclaration patterns */ private static _followAliasesForExportDeclaration(declaration, symbol, typeChecker); /** * Helper function for _followAliases(), for handling ts.ImportDeclaration patterns */ private static _followAliasesForImportDeclaration(declaration, symbol, typeChecker); private static _getPackagePathFromModuleSpecifier(moduleSpecifier); }