@@ -250,8 +250,8 @@ namespace ts {
250
250
let compilerOptions : CompilerOptions ; // Compiler options for compilation
251
251
let compilerHost : CompilerHost ; // Compiler host
252
252
let hostGetSourceFile : typeof compilerHost . getSourceFile ; // getSourceFile method from default host
253
- let timerHandleForRecompilation : number ; // Handle for 0.25s wait timer to trigger recompilation
254
- let timerHandleForDirectoryChanges : number ; // Handle for 0.25s wait timer to trigger directory change handler
253
+ let timerHandleForRecompilation : any ; // Handle for 0.25s wait timer to trigger recompilation
254
+ let timerHandleForDirectoryChanges : any ; // Handle for 0.25s wait timer to trigger directory change handler
255
255
256
256
// This map stores and reuses results of fileExists check that happen inside 'createProgram'
257
257
// This allows to save time in module resolution heavy scenarios when existence of the same file might be checked multiple times.
@@ -503,10 +503,14 @@ namespace ts {
503
503
}
504
504
505
505
function startTimerForHandlingDirectoryChanges ( ) {
506
+ if ( ! sys . setTimeout || ! sys . clearTimeout ) {
507
+ return ;
508
+ }
509
+
506
510
if ( timerHandleForDirectoryChanges ) {
507
- clearTimeout ( timerHandleForDirectoryChanges ) ;
511
+ sys . clearTimeout ( timerHandleForDirectoryChanges ) ;
508
512
}
509
- timerHandleForDirectoryChanges = setTimeout ( directoryChangeHandler , 250 ) ;
513
+ timerHandleForDirectoryChanges = sys . setTimeout ( directoryChangeHandler , 250 ) ;
510
514
}
511
515
512
516
function directoryChangeHandler ( ) {
@@ -525,10 +529,14 @@ namespace ts {
525
529
// operations (such as saving all modified files in an editor) a chance to complete before we kick
526
530
// off a new compilation.
527
531
function startTimerForRecompilation ( ) {
532
+ if ( ! sys . setTimeout || ! sys . clearTimeout ) {
533
+ return ;
534
+ }
535
+
528
536
if ( timerHandleForRecompilation ) {
529
- clearTimeout ( timerHandleForRecompilation ) ;
537
+ sys . clearTimeout ( timerHandleForRecompilation ) ;
530
538
}
531
- timerHandleForRecompilation = setTimeout ( recompile , 250 ) ;
539
+ timerHandleForRecompilation = sys . setTimeout ( recompile , 250 ) ;
532
540
}
533
541
534
542
function recompile ( ) {
0 commit comments