YousefED / SyncedStore

SyncedStore CRDT is an easy-to-use library for building live, collaborative applications that sync automatically.

Home Page:https://syncedstore.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Assign boxed objects

canadaduane opened this issue · comments

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" })