utrain
utrain
SSolidJS
Created by utrain on 11/4/2024 in #support
How to make setStore treat a class/interface as an opaque value instead of a partiable one?
And it solves my problem, I guess? Is there a better way?
4 replies
SSolidJS
Created by utrain on 11/4/2024 in #support
How to make setStore treat a class/interface as an opaque value instead of a partiable one?
So, now the partialization is behind a condition.
4 replies
SSolidJS
Created by utrain on 11/4/2024 in #support
How to make setStore treat a class/interface as an opaque value instead of a partiable one?
Okay, I decided to try patching it myself and pulled from SolidStore.Unwrappables. It's supposed to include anything that shouldn't be wrapped reactively. Though, it doesn't imply the object in question shouldn't be patchable, it works okay-enough for my purposes. I changed the type of StoreSetter, which determines how some value should be modified, to be this instead:
type TryCustomPartializing<T> = T extends Unwrappable ? T : CustomPartial<T>
export type StoreSetter<T, U extends PropertyKey[] = []> = TryCustomPartializing<T> | ((prevState: T, traversed: U) => TryCustomPartializing<T>)
type TryCustomPartializing<T> = T extends Unwrappable ? T : CustomPartial<T>
export type StoreSetter<T, U extends PropertyKey[] = []> = TryCustomPartializing<T> | ((prevState: T, traversed: U) => TryCustomPartializing<T>)
4 replies