简体   繁体   English

msSaveOrOpenBlob 属性在 Navigator 类型上不存在 angular 13

[英]msSaveOrOpenBlob property doesn't exist on type Navigator angular 13

The property msSaveOrOpenBlob doesn't exist on type Navigator after updating to the angular 13.更新到 angular 13 后,类型 Navigator 上不存在属性 msSaveOrOpenBlob。

I know the Navigator.msSaveOrOpenBlob is being deprecated as per https://developer.mozilla.org/en-US/docs/Web/API/Navigator/msSaveOrOpenBlob#browser_compatibility我知道Navigator.msSaveOrOpenBlob根据https://developer.mozilla.org/en-US/docs/Web/API/Navigator/msSaveOrOpenBlob#browser_compatibility被弃用

I had an angular 12 application, now I am migrating to angular 13 and typescript have been updated to the latest version, but facing the issue of The property msSaveOrOpenBlob doesn't exist on type Navigator我有一个 angular 12 应用程序,现在我正在迁移到 angular 13 和 typescript 已更新到最新版本,但面临The property msSaveOrOpenBlob doesn't exist on type Navigator的问题

what will be the alternate code for the below下面的替代代码是什么

if (window.navigator.msSaveOrOpenBlob) {
            navigator.msSaveOrOpenBlob(blob, filename);
        }
let newVariable: any = window.navigator;
var newBlob = new Blob([res.body], { type: "application/csv" });
if (newVariable && newVariable.msSaveOrOpenBlob) {
    newVariable.msSaveOrOpenBlob(newBlob);
    return;
}

Found some of the references找到了一些参考资料

https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/1029 https://github.com/microsoft/TypeScript/issues/45612 https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/1029 https://github.com/microsoft/TypeScript/issues/45612

Use the declaration merging and declare the types locally in your project work.使用声明合并并在您的项目工作中本地声明类型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Angular 13 属性在类型“FormGroup”上不存在 - Angular 13 Property does not exist on type 'FormGroup' 类型“ {}”上不存在属性“更新”和“数量” - Property 'update' and 'quantity' doesn't exist on type '{ }' 字符串类型不存在属性 | 目的 - Property doesn't exist on type string | object “Navigator”类型上不存在属性“userAgentData” - Property 'userAgentData' does not exist on type 'Navigator' 错误:“'JSON'类型不存在属性'.get'(HTML / Javascript / Angular2 / Typescript) - Error: "Property '.get' doesn't exist on type 'JSON' (HTML / Javascript / Angular2 / Typescript) 使用Ionic2和Angular2的类型'Navigator'上不存在属性'connection' - Property 'connection' does not exist on type 'Navigator' using Ionic2 and Angular2 Angular 4 typescript Cordova Camera 插件错误“属性 'camera' 在类型 'Navigator' 上不存在” - Angular 4 typescript Cordova Camera plugin error "Property 'camera' does not exist on type 'Navigator'" Firefox OS-导航器中不存在mozMobileConnection - Firefox OS - mozMobileConnection doesn't exist in navigator 属性不存在 - Property doesn't exist 三个在 Angular 中不存在 - three doesn't exist in Angular
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM