-
Notifications
You must be signed in to change notification settings - Fork 57
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
Added types. #20
base: master
Are you sure you want to change the base?
Added types. #20
Conversation
* Retrieves the given action. | ||
* @param action Action to retrieve (Worker actions take strings). | ||
*/ | ||
action(action: Action<WorkerState> | string): (...params: any[]) => void; |
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 this one is already defined on Store
, right?
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.
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.
Hi @developit, no worries about the time to review (with the recent release of Preact X, I understand). About your question, Unistore's action doesn't work exactly like Stockroom's action. Stockroom takes an Action
or a string
, and Unistore (afaik) only takes an Action
. Also Stockroom returns void
where Unistore returns the BoundAction
.
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.
Sorry for the super slow review, these look great! Just the one question about Store.action().
I'm all for having the JSDoc in the definitions. Had a bit of a debate when I was putting the types together for #22 and ultimately figured it would add to maintenance time (double handling of function docs). 🤔 I know that the TypeScript compiler is capable of linting regular JS via JSDoc. I wonder if definition files could be generated from that... Something I think I'll look into. |
I'm working a lot with TypeScript+Preact+Stockroom, and I needed types to make my workflow even better. Let's make everyone's worflow better with TS 😄