@@ -138,7 +138,7 @@ export default class TypecheckWorker {
138138 private patchCompilerHostMethods (
139139 host : WatchCompilerHostOfConfigFile < SemanticDiagnosticsBuilderProgram >
140140 ) {
141- let { watchFile, watchDirectory, createProgram , afterProgramCreate = ( ) => { } } = host ;
141+ let { watchFile, watchDirectory, afterProgramCreate = ( ) => { } } = host ;
142142
143143 // Intercept tsc's `watchFile` to also invoke `mayTypecheck()` when a watched file changes
144144 host . watchFile = ( path , callback , pollingInterval ?) => {
@@ -167,14 +167,11 @@ export default class TypecheckWorker {
167167 ) ;
168168 } ;
169169
170- // Intercept `createProgram ` to invoke `willTypecheck` beforehand, as we know at this
171- // point that a new check is definitively happening .
172- host . createProgram = ( ... params ) => {
170+ // Intercept `afterProgramCreate ` to confirm when a suspected typecheck is happening
171+ // and schedule the new diagnostics to be emitted .
172+ host . afterProgramCreate = ( program ) => {
173173 this . willTypecheck ( ) ;
174- return createProgram . apply ( host , params ) ;
175- } ;
176174
177- host . afterProgramCreate = ( program ) => {
178175 // The `afterProgramCreate` callback will be invoked synchronously when we first call
179176 // `createWatchProgram`, meaning we can enter `didTypecheck` before we're fully set up
180177 // (e.g. before `compilerOptions` has been set). We use `nextTick` to ensure that
0 commit comments