[make-dir] add more specific type to fs config option (#18286)

This commit is contained in:
Dimitri Benin
2017-07-21 18:40:26 +02:00
committed by Wesley Wigham
parent 168bb317b1
commit b33275b2f4
2 changed files with 11 additions and 1 deletions

View File

@@ -1,8 +1,12 @@
// Type definitions for make-dir 1.0
// Project: https://github.com/sindresorhus/make-dir
// Definitions by: Ika <https://github.com/ikatyang>
// BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node"/>
import * as fs from 'fs';
export = makeDir;
/**
@@ -33,6 +37,6 @@ declare namespace makeDir {
*
* Use a custom `fs` implementation. For example [`graceful-fs`](https://github.com/isaacs/node-graceful-fs).
*/
fs?: any;
fs?: typeof fs;
}
}

View File

@@ -1,7 +1,13 @@
import makeDir = require('make-dir');
import * as fs from 'fs';
import * as gfs from 'graceful-fs';
makeDir('path/to/somewhere').then(dirname => {
// do something
});
const dirname = makeDir.sync('path/to/somewhere');
makeDir('path/to/somewhere', {mode: parseInt('777', 8)});
makeDir('path/to/somewhere', {fs});
makeDir('path/to/somewhere', {fs: gfs});