From 415a186553bbf575d3447622a1a309b0665e0e14 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Sun, 7 Jul 2019 14:19:18 +1200 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20refactor=20`#watch`=20to?= =?UTF-8?q?=20be=20compatible=20w/=20`strictNullChecks`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/volume.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/volume.ts b/src/volume.ts index 55049cce..59513fdb 100644 --- a/src/volume.ts +++ b/src/volume.ts @@ -2102,14 +2102,15 @@ export class Volume { listener?: (eventType: string, filename: string) => void, ): FSWatcher { const filename = pathToFilename(path); + let givenOptions: (typeof options) | null = options; if (typeof options === 'function') { listener = options; - options = null; + givenOptions = null; } // tslint:disable-next-line prefer-const - let { persistent, recursive, encoding }: IWatchOptions = getDefaultOpts(options); + let { persistent, recursive, encoding }: IWatchOptions = getDefaultOpts(givenOptions); if (persistent === undefined) persistent = true; if (recursive === undefined) recursive = false;