refactor: unwrap BusEvent namespace + self-reexport (#22962)

This commit is contained in:
Kit Langton
2026-04-16 23:46:49 +00:00
committed by GitHub
parent cb18f2ef40
commit 23d48a7cf1
+7 -7
View File
@@ -1,21 +1,20 @@
import z from "zod"
import type { ZodType } from "zod"
export namespace BusEvent {
export type Definition = ReturnType<typeof define>
export type Definition = ReturnType<typeof define>
const registry = new Map<string, Definition>()
const registry = new Map<string, Definition>()
export function define<Type extends string, Properties extends ZodType>(type: Type, properties: Properties) {
export function define<Type extends string, Properties extends ZodType>(type: Type, properties: Properties) {
const result = {
type,
properties,
}
registry.set(type, result)
return result
}
}
export function payloads() {
export function payloads() {
return registry
.entries()
.map(([type, def]) => {
@@ -29,5 +28,6 @@ export namespace BusEvent {
})
})
.toArray()
}
}
export * as BusEvent from "./bus-event"