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

冷暖自知 提交于 2019-12-06 08:11:45

I had the same problem and I couldn't find any available @types for the StorageManager interface.

My temporary solutions was to manually declare it in my code.

declare global {
  interface StorageEstimate {
    quota: number;
    usage: number;
  }
  interface Navigator {
    storage: {
      estimate: () => Promise<StorageEstimate>;
      persist: () => boolean;
      persisted: () => boolean;
    };
  }
}

what is navigator ? I guess it is a global variable on window without any type, so you should add a typing entry for this

https://github.com/typings/typings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!