You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try to use a memfsVolume I get the following errors:
With strict mode:
Argument of type 'Volume' is not assignable to parameter of type 'IFS'.
Types of property 'ftruncateSync' are incompatible.
Type '(fd: number, len?: number | undefined) => void' is not assignable to type '(fd: number, len?: number | null | undefined) => void'.
Types of parameters 'len' and 'len' are incompatible.
Type 'number | null | undefined' is not assignable to type 'number | undefined'.
Type 'null' is not assignable to type 'number | undefined'.ts(2345)
Without strict mode:
Argument of type 'Volume' is not assignable to parameter of type 'IFS'.
The types returned by 'statSync(...)' are incompatible between these types.
Type 'Stats<number>' is missing the following properties from type 'BigIntStats': atimeNs, mtimeNs, ctimeNs, birthtimeNsts(2345)
The text was updated successfully, but these errors were encountered:
Yeah unfortunately fixing this is pretty complicated; doubly so when you factor in the different versions of @types/node.
It's best just to cast: either when calling use or if you're keeping the Volume around assign it as an fs:
ufs
.use(jest.requireActual('fs'))
.use(createFsFromVolume(vol) as any) as any;
const myVolume: typeof fs = (createFsFromVolume(vol) as unknown) as typeof fs;
When I have a chance I'll revisit, but any solution will likely be a breaking change, or at least need a lot of testing & review :(
When I try to
use
amemfs
Volume
I get the following errors:With strict mode:
Without strict mode:
The text was updated successfully, but these errors were encountered: