UNPKG

@xtrek/ts-migrate-plugins

Version:

Set of codemods, which are doing transformation of js/jsx to ts/tsx

25 lines (24 loc) 844 B
import ts from 'typescript'; export declare type KnownDefinitionMap = { [key: string]: { pos: number; end: number; }; }; /** * Recursively finds all identifier nodes within/including a given node * Note: this requires parent nodes to be set because it relies on generic parent - child relationships. * @param root */ export declare function collectIdentifierNodes(root: ts.Node): ts.Identifier[]; /** * Returns a set of all the identifier names within the given source file * @param sourceFile */ export declare function collectIdentifiers(sourceFile: ts.SourceFile): Set<string>; /** * Finds known imports * @param sourceFile */ export declare function findKnownImports(sourceFile: ts.SourceFile): KnownDefinitionMap; export declare function findKnownVariables(sourceFile: ts.SourceFile): KnownDefinitionMap;