ziw*_*ert 5 javascript flowtype
我在项目中有如下代码
type ActionT = 'add' | 'put' | 'get'
function _dbRequest(action: ActionT) {
...
const store: IDBObjectStore = _getStore(...)
const request = store[action](...) // <- Error here
...
}
Run Code Online (Sandbox Code Playgroud)
它工作正常,但是当我开始用流类型覆盖它时,我遇到了一个错误:
IDBObjectStore[1].Flow(InferError) indexeddb.js(54, 30): [1] 中 缺少声明预期键/值类型的索引签名IDBObjectStore
请注意IDBObjectStore是一种嵌入式类型,如果可能的话,我不想覆盖它。除了 cast to 之外,还有什么方法可以处理它any吗?
| 归档时间: |
|
| 查看次数: |
96 次 |
| 最近记录: |