Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 94fa3e6

Browse files
committedMar 10, 2025·
nits
1 parent 7e9971a commit 94fa3e6

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed
 

‎packages/workflow/src/interfaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ export type DefaultSignalHandler = (signalName: string, ...args: unknown[]) => v
541541
/**
542542
* A handler function accepting update calls for non-registered update names.
543543
*/
544-
export type DefaultUpdateHandler = (updateName: string, ...args: any[]) => Promise<any> | any;
544+
export type DefaultUpdateHandler = (updateName: string, ...args: unknown[]) => Promise<unknown> | unknown;
545545

546546
/**
547547
* A validation function capable of accepting the arguments for a given UpdateDefinition.

‎packages/workflow/src/internals.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -671,21 +671,20 @@ export class Activator implements ActivationHandler {
671671
if (!protocolInstanceId) {
672672
throw new TypeError('Missing activation update protocolInstanceId');
673673
}
674-
if (!this.updateHandlers.get(name) && !this.defaultUpdateHandler) {
674+
675+
let entry = this.updateHandlers.get(name);
676+
if (entry === undefined && this.defaultUpdateHandler) {
677+
entry = {
678+
handler: this.defaultUpdateHandler.bind(name),
679+
validator: undefined,
680+
// Default to a warning policy.
681+
unfinishedPolicy: HandlerUnfinishedPolicy.WARN_AND_ABANDON,
682+
};
683+
} else {
675684
this.bufferedUpdates.push(activation);
676685
return;
677686
}
678687

679-
const entry = this.updateHandlers.get(name) ?? {
680-
// Logically, this must be defined as we got passed the conditional above
681-
// pushing to the buffer. But Typescript doesn't know that so we use a
682-
// non-null assertion (!).
683-
handler: (...args: any[]) => this.defaultUpdateHandler!(name, ...args),
684-
validator: undefined,
685-
// Default to a warning policy.
686-
unfinishedPolicy: HandlerUnfinishedPolicy.WARN_AND_ABANDON,
687-
};
688-
689688
const makeInput = (): UpdateInput => ({
690689
updateId,
691690
args: arrayFromPayloads(this.payloadConverter, activation.input),

0 commit comments

Comments
 (0)
Please sign in to comment.