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

Cannot find type definition file for 'fs-capacitor'. #382

Closed rescandonvov closed 5 months ago

rescandonvov commented 5 months ago

Recently, I tried to install graphql-upload@9.0.0 and @types/graphql-upload@8.0.3 on a minimal Typescript project. Then, I ran the build command and I got this conflict.

$ tsc
error TS2688: Cannot find type definition file for 'fs-capacitor'.
  The file is in the program because:
    Entry point for implicit type library 'fs-capacitor'

Found 1 error.

Why does it happen? Do you know how I could fix it? I wouldn't like to install the higher graphql-upload version due to the complexity of installing it

This is my package.json

{
  "name": "graphql-upload-test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "build": "tsc",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "typescript": "4.9.5",
    "@types/graphql-upload": "8.0.3"
  },
  "dependencies": {
    "graphql-upload": "9.0.0"
  }
}

My tsconfig.json

{
  "compilerOptions": {
    /* Basic Options */
    "allowJs": false,
    "baseUrl": ".",
    "esModuleInterop": true,
    "lib": [
      "dom",
      "es5",
      "es2015.promise"
    ],
    "module": "commonjs",
    "moduleResolution": "node",
    "noImplicitAny": true,
    "outDir": "./bin",
    "resolveJsonModule": true,
    "rootDir": ".",
    "skipLibCheck": true,
    "sourceMap": true,
    "target": "esnext",
  },
  "include": ["src", "test"],
}

nodejs: 20.10.0 os: Mac M1

jaydenseric commented 5 months ago

Recent versions of graphql-upload has it's own built in types, via TypeScript flavour JSDoc comments in the published modules. @types/graphql-upload shouldn't be installed anymore in projects; they are likely to cause you problems.

You can see the requirements for getting types to work properly documented here:

https://github.com/jaydenseric/graphql-upload/blob/v16.0.2/readme.md#requirements