From f2ea3f1c7aa094243cc916c5f8fe716efc6c9b11 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Thu, 11 Jul 2019 18:46:34 +1200 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20refactor=20`#ftruncate`?= =?UTF-8?q?=20to=20be=20compatible=20w/=20`strictNullChecks`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/volume.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/volume.ts b/src/volume.ts index a9edcf52..3ca91150 100644 --- a/src/volume.ts +++ b/src/volume.ts @@ -1733,7 +1733,9 @@ export class Volume { ftruncate(fd: number, callback: TCallback); ftruncate(fd: number, len: number, callback: TCallback); ftruncate(fd: number, a: TCallback | number, b?: TCallback) { - const [len, callback] = getArgAndCb(a, b); + const len: number = typeof a === 'number' ? a : 0; + const callback: TCallback = validateCallback(typeof a === 'number' ? b : a); + this.wrapAsync(this.ftruncateBase, [fd, len], callback); }