Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeGraphql graphql upload import cannot be found

Goal

I'm making a project with TypeGraphql and i want to implement user profile picture.

Problem

When i try to import:

import { GraphQLUpload, FileUpload } from "graphql-upload";

docker container log returns:

src/resolvers/user.resolver.ts(25,43): error TS2307: Cannot find module 'graphql-upload' or its corresponding type declarations. `

Tsconfig

{
  "compilerOptions": {
    "target": "es2017",
    "module": "commonjs",
    "lib": ["dom", "es6", "es2017", "esnext.asynciterable"],
    "skipLibCheck": true,
    "sourceMap": true,
    "outDir": "./dist",
    "moduleResolution": "node",
    "removeComments": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "noImplicitThis": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "resolveJsonModule": true,
    "baseUrl": "."
  },
  "exclude": ["node_modules"],
  "include": ["./src/**/*.ts"]
}

What i tried

I tried to install older versions, but that didn't help.

I'll be glad if you could help me.

Thank you.

like image 645
Simon Farkas Avatar asked Oct 16 '25 21:10

Simon Farkas


1 Answers

The latest graphql-upload version 16.0.0 did not work for me with node 16 typescript. However, downgrading to the previous version 15.0.2 worked with the following replacements,

import GraphQLUpload from 'graphql-upload/GraphQLUpload.js';
import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.js';
like image 192
saz Avatar answered Oct 18 '25 12:10

saz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!