File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -85,15 +85,17 @@ class TypeWriterWalker {
8585
8686 private log ( node : ts . Node , type : ts . Type ) : void {
8787 var actualPos = ts . skipTrivia ( this . currentSourceFile . text , node . pos ) ;
88- var lineAndCharacter = this . currentSourceFile . getOneBasedLineAndCharacterOfPosition ( actualPos ) ;
88+ var lineAndCharacter = this . currentSourceFile . getZeroBasedLineAndCharacterOfPosition ( actualPos ) ;
8989 var sourceText = ts . getTextOfNodeFromSourceText ( this . currentSourceFile . text , node ) ;
9090
9191 // If we got an unknown type, we temporarily want to fall back to just pretending the name
9292 // (source text) of the node is the type. This is to align with the old typeWriter to make
9393 // baseline comparisons easier. In the long term, we will want to just call typeToString
9494 this . results . push ( {
95- line : lineAndCharacter . line - 1 ,
96- column : lineAndCharacter . character ,
95+ line : lineAndCharacter . line ,
96+ // todo(cyrusn): Not sure why column is one-based for type-writer. But I'm preserving
97+ // that behavior to prevent having a lot of baselines to fix up.
98+ column : lineAndCharacter . character + 1 ,
9799 syntaxKind : node . kind ,
98100 sourceText : sourceText ,
99101 type : this . checker . typeToString ( type , node . parent , ts . TypeFormatFlags . NoTruncation | ts . TypeFormatFlags . WriteOwnNameForAnyLike )
You can’t perform that action at this time.
0 commit comments