Skip to content

Conversation

@takashiski
Copy link
Contributor

**/
@: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