Skip to content

Commit

Permalink
fix: 🐛 refactor #write to be compatible w/ strictNullChecks
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Jul 6, 2019
1 parent 87b587f commit 2ba6e0f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/volume.ts
Expand Up @@ -1150,10 +1150,10 @@ export class Volume {
validateFd(fd);

let offset: number;
let length: number;
let length: number | undefined;
let position: number;
let encoding: TEncoding;
let callback: (...args) => void;
let encoding: TEncoding | undefined;
let callback: ((...args) => void) | undefined;

const tipa = typeof a;
const tipb = typeof b;
Expand Down Expand Up @@ -1198,18 +1198,18 @@ export class Volume {
length = buf.length;
}

validateCallback(callback);
const cb = validateCallback(callback);

setImmediate(() => {
try {
const bytes = this.writeBase(fd, buf, offset, length, position);
if (tipa !== 'string') {
callback(null, bytes, buf);
cb(null, bytes, buf);
} else {
callback(null, bytes, a);
cb(null, bytes, a);
}
} catch (err) {
callback(err);
cb(err);
}
});
}
Expand Down

0 comments on commit 2ba6e0f

Please sign in to comment.