File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 1- // tslint:disable no-unnecessary-type-assertion (TODO: tslint can't find node types)
2-
31namespace ts . server . typingsInstaller {
42 const fs : {
53 appendFileSync ( file : string , content : string ) : void
@@ -12,19 +10,20 @@ namespace ts.server.typingsInstaller {
1210 } = require ( "path" ) ;
1311
1412 class FileLog implements Log {
15- private logEnabled = true ;
16- constructor ( private readonly logFile ?: string ) {
13+ constructor ( private logFile : string | undefined ) {
1714 }
1815
1916 isEnabled = ( ) => {
20- return this . logEnabled && this . logFile !== undefined ;
17+ return typeof this . logFile === "string" ;
2118 }
2219 writeLine = ( text : string ) => {
20+ if ( typeof this . logFile !== "string" ) return ;
21+
2322 try {
24- fs . appendFileSync ( this . logFile ! , `[${ nowString ( ) } ] ${ text } ${ sys . newLine } ` ) ; // TODO: GH#18217
23+ fs . appendFileSync ( this . logFile , `[${ nowString ( ) } ] ${ text } ${ sys . newLine } ` ) ;
2524 }
2625 catch ( e ) {
27- this . logEnabled = false ;
26+ this . logFile = undefined ;
2827 }
2928 }
3029 }
You can’t perform that action at this time.
0 commit comments