@@ -228,9 +228,8 @@ namespace ts.textChanges {
228228 /** Public for tests only. Other callers should use `ChangeTracker.with`. */
229229 constructor ( private readonly newLineCharacter : string , private readonly formatContext : formatting . FormatContext ) { }
230230
231- public deleteRange ( sourceFile : SourceFile , range : TextRange ) {
231+ public deleteRange ( sourceFile : SourceFile , range : TextRange ) : void {
232232 this . changes . push ( { kind : ChangeKind . Remove , sourceFile, range } ) ;
233- return this ;
234233 }
235234
236235 delete ( sourceFile : SourceFile , node : Node | NodeArray < TypeParameterDeclaration > ) : void {
@@ -241,11 +240,10 @@ namespace ts.textChanges {
241240 this . deleteRange ( sourceFile , { pos : modifier . getStart ( sourceFile ) , end : skipTrivia ( sourceFile . text , modifier . end , /*stopAfterLineBreak*/ true ) } ) ;
242241 }
243242
244- public deleteNodeRange ( sourceFile : SourceFile , startNode : Node , endNode : Node , options : ConfigurableStartEnd = { } ) {
243+ public deleteNodeRange ( sourceFile : SourceFile , startNode : Node , endNode : Node , options : ConfigurableStartEnd = { } ) : void {
245244 const startPosition = getAdjustedStartPosition ( sourceFile , startNode , options , Position . FullStart ) ;
246245 const endPosition = getAdjustedEndPosition ( sourceFile , endNode , options ) ;
247246 this . deleteRange ( sourceFile , { pos : startPosition , end : endPosition } ) ;
248- return this ;
249247 }
250248
251249 public deleteNodeRangeExcludingEnd ( sourceFile : SourceFile , startNode : Node , afterEndNode : Node | undefined , options : ConfigurableStartEnd = { } ) : void {
@@ -254,47 +252,45 @@ namespace ts.textChanges {
254252 this . deleteRange ( sourceFile , { pos : startPosition , end : endPosition } ) ;
255253 }
256254
257- public replaceRange ( sourceFile : SourceFile , range : TextRange , newNode : Node , options : InsertNodeOptions = { } ) {
255+ public replaceRange ( sourceFile : SourceFile , range : TextRange , newNode : Node , options : InsertNodeOptions = { } ) : void {
258256 this . changes . push ( { kind : ChangeKind . ReplaceWithSingleNode , sourceFile, range, options, node : newNode } ) ;
259- return this ;
260257 }
261258
262- public replaceNode ( sourceFile : SourceFile , oldNode : Node , newNode : Node , options : ChangeNodeOptions = useNonAdjustedPositions ) {
263- return this . replaceRange ( sourceFile , getAdjustedRange ( sourceFile , oldNode , oldNode , options ) , newNode , options ) ;
259+ public replaceNode ( sourceFile : SourceFile , oldNode : Node , newNode : Node , options : ChangeNodeOptions = useNonAdjustedPositions ) : void {
260+ this . replaceRange ( sourceFile , getAdjustedRange ( sourceFile , oldNode , oldNode , options ) , newNode , options ) ;
264261 }
265262
266- public replaceNodeRange ( sourceFile : SourceFile , startNode : Node , endNode : Node , newNode : Node , options : ChangeNodeOptions = useNonAdjustedPositions ) {
263+ public replaceNodeRange ( sourceFile : SourceFile , startNode : Node , endNode : Node , newNode : Node , options : ChangeNodeOptions = useNonAdjustedPositions ) : void {
267264 this . replaceRange ( sourceFile , getAdjustedRange ( sourceFile , startNode , endNode , options ) , newNode , options ) ;
268265 }
269266
270- private replaceRangeWithNodes ( sourceFile : SourceFile , range : TextRange , newNodes : ReadonlyArray < Node > , options : ReplaceWithMultipleNodesOptions & ConfigurableStartEnd = { } ) {
267+ private replaceRangeWithNodes ( sourceFile : SourceFile , range : TextRange , newNodes : ReadonlyArray < Node > , options : ReplaceWithMultipleNodesOptions & ConfigurableStartEnd = { } ) : void {
271268 this . changes . push ( { kind : ChangeKind . ReplaceWithMultipleNodes , sourceFile, range, options, nodes : newNodes } ) ;
272- return this ;
273269 }
274270
275- public replaceNodeWithNodes ( sourceFile : SourceFile , oldNode : Node , newNodes : ReadonlyArray < Node > , options : ChangeNodeOptions = useNonAdjustedPositions ) {
276- return this . replaceRangeWithNodes ( sourceFile , getAdjustedRange ( sourceFile , oldNode , oldNode , options ) , newNodes , options ) ;
271+ public replaceNodeWithNodes ( sourceFile : SourceFile , oldNode : Node , newNodes : ReadonlyArray < Node > , options : ChangeNodeOptions = useNonAdjustedPositions ) : void {
272+ this . replaceRangeWithNodes ( sourceFile , getAdjustedRange ( sourceFile , oldNode , oldNode , options ) , newNodes , options ) ;
277273 }
278274
279275 public replaceNodeWithText ( sourceFile : SourceFile , oldNode : Node , text : string ) : void {
280276 this . replaceRangeWithText ( sourceFile , getAdjustedRange ( sourceFile , oldNode , oldNode , useNonAdjustedPositions ) , text ) ;
281277 }
282278
283- public replaceNodeRangeWithNodes ( sourceFile : SourceFile , startNode : Node , endNode : Node , newNodes : ReadonlyArray < Node > , options : ReplaceWithMultipleNodesOptions & ConfigurableStartEnd = useNonAdjustedPositions ) {
284- return this . replaceRangeWithNodes ( sourceFile , getAdjustedRange ( sourceFile , startNode , endNode , options ) , newNodes , options ) ;
279+ public replaceNodeRangeWithNodes ( sourceFile : SourceFile , startNode : Node , endNode : Node , newNodes : ReadonlyArray < Node > , options : ReplaceWithMultipleNodesOptions & ConfigurableStartEnd = useNonAdjustedPositions ) : void {
280+ this . replaceRangeWithNodes ( sourceFile , getAdjustedRange ( sourceFile , startNode , endNode , options ) , newNodes , options ) ;
285281 }
286282
287283 private nextCommaToken ( sourceFile : SourceFile , node : Node ) : Node | undefined {
288284 const next = findNextToken ( node , node . parent , sourceFile ) ;
289285 return next && next . kind === SyntaxKind . CommaToken ? next : undefined ;
290286 }
291287
292- public replacePropertyAssignment ( sourceFile : SourceFile , oldNode : PropertyAssignment , newNode : PropertyAssignment ) {
288+ public replacePropertyAssignment ( sourceFile : SourceFile , oldNode : PropertyAssignment , newNode : PropertyAssignment ) : void {
293289 const suffix = this . nextCommaToken ( sourceFile , oldNode ) ? "" : ( "," + this . newLineCharacter ) ;
294- return this . replaceNode ( sourceFile , oldNode , newNode , { suffix } ) ;
290+ this . replaceNode ( sourceFile , oldNode , newNode , { suffix } ) ;
295291 }
296292
297- public insertNodeAt ( sourceFile : SourceFile , pos : number , newNode : Node , options : InsertNodeOptions = { } ) {
293+ public insertNodeAt ( sourceFile : SourceFile , pos : number , newNode : Node , options : InsertNodeOptions = { } ) : void {
298294 this . replaceRange ( sourceFile , createRange ( pos ) , newNode , options ) ;
299295 }
300296
@@ -310,7 +306,7 @@ namespace ts.textChanges {
310306 } ) ;
311307 }
312308
313- public insertNodeBefore ( sourceFile : SourceFile , before : Node , newNode : Node , blankLineBetween = false ) {
309+ public insertNodeBefore ( sourceFile : SourceFile , before : Node , newNode : Node , blankLineBetween = false ) : void {
314310 this . insertNodeAt ( sourceFile , getAdjustedStartPosition ( sourceFile , before , { } , Position . Start ) , newNode , this . getOptionsForInsertNodeBefore ( before , blankLineBetween ) ) ;
315311 }
316312
@@ -343,7 +339,7 @@ namespace ts.textChanges {
343339 this . insertText ( sourceFile , token . getStart ( sourceFile ) , text ) ;
344340 }
345341
346- public insertJsdocCommentBefore ( sourceFile : SourceFile , node : HasJSDoc , tag : JSDoc ) {
342+ public insertJsdocCommentBefore ( sourceFile : SourceFile , node : HasJSDoc , tag : JSDoc ) : void {
347343 const fnStart = node . getStart ( sourceFile ) ;
348344 if ( node . jsDoc ) {
349345 for ( const jsdoc of node . jsDoc ) {
@@ -358,7 +354,7 @@ namespace ts.textChanges {
358354 this . insertNodeAt ( sourceFile , fnStart , tag , { preserveLeadingWhitespace : false , suffix : this . newLineCharacter + indent } ) ;
359355 }
360356
361- public replaceRangeWithText ( sourceFile : SourceFile , range : TextRange , text : string ) {
357+ public replaceRangeWithText ( sourceFile : SourceFile , range : TextRange , text : string ) : void {
362358 this . changes . push ( { kind : ChangeKind . Text , sourceFile, range, text } ) ;
363359 }
364360
@@ -500,7 +496,7 @@ namespace ts.textChanges {
500496 return endPosition ;
501497 }
502498
503- private getInsertNodeAfterOptions ( sourceFile : SourceFile , after : Node ) {
499+ private getInsertNodeAfterOptions ( sourceFile : SourceFile , after : Node ) : InsertNodeOptions {
504500 const options = this . getInsertNodeAfterOptionsWorker ( after ) ;
505501 return {
506502 ...options ,
@@ -571,14 +567,14 @@ namespace ts.textChanges {
571567 * i.e. arguments in arguments lists, parameters in parameter lists etc.
572568 * Note that separators are part of the node in statements and class elements.
573569 */
574- public insertNodeInListAfter ( sourceFile : SourceFile , after : Node , newNode : Node , containingList = formatting . SmartIndenter . getContainingList ( after , sourceFile ) ) {
570+ public insertNodeInListAfter ( sourceFile : SourceFile , after : Node , newNode : Node , containingList = formatting . SmartIndenter . getContainingList ( after , sourceFile ) ) : void {
575571 if ( ! containingList ) {
576572 Debug . fail ( "node is not a list element" ) ;
577- return this ;
573+ return ;
578574 }
579575 const index = indexOfNode ( containingList , after ) ;
580576 if ( index < 0 ) {
581- return this ;
577+ return ;
582578 }
583579 const end = after . getEnd ( ) ;
584580 if ( index !== containingList . length - 1 ) {
@@ -680,7 +676,6 @@ namespace ts.textChanges {
680676 this . replaceRange ( sourceFile , createRange ( end ) , newNode , { prefix : `${ tokenToString ( separator ) } ` } ) ;
681677 }
682678 }
683- return this ;
684679 }
685680
686681 private finishClassesWithNodesInsertedAtStart ( ) : void {
@@ -734,7 +729,7 @@ namespace ts.textChanges {
734729 return changes ;
735730 }
736731
737- public createNewFile ( oldFile : SourceFile | undefined , fileName : string , statements : ReadonlyArray < Statement > ) {
732+ public createNewFile ( oldFile : SourceFile | undefined , fileName : string , statements : ReadonlyArray < Statement > ) : void {
738733 this . newFiles . push ( { oldFile, fileName, statements } ) ;
739734 }
740735 }
0 commit comments