Skip to content

Commit

Permalink
fix: lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sheetalkamat committed Mar 9, 2020
1 parent 054204a commit f7c6b65
Showing 1 changed file with 6 additions and 4 deletions.
Expand Up @@ -316,16 +316,18 @@ function createWatchProgram(
// But because of https://github.com/microsoft/TypeScript/pull/37308 we cannot just set it to undefined
// instead save it and call before getProgram is called
let callback: (() => void) | undefined;
watchCompilerHost.setTimeout = (cb, _ms, ...args) => {
watchCompilerHost.setTimeout = (cb, _ms, ...args): unknown => {
callback = cb.bind(/*this*/ undefined, ...args);
};
watchCompilerHost.clearTimeout = () => {
watchCompilerHost.clearTimeout = (): void => {
callback = undefined;
};
const watch = ts.createWatchProgram(watchCompilerHost);
const originalGetProgram = watch.getProgram;
watch.getProgram = () => {
if (callback) callback();
watch.getProgram = (): ts.SemanticDiagnosticsBuilderProgram => {
if (callback) {
callback();
}
callback = undefined;
return originalGetProgram.call(watch);
};
Expand Down

0 comments on commit f7c6b65

Please sign in to comment.