Skip to content

Commit 53ffbd9

Browse files
committed
vEventId is a function
1 parent b89d442 commit 53ffbd9

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/types.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,8 @@ export type EventId<Name extends string = string> = string & {
2020
__name: Name;
2121
};
2222
export type VEventId<Name extends string> = VString<EventId<Name>>;
23-
export const vEventId = v.string() as VString<EventId<string>>;
24-
25-
export type EventSpec<Name extends string = string, T = unknown> = (
26-
| { name: Name; id?: EventId<Name> }
27-
| { name?: Name; id: EventId<Name> }
28-
) & {
29-
validator?: Validator<T, any, any>;
30-
};
23+
export const vEventId = <Name extends string = string>(_name?: Name) =>
24+
v.string() as VString<EventId<Name>>;
3125

3226
export type WorkflowStep = {
3327
workflowId: WorkflowId;
@@ -65,7 +59,7 @@ export const vWorkflowStep = v.object({
6559
),
6660
workId: v.optional(vWorkIdValidator),
6761
nestedWorkflowId: v.optional(vWorkflowId),
68-
eventId: v.optional(vEventId),
62+
eventId: v.optional(vEventId()),
6963
});
7064
// type assertion to keep us in check
7165
const _: Infer<typeof vWorkflowStep> = {} as WorkflowStep;

0 commit comments

Comments
 (0)