Closed vfa-locltb closed 2 years ago
Same problem.
I found version 13.0.0 probably working. Still testing.
As per the major changes documented in the v14.0.0 changelog entry, graphql-upload
now has built in types via TypeScript JSDoc comments:
https://github.com/jaydenseric/graphql-upload/releases/tag/v14.0.0
If you wish to make use of them in your Node.js projects, consider using these TypeScript config options:
You will also need to use a TypeScript version that supports those options.
If you update to graphql-upload
v14, you should uninstall @types/graphql-upload
. Note that I implemented types from fresh, and they don't necessarily match what types the community had previously come up with in @types/graphql-upload
.
In the case of the FileUpload
, you need to import it from the module in which it's defined:
You should be able to do that like this in a .ts
or .cts
or .mts
file:
import type { FileUpload } from "graphql-upload/processRequest.js";
When importing within a JSDoc comment (e.g. within a .js
, .cjs
, or .mjs
file):
/** @type {import("graphql-upload/processRequest.js").FileUpload} */
There is an example of this in the Apollo upload examples example API:
This issue (kind of) duplicates https://github.com/jaydenseric/graphql-upload/issues/306 .
I can't import FileUpload from 'graphql-upload' in my Nestjs application written with Typescript, please help