Typescript 财产';webkitTemporaryStorage';不存在于类型';导航器&x27;
我正在使用下面的代码检查indexeddb的大小Typescript 财产';webkitTemporaryStorage';不存在于类型';导航器&x27;,typescript,indexeddb,Typescript,Indexeddb,我正在使用下面的代码检查indexeddb的大小 navigator.webkitTemporaryStorage.queryUsageAndQuota ( function(usedBytes, grantedBytes) { console.log('we are using ', usedBytes, ' of ', grantedBytes, 'bytes'); }, function(e) { console.log('Error', e); } ); 但是在类型导
navigator.webkitTemporaryStorage.queryUsageAndQuota (
function(usedBytes, grantedBytes) {
console.log('we are using ', usedBytes, ' of ', grantedBytes, 'bytes');
},
function(e) { console.log('Error', e); }
);
但是在类型导航器上不存在类似属性webkitTemporaryStorage
的错误
我是个新手。谁能帮我解决这个问题
谢谢首先,这不是角度的问题,而是关于浏览器的问题。看起来它只适用于chrome。这是正确的答案。更好地了解@kamalav答案(参见他对其他答案的评论):
解决方案是将navigator属性定义为any,问题已经解决了谢谢。我已经尝试了navigator.storage.estimate()。为此,我得到了“[ts]属性'storage'在类型'navigator'上不存在。any”typescriptIt中的错误由let nav:any=navigator解决;nav.webkitTemporaryStorage.queryUsageAndQuota(函数(usedBytes,grantedBytes){console.log('we-use',usedBytes,'of',grantedBytes,'bytes');},函数(e){console.log('Error',e);});
const nav: any = navigator;
nav.webkitTemporaryStorage.queryUsageAndQuota ( (usedBytes, grantedBytes) => {
console.log('we are using ', usedBytes, ' of ', grantedBytes, 'bytes');
}, (e) => {
console.log('Error', e);
});