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 .
@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);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With