返回打字稿中的IDBTRANSACTION

发布于 2025-01-26 11:20:00 字数 195 浏览 4 评论 0原文

我正在尝试编写一些允许用户在打字稿中与indexedDB构建自己的交易的功能。

调用db.transction(...)返回iDbpTransaction< ...>哪种打字稿投诉是私人的。

如何从打字稿中的函数中返回IDBTRANSACTION

I'm trying to write some functions that allow a user to build their own transaction with IndexedDB in Typescript.

Calling db.transction(...) returns an IDBPTransaction<...> which Typescript complains is private.

How can I return an IDBTransaction from a function in Typescript?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

满身野味 2025-02-02 11:20:00

IDBPTRANSACTION实际上是IDB npm软件包中的一种类型,而不是本机浏览器实现。

为了返回IDBTRANSACTION,您需要直接使用indexedDB API。

IDBPTransaction is actually a type from the idb NPM package, not from the native browser implementation.

In order to return an IDBTransaction you need to use the IndexedDB API directly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文