-
Notifications
You must be signed in to change notification settings - Fork 50
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
Properly type actions #4105
Properly type actions #4105
Conversation
Hmm, there's something strange here. It seems like the provided T to Also I think the |
Yes, that's strange. The provided export type Action<T = unknown> = {
type: unknown;
payload?: {
actionGrant?: ActionGrant;
entities?: T;
next?: string;
previous?: string;
result?: ID;
};
};
Not sure if I'm following you here. The |
Yes, but not only API-call actions. It is f.ex. used in I'm just saying you should take your new type, call it f.ex. |
Yes but all actions are currently wrong and have to be refactored. This PR just makes it possible to actually type them |
The |
Regarding this part, I think you may have forgotten to push the latest changes? In the diff right now the action type looks like this:
It should be more like what you posted over, except that entities is actually a map of entity type names and a map of entityId to the entity (this is because it is run through normalizr): It you look in |
6996a21
to
d5c108e
Compare
96b7c94
to
d1d28d5
Compare
43b3288
to
7d11555
Compare
It is now possible to type API request! Co-authored-by: Eik Hvattum Røgeberg <[email protected]>
504d6aa
to
17aca50
Compare
I think this works well now! I suggest we merge this, and then add types to the remaining actions as they are needed. They will default to |
Co-authored-by: Eik Hvattum Røgeberg <[email protected]>
17aca50
to
d3e71b2
Compare
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 is good now!
But maybe someone else should review as well, as I wrote quite a bit of it:)
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.
LGTM
Description
Properly type the callAPI and promise middleware
It is now possible to type API request!
Type announcement, article, comment and company actions
Result
No visual changes except this tiny fix:
Testing
Tested all actions that were typed, even though that should not have broken anything.