目标
我正在用TypeGraphql做一个项目,我想要实现用户配置图。
问题
当我试图导入:
import { GraphQLUpload, FileUpload } from "graphql-upload";码头集装箱日志返回:
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"]
}我试过的
我试着安装旧版本,但这没有帮助。
如果你能帮我,我会很高兴的。
谢谢。
发布于 2022-06-20 12:01:11
你能用这个代替吗?
import { GraphQLUpload } from "graphql-upload/GraphQLUpload";
import { Upload } from "graphql-upload/Upload";发布于 2022-07-19 10:40:53
以如下方式导入:
import graphqlUploadExpress from "graphql-upload/graphqlUploadExpress.js"并在tsconfig.json文件中添加这一行:
"compilerOptions": {
"allowJs": true,
"strict": false
}为了允许您导入javascript模块,它适用于我。
发布于 2022-07-25 13:12:22
最新的graphql-上传版本16.0.0不适用于我的节点16类型记录。但是,降级到以前的15.0.2版本使用了以下替换,
import GraphQLUpload from 'graphql-upload/GraphQLUpload.js';
import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.js';https://stackoverflow.com/questions/71726644
复制相似问题