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

Commit 38b7e0f

Browse files
committed
Fix type bug in DurableObject txn get
Transactions are no different from regular operations. get returns T | undefined
1 parent 35db01d commit 38b7e0f

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.changeset/rude-apples-bow.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cloudflare/workers-types": patch
3+
---
4+
5+
Fix DurableObject transaction `get` to properly return `Promise<T | undefined>` instead of `Promise<T>`

overrides/durableobjects.d.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ declare abstract class DurableObjectStorage {
5050
}
5151

5252
declare abstract class DurableObjectTransaction {
53-
get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T>;
53+
get<T = unknown>(
54+
key: string,
55+
options?: DurableObjectGetOptions
56+
): Promise<T | undefined>;
5457
get<T = unknown>(
5558
keys: string[],
5659
options?: DurableObjectGetOptions

0 commit comments

Comments
 (0)