I know that we can get the position of a node using node.pos but is there a way of getting the line number of the node? Something like node.lineNumber?
I know that we can get the position of a node using node.pos but is there a way of getting the line number of the node? Something like node.lineNumber?
let { line, character } =
sourceFile.getLineAndCharacterOfPosition(node.getStart());
console.log(`${sourceFile.fileName} (${line + 1},${character + 1}):
${message}`);
From here:
https://github.com/Microsoft/TypeScript-wiki/blob/master/Using-the-Compiler-API.md