Closed RyannGalea closed 2 years ago
Ok, only works for me when using
Works:
"extract-files": "11.0.0",
Not working:
"extract-files": "12.0.0",
Please update your documentation to the correct way to integrate extract-files
in apollo-angular
. Even when I use import { extractFiles } from 'extract-files/extractFiles.mjs';
I get a warning in vscode:
Could not find a declaration file for module 'extract-files/extractFiles.mjs'.
'/c/code/myproject/node_modules/extractFiles.mjs' implicitly has an 'any' type.
Try `npm i --save-dev @types/extract-files` if it exists or add a new declaration (.d.ts) file containing `declare module 'extract-files/extractFiles.mjs';`
And I already did npm i --save-dev @types/extract-files
.
I had to revert back to v11 because of this issue also.
@RyannGalea indeed, the dependency is clearly on v11. However, I can't understand why, because v12 was already out on January 14th, more than a month ago.
In fact, it seems that my mistake was to do npm i --save-dev @types/extract-files
, after updating apollo-angular from the alpha version to final 3.0.0, which probably installed v12 and then I started having more problems.
I do not get it either, but my only solution was to use 11. It seems that files are not detected on extract-files@12.
There's no dependency on extract-files
package, you need to provide a function that matches the type signature of extractFiles
function. It's up to you to decide which version of extract-files
you're using and how to import it really.
The extract-files function works fine v12. As indicated, simply indicate a compatible function.
// 1. Import extractFiles function, and isExtractableFile, which is needed as a second argument of the function.
// Need to ignore the import, because there are no module types, and the ones from @types/extract-files are for v11 yet.
// @ts-ignore
import extractFiles from 'extract-files/extractFiles.mjs';
// @ts-ignore
import isExtractableFile from 'extract-files/isExtractableFile.mjs';
// 2. Set httpLink with an anonymous function to adapt extract-files
httpLink.create({ uri:'yoururl', extractFiles: (body) => extractFiles(body, isExtractableFile) })
Describe the bug
extract-files won't import now that I'm using v3.
Expected behavior
Is anyone else getting this issue trying to import extractFiles? I'm guessing this has been working for people.