Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Commit

Permalink
Fix type bug in DurableObject txn get
Browse files Browse the repository at this point in the history
Transactions are no different from regular operations. get returns
T | undefined
  • Loading branch information
vlovich committed Jul 12, 2022
1 parent 35db01d commit 38b7e0f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/rude-apples-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cloudflare/workers-types": patch
---

Fix DurableObject transaction `get` to properly return `Promise<T | undefined>` instead of `Promise<T>`
5 changes: 4 additions & 1 deletion overrides/durableobjects.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ declare abstract class DurableObjectStorage {
}

declare abstract class DurableObjectTransaction {
get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T>;
get<T = unknown>(
key: string,
options?: DurableObjectGetOptions
): Promise<T | undefined>;
get<T = unknown>(
keys: string[],
options?: DurableObjectGetOptions
Expand Down

0 comments on commit 38b7e0f

Please sign in to comment.