我正在尝试用Typescript编写一些函数,允许用户使用IndexedDB构建自己的事务。调用db.transction(...)将返回一个IDBPTransaction<...>,Typescript将该IDBPTransaction<...>报告为私有。如何从Typescript中的函数返回IDBTransaction?
db.transction(...)
IDBPTransaction<...>
IDBTransaction
wz1wpwve1#
IDBPTransaction实际上是来自idb NPM包的类型,而不是来自本机浏览器实现的类型。为了返回IDBTransaction,您需要直接使用IndexedDB API。
IDBPTransaction
idb
1条答案
按热度按时间wz1wpwve1#
IDBPTransaction
实际上是来自idb
NPM包的类型,而不是来自本机浏览器实现的类型。为了返回
IDBTransaction
,您需要直接使用IndexedDB API。