diff --git a/src/harness/typeWriter.ts b/src/harness/typeWriter.ts index 44532c6a59e..30ff313ca67 100644 --- a/src/harness/typeWriter.ts +++ b/src/harness/typeWriter.ts @@ -85,15 +85,17 @@ class TypeWriterWalker { private log(node: ts.Node, type: ts.Type): void { var actualPos = ts.skipTrivia(this.currentSourceFile.text, node.pos); - var lineAndCharacter = this.currentSourceFile.getOneBasedLineAndCharacterOfPosition(actualPos); + var lineAndCharacter = this.currentSourceFile.getZeroBasedLineAndCharacterOfPosition(actualPos); var sourceText = ts.getTextOfNodeFromSourceText(this.currentSourceFile.text, node); // If we got an unknown type, we temporarily want to fall back to just pretending the name // (source text) of the node is the type. This is to align with the old typeWriter to make // baseline comparisons easier. In the long term, we will want to just call typeToString this.results.push({ - line: lineAndCharacter.line - 1, - column: lineAndCharacter.character, + line: lineAndCharacter.line, + // todo(cyrusn): Not sure why column is one-based for type-writer. But I'm preserving + // that behavior to prevent having a lot of baselines to fix up. + column: lineAndCharacter.character + 1, syntaxKind: node.kind, sourceText: sourceText, type: this.checker.typeToString(type, node.parent, ts.TypeFormatFlags.NoTruncation | ts.TypeFormatFlags.WriteOwnNameForAnyLike)