From 9df9ea13cbfd634b201f1e6f08ecb63a998b52f9 Mon Sep 17 00:00:00 2001 From: richard <56808540+littensy@users.noreply.github.com> Date: Tue, 9 Jul 2024 16:32:23 -0700 Subject: [PATCH] fix(types): do not make roblox datatypes partial (#13) --- src/index.d.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/index.d.ts b/src/index.d.ts index 7b00e15..94adf4c 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -243,6 +243,15 @@ declare namespace Charm { type MaybeNone = undefined extends T ? None : never; + type DataTypes = { + [P in keyof CheckableTypes as P extends keyof CheckablePrimitives ? never : P]: CheckableTypes[P]; + }; + + /** + * A type that should not be made partial in patches. + */ + type DataType = DataTypes[keyof DataTypes]; + /** * A partial patch that can be applied to the state to update it. Represents * the difference between the current state and the next state. @@ -258,9 +267,11 @@ declare namespace Charm { ? ReadonlyMap : State extends readonly (infer T)[] ? readonly (SyncPatch | None | undefined)[] - : State extends object - ? { readonly [P in keyof State]?: SyncPatch } - : State); + : State extends DataType + ? State + : State extends object + ? { readonly [P in keyof State]?: SyncPatch } + : State); /** * A payload that can be sent from the server to the client to synchronize