Skip to content

How to type snapshots? #451

Closed Answered by dai-shi
skokenes asked this question in Q&A
May 2, 2022 · 1 comments · 4 replies
Discussion options

You must be logged in to vote

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.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@lmaero
Comment options

@dai-shi
Comment options

@lmaero
Comment options

@dai-shi
Comment options

Answer selected by skokenes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants