mirror of
https://github.com/littensy/charm.git
synced 2026-10-21 19:54:09 +00:00
fix(types): do not make roblox datatypes partial (#13)
This commit is contained in:
parent
d0b842636d
commit
9df9ea13cb
1 changed files with 14 additions and 3 deletions
17
src/index.d.ts
vendored
17
src/index.d.ts
vendored
|
|
@ -243,6 +243,15 @@ declare namespace Charm {
|
||||||
|
|
||||||
type MaybeNone<T> = undefined extends T ? None : never;
|
type MaybeNone<T> = 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
|
* A partial patch that can be applied to the state to update it. Represents
|
||||||
* the difference between the current state and the next state.
|
* the difference between the current state and the next state.
|
||||||
|
|
@ -258,9 +267,11 @@ declare namespace Charm {
|
||||||
? ReadonlyMap<T, true | None>
|
? ReadonlyMap<T, true | None>
|
||||||
: State extends readonly (infer T)[]
|
: State extends readonly (infer T)[]
|
||||||
? readonly (SyncPatch<T> | None | undefined)[]
|
? readonly (SyncPatch<T> | None | undefined)[]
|
||||||
: State extends object
|
: State extends DataType
|
||||||
? { readonly [P in keyof State]?: SyncPatch<State[P]> }
|
? State
|
||||||
: State);
|
: State extends object
|
||||||
|
? { readonly [P in keyof State]?: SyncPatch<State[P]> }
|
||||||
|
: State);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A payload that can be sent from the server to the client to synchronize
|
* A payload that can be sent from the server to the client to synchronize
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue