-
-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescrpt error when try to have a computed value derived from another computed #192
Labels
wontfix
This will not be worked on
Comments
Thanks for reporting. This is a limitation in types. (I think it's impossible, but would like to hear from TS experts.) A workaround would only be type assertion. const state = proxyWithComputed<{ count: number }, { doubled: number, quadrupled: number }>({
count: 1,
}, {
doubled: snap => snap.count * 2,
quadrupled: snap => (snap as { count: number; doubled: number }).doubled * 2
}) https://codesandbox.io/s/trusting-bas-doyoq?file=/src/App.tsx |
Closing this as it's not possible in TS. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
will result in typescript error
Property 'doubled' does not exist on type '{ count: number; }'
.The text was updated successfully, but these errors were encountered: