jaydenseric / graphql-upload

Middleware and an Upload scalar to add support for GraphQL multipart requests (file uploads via queries and mutations) to various Node.js GraphQL servers.
https://npm.im/graphql-upload
MIT License
1.42k stars 131 forks source link

Failure to compile with Typescript project #341

Closed EricAnderson1000 closed 1 year ago

EricAnderson1000 commented 1 year ago

I have gone through the readme and I am still getting errors while building. I was wondering if you could point me to a resolution or file as an issue.

tsconfig.json

{
  "allowSyntheticDefaultImports": true,
  "compileOnSave": true,
  "compilerOptions": {
    "allowJs": true,
    "esModuleInterop": true,
    "target": "ES2021",
    "noImplicitAny": true,
    "noImplicitReturns": true,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "resolveJsonModule": true,
    "typeRoots": ["./types", "./node_modules/@types"],
    "sourceMap": true,
    "outDir": "dist/",
    "baseUrl": ".",
    "paths": {
      "*": ["node_modules/*"]
    },
    "maxNodeModuleJsDepth": 10,
    "module": "node16"
  },
  "include": ["src/**/*", "test/**/*"]
}

Output

$ tsc && cp -r ./static ./dist/
node_modules/graphql-upload/processRequest.mjs:384:7 - error TS2694: Namespace '"/server/node_modules/fs-capacitor/dist/index"' has no exported member 'ReadStreamOptions'.

384  *   .ReadStreamOptions["encoding"]} [options.encoding] Specify an encoding for
          ~~~~~~~~~~~~~~~~~

node_modules/graphql-upload/processRequest.mjs:393:7 - error TS2694: Namespace '"/server/node_modules/fs-capacitor/dist/index"' has no exported member 'ReadStreamOptions'.

393  *   .ReadStreamOptions["highWaterMark"]} [options.highWaterMark] Maximum number
          ~~~~~~~~~~~~~~~~~

Found 2 errors in the same file, starting at: node_modules/graphql-upload/processRequest.mjs:384
node --version
v16.15.0
jaydenseric commented 1 year ago

"moduleResolution": "node" is the problem; either delete it and let "module": "node16" set the module resolution mode or explicitly set it to "moduleResolution": "node16". See:

https://www.typescriptlang.org/tsconfig#moduleResolution