How to import types from valtio? #971
-
The import of import { subscribe, proxy, type Op } from 'valtio'
// ...
// const state = ...
// ...
subscribe(proxy(state), (ops: Op[]) => {
// ...
}) |
Beta Was this translation helpful? Give feedback.
Answered by
overthemike
Oct 14, 2024
Replies: 2 comments 2 replies
-
valtio doesn't export the type you're looking for. If you want to make your own: type Path = (string | symbol)[]
type Op =
| [op: 'set', path: Path, value: unknown, prevValue: unknown]
| [op: 'delete', path: Path, prevValue: unknown] Created an issue to have this looked into: #972 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
teetotum
-
Are you using it? Does this work for you? subscribe(proxy(state), () => {
// ...
})``` |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
valtio doesn't export the type you're looking for. If you want to make your own:
Created an issue to have this looked into: #972