Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular - Could not find a declaration file for module 'file-saver'

In my Angular-12 project I installed file-saver:

npm install [email protected]

npm install --save exceljs

ng generate service services/export-excel

Then in the export-excel service, I added:

import * as fs from 'file-saver';

I got file-saver highlighted

with this error:

Could not find a declaration file for module 'file-saver'. 'c:/xampp/htdocs/myapp/node_modules/file-saver/dist/FileSaver.min.js' implicitly has an 'any' type. Try npm i --save-dev @types/file-saver if it exists or add a new declaration (.d.ts) file containing declare module 'file-saver';

But I didn't use:

@types/file-saver

How do I get this error resolved?

Thanks

like image 604
mikefolu Avatar asked Mar 05 '26 05:03

mikefolu


1 Answers

Additional typescript definitions

npm install @types/file-saver --save-dev

like image 138
Hubert SAWADOGO Avatar answered Mar 08 '26 20:03

Hubert SAWADOGO



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!