typescript:S1874: 'fileSaver' is deprecated. use `{ autoBom: false }` as the third argument

  • ALM used: GitHub
  • CI system used: Jenkins

The code

 fileSaver.saveAs(
            responseData,
            `report.${downloadReportRequest.fileFormat.toLowerCase()}`,
            { autoBom: false },
          );

triggers the typescript:S1874, even though {autoBom: false} is used

Hi Lrozenblyum,

Could you provide a reproducer for your issue? What is the fileSaver object that you are referring to?

Best,
Ilia

@ilia

  1. I’ll try to create a reproducer but it might take some time
  2. The fileSaver is received in the import section:
    import * as fileSaver from 'file-saver';
    Our package.json contains this dependency:
    "file-saver": "^2.0.5"

Hi @lrozenblyum,

I can reproduce this FP. We have created an issue to track this problem: Fix FP S1874 (`deprecation`): `'fileSaver' is deprecated. use `{ autoBom: false }` as the third argument` · Issue #3862 · SonarSource/SonarJS · GitHub

Thank you for notifying us.

Best Regards,
Ilia

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.