[wip] extractProperty proper typing with union types
This commit is contained in:
@@ -13,16 +13,16 @@ import { combine, constant, merge, Observable, pool, Property } from "kefir";
|
||||
import Bus, { type Bus as TBus } from "kefir-bus";
|
||||
import { log } from "./logging";
|
||||
|
||||
export const WsOut = t.Object({
|
||||
playersPresent: t.Optional(t.Array(t.String())),
|
||||
playerNames: t.Optional(t.Record(t.String(), t.String())),
|
||||
playersReady: t.Optional(t.Nullable(t.Record(t.String(), t.Boolean()))),
|
||||
gameConfig: t.Optional(
|
||||
t.Object({ game: t.String(), players: t.Array(t.String()) })
|
||||
),
|
||||
view: t.Optional(t.Any()),
|
||||
results: t.Optional(t.Any()),
|
||||
});
|
||||
export const WsOut = t.Union([
|
||||
t.Object({ playersPresent: t.Array(t.String()) }),
|
||||
t.Object({ playerNames: t.Record(t.String(), t.String()) }),
|
||||
t.Object({ playersReady: t.Nullable(t.Record(t.String(), t.Boolean())) }),
|
||||
t.Object({
|
||||
gameConfig: t.Object({ game: t.String(), players: t.Array(t.String()) }),
|
||||
}),
|
||||
t.Object({ view: t.Any() }),
|
||||
t.Object({ results: t.Any() }),
|
||||
]);
|
||||
export type TWsOut = typeof WsOut.static;
|
||||
export const WsIn = t.Union([
|
||||
t.Object({ name: t.String() }),
|
||||
|
||||
Reference in New Issue
Block a user