-
Notifications
You must be signed in to change notification settings - Fork 2k
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
@uppy/core state and store types are outdated #4090
Comments
AFAIK this is intended and you should never access the state like that. Instead, use |
@Murderlon The methods cannot be made reactive while the object can (as seen in the screenshot). To replace it with methods will involve events instead, which is currently not ideal as you have noted in another ticket. And regardless of this being intended for external usage, the typings still seem incorrect. The documentation is also in need of an update, I think: https://uppy.io/docs/uppy/#store-defaultStore |
What do you mean with this? What are you trying to do?
I'm not sure I know which ticket, what is the downside here?
I think |
I use Uppy inside a Vuex module. The Uppy instance is added to the state, which causes Vue to observe changes within it. This allows me to write simple getters that automatically update on Uppy's state changes: {
numberFiles(): number {
return Object.values(uppy.state.files).length
},
totalSize(): number {
return Object.values(uppy.state.files).reduce((size, file) => size + file.size, 0)
}
} The above was possible before, but since the update, the typings say that
|
Thanks for explaining. I think the |
Uppy has been rewritten in TypeScript and the 4.0 release contains all type improvements. |
Initial checklist
Link to runnable example
No response
Steps to reproduce
uppy.state.files
, validated by TScannot read property "files" of undefined
Expected behavior
TS to error out when accessing
uppy.state
and instead supportuppy.store.state
.Actual behavior
state
is nested understore
:The text was updated successfully, but these errors were encountered: