-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
chore(gatsby-cli): migrate redux folder to typescript #22292
chore(gatsby-cli): migrate redux folder to typescript #22292
Conversation
I'm not sure how I should handle |
@Kornil you can just use |
@MichaelDeBoey so can I increase the scope of the PR to fix all the affected files as well? Import by using the non-default export syntax, so they won't be compatible anymore I believe. |
dispatchAction | { type: Actions; payload: Partial<IActivity> } | ||
> | ||
|
||
export interface IActionTypes { |
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 don't see the need for this to be reusable (in the sense of being an export in a common file). Could you just transfer these types to exist on the functions themselves?
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.
Do you mean to export them types manually instead of an interface? I put them in a different file cause it grew quite a lot.
Thank you @blainekasten for the tough review, I've commented with an 👍 on each of your comments that I've addressed. Return types for actions are now fully typed with a clean interface for both the Only one I left out as I feel it is easier to have an object and interface combo vs key -> type for each one. Few things to note:
export default {
...bindActionCreators<typeof actions, any>(actions, dispatch),
}
|
…atsby-cli-redux-folder
…atsby-cli-redux-folder
Hi. Fwiw, I'm working excessively in the run-queries.js file that's part of this commit. I didn't notice this PR before, sorry about that. I have some more work left, part of the fast indexes effort, which I hope to wrap up in the next week or so. Meanwhile, expect some more churn like #22932 . Fwiw, I'm trying hard to be a good typing citizen, but the merge conflicts will be hard. @blainekasten please hold off on merging this until I'm finished, or in between these PR's. (Although tbh I'm wrapping them up in fast cadence so that's hard). Thanks |
import { getStore, onLogAction } from "../../redux/index" | ||
import ReporterStore from "../../redux/index" | ||
|
||
const { getStore, onLogAction } = ReporterStore |
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.
Any reason for doing it in 2 steps? 🤔
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.
No particular reason, @blainekasten fixed it by removing the object structure in the commits below, I highly prefer his solution.
842b8ea
to
384eb5f
Compare
Fwiw, #22932 was merged and will cause merge conflicts. I have more changes planned for this file, but not made them yet. If somebody can give me an estimate on how far away merging this PR is then I can potentially hold off on further changes. Otherwise I'll have to continue since this is blocking my work on fast filters. |
@pvdz I can get the merge conflicts solved either later today or tomorrow. Not sure about plans for merging. |
8b6a162
to
2c33e2a
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.
This looks great to me, let's merge it!
Thank you so much for contributing to our TypeScript refactor! We have more work to do and we would love to have you stay involved in our transition. Please submit more PRs! 💜
Holy buckets, @Kornil — we just merged your PR to Gatsby! 💪💜 Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! |
Description
Migrate
/redux
folder in gatsby-cli to typescript.Related Issues
#21995
There
are a couple ofis oneany
s that I could not type better. Let me know if you have any feedback.