-
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/store-default: refactor to typescript #4785
Conversation
class DefaultStore { | ||
static VERSION = packageJson.version | ||
|
||
public state: StateOrStateFragment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think DefaultStore
should accept a generic which makes the state strongly typed. Otherwise we have to type check everything and have no editor intelligence.
class DefaultStore<T extends GenericState = GenericState> { | ||
static VERSION = packageJson.version | ||
|
||
public state: T = {} as T |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now that I see this type it's actually odd we don't have an initial state passed in the constructor, which would make this type and state correct from the start. Just a thought, not something for now.
| Package | Version | Package | Version | | ---------------------- | ------- | ---------------------- | ------- | | @uppy/companion-client | 3.6.1 | @uppy/store-default | 3.1.0 | | @uppy/locales | 3.5.0 | uppy | 3.20.0 | - meta: uppy CDN: Export UIPlugin and BasePlugin (Artur Paikin / #4774) - @uppy/locales: Add missing translations to de_DE (Leonhard Melzer / #4800) - @uppy/store-default: refactor to typescript (Antoine du Hamel / #4785) - meta: improve js2ts script (Antoine du Hamel / #4786) - @uppy/companion-client: fix log type error (Mikael Finstad / #4766) - @uppy/companion-client: revert breaking change (Antoine du Hamel / #4801) - @uppy/locales: use TypeScript for source files (Antoine du Hamel / #4779) - meta: migrate AWS SDK v2 to v3 in `bin/uploadcdn` (Trivikram Kamat / #4776)
No description provided.