Skip to content

Commit

Permalink
fix: πŸ› refactor #ftruncate to be compatible w/ strictNullChecks
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Jul 11, 2019
1 parent 4148ad3 commit f2ea3f1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/volume.ts
Expand Up @@ -1733,7 +1733,9 @@ export class Volume {
ftruncate(fd: number, callback: TCallback<void>);
ftruncate(fd: number, len: number, callback: TCallback<void>);
ftruncate(fd: number, a: TCallback<void> | number, b?: TCallback<void>) {
const [len, callback] = getArgAndCb<number, void>(a, b);
const len: number = typeof a === 'number' ? a : 0;
const callback: TCallback<void> = validateCallback(typeof a === 'number' ? b : a);

this.wrapAsync(this.ftruncateBase, [fd, len], callback);
}

Expand Down

0 comments on commit f2ea3f1

Please sign in to comment.