Skip to content

Commit c4d5952

Browse files
Expose serde on promises (#423)
1 parent f2d0d59 commit c4d5952

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/restate-sdk/src/context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ export interface WorkflowSharedContext<TState extends TypedState = UntypedState>
742742
*
743743
* @param name the name of the durable promise
744744
*/
745-
promise<T = void>(name: string): DurablePromise<T>;
745+
promise<T>(name: string, serde?: Serde<T>): DurablePromise<T>;
746746
}
747747

748748
export interface WorkflowContext<TState extends TypedState = UntypedState>

packages/restate-sdk/src/context_impl.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ export class ContextImpl implements ObjectContext, WorkflowContext {
134134
this.rand = new RandImpl(id, this.checkState.bind(this));
135135
}
136136

137-
public promise<T = void>(name: string): DurablePromise<T> {
138-
return new DurablePromiseImpl(this, name);
137+
public promise<T>(name: string, serde?: Serde<T>): DurablePromise<T> {
138+
return new DurablePromiseImpl(this, name, serde);
139139
}
140140

141141
public get key(): string {
@@ -699,9 +699,9 @@ class DurablePromiseImpl<T> implements DurablePromise<T> {
699699
constructor(
700700
private readonly ctx: ContextImpl,
701701
private readonly name: string,
702-
_serde?: Serde<T>
702+
serde?: Serde<T>
703703
) {
704-
this.serde = _serde ?? defaultSerde();
704+
this.serde = serde ?? defaultSerde();
705705
}
706706

707707
then<TResult1 = T, TResult2 = never>(

0 commit comments

Comments
 (0)