Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.8K
Views
After update typescript ^3.7.2 to latest "typescript": "^4.4.4" - error TS2339: Property 'msSaveOrOpenBlob' does not exist on type 'Navigator'

I have used this msSaveOrOpenBlob method . its was working properly but after update typescript into latest version I am getting multiple error there is two error .

window.navigator.msSaveOrOpenBlob(data, filename);

error TS2322: Type 'Promise<>' is not assignable to type 'IPromise<>'.

What is the fix of that .

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

It's my first development in angular more specific in the 12 version, and I created a method in a component that does a download a xlsx file, in Chrome its work but in IE it doesn't work, I find that adding this line window.navigator.msSaveOrOpenBlob(data, filename); Explorer can download file, but in VSC mark error and it is

Property 'msSaveOrOpenBlob' does not exist on type 'Navigator'

and I change the module and lib in tsconfig.json,

"module": "es2020",
"lib": [
    "es2020",
    "dom"
]

to:

"module": "es2015",
"lib": [
    "es2015",
    "dom"
]

In the code window.navigator.msSaveOrOpenBlob VSC mark the same

Property 'msSaveOrOpenBlob'....'

but when I execute ng serve its work and download a xlsx file in IE and Chrome.

over 4 years ago · Santiago Trujillo Report

0

msSaveOrOpenBlob was a proprietary addition to the Navigator object, added by Microsoft for Internet Explorer. Since Microsoft is phasing out support for Internet Explorer, it has removed support for many of the non-standard additions made to the lib.dom.d.ts and lib.es*.d.ts files that ship with TypeScript. See this GitHub issue about the changes to the DOM.d.ts file.

As indicated in this GitHub issue on the subject, you will have to use declaration merging to add these types to Navigator yourself.

over 4 years ago · Santiago Trujillo Report

0

@Heretic Monkey answer is correct, but if you just want to get around the issue - since you are using TypeScript - you can just cast it to type any before calling msSaveOrOpenBlob.

(window.navigator as any).msSaveOrOpenBlob(data, filename);

Also, you should make sure the navigator object does have the method in the first place, so:

const nav = (window.navigator as any);
if (nav.msSaveOrOpenBlob) {
  nav.msSaveOrOpenBlob(data, filename);
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!