feat: add sync typescript types

This commit is contained in:
Richard 2024-02-29 22:26:39 -08:00
parent a30293ee3b
commit dda00f7a4e
3 changed files with 55 additions and 13 deletions

View file

@ -7,13 +7,13 @@ type ClientSyncOptions = {
atoms: { [string]: Atom<any> },
}
type ClientSync = {
sync: (self: ClientSync, payload: types.SyncPayload) -> (),
type ClientSyncer = {
sync: (self: ClientSyncer, payload: types.SyncPayload) -> (),
}
local function client(options: ClientSyncOptions): ClientSync
local function client(options: ClientSyncOptions): ClientSyncer
local atoms = options.atoms
local self = {} :: ClientSync
local self = {} :: ClientSyncer
function self:sync(payload)
for key, state in payload.data do