Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix mkdir and mkdirSync options #175

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

takashiski
Copy link
Contributor

@@ -695,12 +703,12 @@ extern class Fs {
`mode` defaults to 0777.
**/
@:overload(function(path:FsPath, callback:Error->Void):Void {})
static function mkdir(path:FsPath, mode:FsMode, callback:Error->Void):Void;
static function mkdir(path:FsPath, options:FsMakeDirOptions, callback:Error->Void):Void;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The optional options argument can be an integer specifying mode (permission and sticky bits), or an object with a mode property and a recursive property indicating whether parent directories should be created.

Shouldn't we do EitherType<FsMode, FsMakeDirOptions>?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, there's more to it:

The callback is given a possible exception and, if recursive is true, the first directory path created, (err, [path]).

and

Returns undefined, or if recursive is true, the first directory path created.

for mkdirSync

It's a bit tricky to have proper typing for this, so we can ignore this for now, but we'll have to look into this at some point. Maybe some @:overload trick can be used for that.

/**
* options for `Fs.mkdir` and `Fs.mkdirSync`
*/
typedef FsMakeDirOptions = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be called FsMkdirOptions to be consistent with the function names :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants