diff --git a/packages/charm-sync/src/client.luau b/packages/charm-sync/src/client.luau index 801a432..8f3cfb1 100644 --- a/packages/charm-sync/src/client.luau +++ b/packages/charm-sync/src/client.luau @@ -1,13 +1,14 @@ local Charm = require(script.Parent.Parent.Charm) local patch = require(script.Parent.patch) local types = require(script.Parent.types) +type AtomMap = types.AtomMap type SyncPayload = types.SyncPayload type ClientOptions = { --[=[ The atoms to synchronize with the server. ]=] - atoms: { [string | number]: Charm.Atom }, + atoms: AtomMap, --[=[ Whether to ignore patches sent before the client has been hydrated. Default is `true`. diff --git a/packages/charm-sync/src/server.luau b/packages/charm-sync/src/server.luau index 6eac9c3..f2c336e 100644 --- a/packages/charm-sync/src/server.luau +++ b/packages/charm-sync/src/server.luau @@ -4,13 +4,14 @@ local Charm = require(script.Parent.Parent.Charm) local interval = require(script.Parent.interval) local patch = require(script.Parent.patch) local types = require(script.Parent.types) +type AtomMap = types.AtomMap type SyncPayload = types.SyncPayload type ServerOptions = { --[=[ The atoms to synchronize with the client. ]=] - atoms: { [string | number]: Charm.Atom }, + atoms: AtomMap, --[=[ The interval at which to send patches to the client, in seconds. Defaults to `0` (patches are sent up to once per frame). Set to a diff --git a/packages/charm-sync/src/types.luau b/packages/charm-sync/src/types.luau index f6deb17..641f744 100644 --- a/packages/charm-sync/src/types.luau +++ b/packages/charm-sync/src/types.luau @@ -1,3 +1,6 @@ +local Charm = require(script.Parent.Parent.Charm) +type Atom = Charm.Atom + --[=[ A payload that can be sent from the server to the client to synchronize state between the two. @@ -10,4 +13,8 @@ export type SyncPayload = { data: { [string | number]: any }, } +export type AtomMap = { + [string | number]: Atom, +} + return nil