From 0b0760c8f4d8df4f578da33c0e6d23923f68a1bf Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Mon, 9 Mar 2020 16:17:43 -0700 Subject: [PATCH] fix: lint errors --- .../src/create-program/createWatchProgram.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/typescript-estree/src/create-program/createWatchProgram.ts b/packages/typescript-estree/src/create-program/createWatchProgram.ts index 836afbc2b5e..134e8355098 100644 --- a/packages/typescript-estree/src/create-program/createWatchProgram.ts +++ b/packages/typescript-estree/src/create-program/createWatchProgram.ts @@ -316,16 +316,19 @@ 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); + return callback; }; - 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); };