@@ -138,7 +138,7 @@ export default class TypecheckWorker {
138
138
private patchCompilerHostMethods (
139
139
host : WatchCompilerHostOfConfigFile < SemanticDiagnosticsBuilderProgram >
140
140
) {
141
- let { watchFile, watchDirectory, createProgram , afterProgramCreate = ( ) => { } } = host ;
141
+ let { watchFile, watchDirectory, afterProgramCreate = ( ) => { } } = host ;
142
142
143
143
// Intercept tsc's `watchFile` to also invoke `mayTypecheck()` when a watched file changes
144
144
host . watchFile = ( path , callback , pollingInterval ?) => {
@@ -167,14 +167,11 @@ export default class TypecheckWorker {
167
167
) ;
168
168
} ;
169
169
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 ) => {
173
173
this . willTypecheck ( ) ;
174
- return createProgram . apply ( host , params ) ;
175
- } ;
176
174
177
- host . afterProgramCreate = ( program ) => {
178
175
// The `afterProgramCreate` callback will be invoked synchronously when we first call
179
176
// `createWatchProgram`, meaning we can enter `didTypecheck` before we're fully set up
180
177
// (e.g. before `compilerOptions` has been set). We use `nextTick` to ensure that
0 commit comments