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

Commit 622449c

Browse files
committed
Fix type bug in DurableObject txn get
Transactions are no different from regular operations. get returns T | undefined
1 parent f661c28 commit 622449c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/rude-apples-bow.md

Lines changed: 5 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ 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>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;
5454
get<T = unknown>(
5555
keys: string[],
5656
options?: DurableObjectGetOptions

0 commit comments

Comments
 (0)