Assign boxed objects
canadaduane opened this issue · 0 comments
canadaduane commented
I have a typescript type that has several variants:
type PresenceType =
| {
status: "offline"
}
| {
eventId: string
status: "in-class"
}
| {
eventId: string | null
gameId: string | null
status: "in-play"
}
const store = syncedStore({
presence: boxed({
status: "offline",
}) as Box<PresenceType>,
})
Now how do I assign this boxed object? The following is not allowed due to presence
being read-only:
store.presence = boxed({ status: "in-class", eventId: "xyz" })