memfs icon indicating copy to clipboard operation
memfs copied to clipboard

Typing mismatch between fs.mkdir and memfs.mkdir

Open chmac opened this issue 5 years ago • 1 comments

Firstly and most importantly, huge thanks for this package, it's awesome.

I tried to drop in the output from createFsFromVolume() instead of the native fs and I hit a snag. There's a minor typing mismatch.

Conversion of type 'IFs' to type 'FS' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
  The types returned by 'promises.mkdir(...)' are incompatible between these types.
    Type 'Promise<void>' is not comparable to type 'Promise<string>'.
      Type 'void' is not comparable to type 'string'.ts(2352)

Looking into this a little, the node fs.mkdir and fs.promises.mkdir optionally return the path to the first directory created when the recursive: true option is set. While memfs.mkdir always returns void.

chmac avatar Jun 05 '20 11:06 chmac

Just ran into this exact issue myself while creating some unit tests.

chet-manley avatar Oct 23 '20 01:10 chet-manley

:tada: This issue has been resolved in version 3.4.12 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

streamich avatar Nov 19 '22 21:11 streamich