import { Node } from "ts-morph" ; export interface DiagnosticsInterface { identifiedInterfaces : number ; errors : string [ ] ; pushError ( message ) : void ; pushErrorAtLoc ( message , node ) : void ; warnings : string [ ] ; pushWarning ( message ) : void ; pushWarningAtLoc ( message , node ) : void ; } export class Diagnostics implements DiagnosticsInterface { identifiedInterfaces : number = 0 ; errors : string [ ] = [ ] ; warnings : string [ ] = [ ] ; constructor ( ) { } ; pushWarningAtLoc ( message , node ) { if ( node ) { const col = node . getSourceFile ( ) . compilerNode . getLineAndCharacterOfPosition ( node . getStart ( ) ) . character + 1 ; const line = node . getSourceFile ( ) . compilerNode . getLineAndCharacterOfPosition ( node . getStart ( ) ) . line + 1 ; this . pushWarning ( message + " at Line " + line + ", Col " + col + " Offset " + node . getStart ( ) ) ; } else { this . pushWarning ( message ) ; } } pushWarning ( message ) { this . warnings . push ( message ) ; } pushErrorAtLoc ( message , node ) { if ( node ) { const col = node . getSourceFile ( ) . compilerNode . getLineAndCharacterOfPosition ( node . getStart ( ) ) . character + 1 ; const line = node . getSourceFile ( ) . compilerNode . getLineAndCharacterOfPosition ( node . getStart ( ) ) . line + 1 ; this . pushWarning ( message + " at Line " + line + ", Col " + col + " Offset " + node . getStart ( ) ) ; } else { this . pushWarning ( message ) ; } } pushError ( message ) { this . warnings . push ( message ) ; } }