Fix LayerData typing for handling arrays

This commit is contained in:
thepaperpilot 2022-07-17 20:21:03 -05:00
parent 7d1346746f
commit ba47847e39

View file

@ -42,7 +42,7 @@ export type Player = ProxiedWithState<PlayerData>;
/** A layer's save data. Automatically unwraps refs. */ /** A layer's save data. Automatically unwraps refs. */
export type LayerData<T> = { export type LayerData<T> = {
[P in keyof T]?: T[P] extends (infer U)[] [P in keyof T]?: T[P] extends (infer U)[]
? LayerData<U>[] ? Record<string, LayerData<U>>
: T[P] extends Record<string, never> : T[P] extends Record<string, never>
? never ? never
: T[P] extends Ref<infer S> : T[P] extends Ref<infer S>