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 · 7 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 7 replies

Comment options

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

@dai-shi
Comment options

@jaens
Comment options

@dai-shi
Comment options

@jaens
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
4 participants