-
Hi, I am using valtio with TypeScript. I set up a proxy state with some nested type, like const state = proxy<{ a: TypeA }>({ a: {} }); When I consume the state as a snapshot using Is there some sort of utility type I can use to resolve this issue? I tried modifying my functions to expect a type like |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
A snapshot is readonly, and if you want to loosen (lie) the type, please assert it. const snap = useSnapshot(state) as typeof state This was controversial. Please see #327 for more context. |
Beta Was this translation helpful? Give feedback.
A snapshot is readonly, and if you want to loosen (lie) the type, please assert it.
This was controversial. Please see #327 for more context.