build/lib/treeshaking.ts/getTokenAtPosition
function getTokenAtPosition(ts: typeof import('typescript'), sourceFile: ts.SourceFile, position: number, allowPositionInLeadingTrivia: boolean, includeEndPosition: boolean): ts.Node {
	let current: ts.Node = sourceFile;
	outer: while (true) {
		// find the child that contains 'position'
		for (const child of current.getChildren()) {
			const start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile, /*includeJsDoc*/ true);
			if (start > position) {
				// If this child begins after position, then all subsequent children will as well.
				break;
			}

			const end = child.getEnd();
			if (position < end || (position === end && (child.kind === ts.SyntaxKind.EndOfFileToken || includeEndPosition))) {
				current = child;
				continue outer;
			}
		}

		return current;
	}
}