We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
const state = proxyWithComputed<{ count: number }, { doubled: number, quadrupled: number }>({ count: 1, }, { doubled: snap => snap.count * 2, quadrupled: snap => snap.doubled * 2 })
will result in typescript error Property 'doubled' does not exist on type '{ count: number; }'.
Property 'doubled' does not exist on type '{ count: number; }'
The text was updated successfully, but these errors were encountered:
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
Sorry, something went wrong.
Closing this as it's not possible in TS.
add a link to #192 in readme, fix #217
eb384f7
No branches or pull requests
will result in typescript error
Property 'doubled' does not exist on type '{ count: number; }'
.The text was updated successfully, but these errors were encountered: