@xtrek/ts-migrate-plugins
Version:
Set of codemods, which are doing transformation of js/jsx to ts/tsx
10 lines (9 loc) • 411 B
TypeScript
import ts from 'typescript';
/**
* Returns the token whose text contains the position.
* If the position is past the end of the file, then it returns the file node itself.
*
* This function is adapted from TypeScript:
* https://github.com/microsoft/TypeScript/blob/v4.1.3/src/services/utilities.ts#L1095
*/
export default function getTokenAtPosition(sourceFile: ts.SourceFile, position: number): ts.Node;