memfs icon indicating copy to clipboard operation
memfs copied to clipboard

Support building with newer @types/node module

Open pravi opened this issue 3 years ago • 1 comments

We'd like to build memfs module in debian with newer version of @types/node module, but build fails with this error. Please update build dependency on @types/node to at least 12.20.4.

$ yarnpkg upgrade @types/[email protected]
yarn upgrade v1.22.10
warning ../../../../package.json: No license field
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning "jest > @jest/core > jest-config > [email protected]" has incorrect peer dependency "@babel/core@^7.8.0".
warning " > [email protected]" has incorrect peer dependency "typescript@^3.0.1".
[5/5] Rebuilding all packages...
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ @types/[email protected]
info All dependencies
└─ @types/[email protected]
Done in 8.13s.
(debian-sid)pravi@mahishi:~/forge/js-team/upstream/memfs$ yarnpkg build
yarn run v1.22.10
warning ../../../../package.json: No license field
$ tsc -p . && cpy src/*.js lib
src/volume.ts:433:15 - error TS2769: No overload matches this call.
  Overload 1 of 5, '(arrayBuffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number | undefined, length?: number | undefined): Buffer', gave the following error.
    Argument of type 'string' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'.
  Overload 2 of 5, '(obj: { valueOf(): string | object; } | { [Symbol.toPrimitive](hint: "string"): string; }, byteOffset?: number | undefined, length?: number | undefined): Buffer', gave the following error.
    Argument of type 'string' is not assignable to parameter of type 'number | undefined'.
  Overload 3 of 5, '(str: string, encoding?: BufferEncoding | undefined): Buffer', gave the following error.
    Argument of type 'string' is not assignable to parameter of type 'BufferEncoding | undefined'.

433   else return bufferFrom(String(data), encoding);
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Found 1 error.

error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

pravi avatar Jun 11 '21 16:06 pravi

I'm not sure if we actually want to be doing this because we target Node 4+, and what our dependency is for building shouldn't matter to downstream consumers since its not a "runtime" dependency (granted with @types/node that can get a bit fuzzy depending on what types we use, but we shouldn't be using a lot of actual types from there).

Is there any reason why you're wanting to use @types/node v12 to build this library, other than "it's a later version"?

G-Rath avatar Nov 03 '22 18:11 G-Rath