From 1998b24e65d68ae95183382ed6ed400acf57c535 Mon Sep 17 00:00:00 2001 From: streamich Date: Tue, 26 Nov 2019 14:09:21 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20enable=20TypeScript=20st?= =?UTF-8?q?rict=20null=20checks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BREAKING CHANGE: TypeScript strict null checks are now enabled which may break some TypeScript users. --- src/node.ts | 2 +- src/volume.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/node.ts b/src/node.ts index 73a5630d..99c50097 100644 --- a/src/node.ts +++ b/src/node.ts @@ -300,7 +300,7 @@ export class Link extends EventEmitter { this.emit('child:delete', link, this); } - getChild(name: string): Link { + getChild(name: string): Link | undefined { if (Object.hasOwnProperty.call(this.children, name)) { return this.children[name]; } diff --git a/src/volume.ts b/src/volume.ts index fa3c453f..127cebda 100644 --- a/src/volume.ts +++ b/src/volume.ts @@ -1415,7 +1415,7 @@ export class Volume { private realpathBase(filename: string, encoding: TEncodingExtended | undefined): TDataOut { const steps = filenameToSteps(filename); const realLink = this.getResolvedLink(steps); - if (!realLink) throwError(ENOENT, 'realpath', filename); + if (!realLink) throw createError(ENOENT, 'realpath', filename); return strToEncoding(realLink.getPath(), encoding); } @@ -1459,7 +1459,7 @@ export class Volume { private statBase(filename: string, bigint: true): Stats; private statBase(filename: string, bigint: boolean = false): Stats { const link = this.getResolvedLink(filenameToSteps(filename)); - if (!link) throwError(ENOENT, 'stat', filename); + if (!link) throw createError(ENOENT, 'stat', filename); return Stats.build(link.getNode(), bigint); }