1
没有找到可转位签名我使用这个片段获取视野访问计算属性/元素。在HTML元素
function getViewport(): { width: number, height: number } {
let e = window;
let a = 'inner';
if (!('innerWidth' in window)) {
a = 'client';
e = document.documentElement || document.body;
}
return {
width: e[`${a}Width`],
height: e[`${a}Height`],
};
}
的大小,但是当我运行flow check
我收到此错误:
18: height: e[`${a}Height`],
^^^^^^^^^^^^^^^ access of computed property/element. Indexable signature not found in
18: height: e[`${a}Height`],
^HTMLElement
我刚开始学习流动,如果有人会向我解释我该如何解决这个问题,或者当我可以阅读更多关于它的文档时,我会非常感谢。谢谢。