diff --git a/src/volume.ts b/src/volume.ts index 3ca91150..b624e625 100644 --- a/src/volume.ts +++ b/src/volume.ts @@ -337,7 +337,7 @@ const mkdirDefaults: IMkdirOptions = { mode: MODE.DIR, recursive: false, }; -const getMkdirOptions = options => { +const getMkdirOptions = (options): IMkdirOptions => { if (typeof options === 'number') return extend({}, mkdirDefaults, { mode: options }); return extend({}, mkdirDefaults, options); }; @@ -1848,8 +1848,9 @@ export class Volume { mkdir(path: TFilePath, callback: TCallback); mkdir(path: TFilePath, mode: TMode | IMkdirOptions, callback: TCallback); mkdir(path: TFilePath, a: TCallback | TMode | IMkdirOptions, b?: TCallback) { - const [options, callback] = getArgAndCb(a, b); - const opts = getMkdirOptions(options); + const opts: TMode | IMkdirOptions = getMkdirOptions(a); + const callback: TCallback = validateCallback(typeof a === 'function' ? a : b); + const modeNum = modeToNumber(opts.mode, 0o777); const filename = pathToFilename(path); if (opts.recursive) this.wrapAsync(this.mkdirpBase, [filename, modeNum], callback);