Skip to content

Commit

Permalink
fix: πŸ› refactor #watch to be compatible w/ strictNullChecks
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Jul 7, 2019
1 parent 2c02287 commit 415a186
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/volume.ts
Expand Up @@ -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;

Expand Down

0 comments on commit 415a186

Please sign in to comment.