-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
docs: add Dispatched Action Types section to README /claim #45 #225
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
base: master
Are you sure you want to change the base?
docs: add Dispatched Action Types section to README /claim #45 #225
Conversation
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.
Hello @TheodorNEngoy, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
Hello! Gemini or gemini-code-assist here, providing a summary of this pull request to help everyone get up to speed quickly.
This pull request aims to enhance the documentation by adding a new section to the README.md
file. The new section focuses on explaining how to handle and understand the types of dispatched actions when using TypeScript, specifically demonstrating how to infer the action type and retrieve the underlying string literal type using the typesafe-actions
library.
Highlights
- Documentation Update: Adds a new section to the main
README.md
documentation. - TypeScript Action Types: The new section explains how TypeScript infers the type of dispatched action creators and how to use
typesafe-actions
'sgetType
helper to get the string literal type. - Code Example: Includes a clear TypeScript code snippet demonstrating the concepts discussed in the new documentation section.
Changelog
- README.md
- Added a new top-level section titled 'Dispatched Action Types'.
- Included an explanation of TypeScript's action type inference.
- Provided instructions and a code example for using
typesafe-actions
'sgetType
helper.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Docs help code take flight,
Types guide actions, clear and bright,
Read this new section.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
Thank you for adding this new documentation section on "Dispatched Action Types"! The explanation and code example are clear and will be helpful for users of typesafe-actions
.
The main point of feedback concerns the contribution process. It appears that README.md
was edited directly. For this project, README_SOURCE.md
is the source file, and README.md
is generated from it. This is crucial for maintaining consistency and ensuring changes are not lost.
Please see the specific comment for details on how to address this.
Summary of Findings
- Incorrect README update process: The
README.md
file was edited directly. Changes must be made toREADME_SOURCE.md
, and thenREADME.md
(including the Table of Contents) must be regenerated using the project's CI script (e.g.,npm run ci-check
). This is critical to prevent the contribution from being lost during automated updates. - PR Template Completion: The pull request template checklist is largely incomplete. Please ensure all relevant steps are followed and checkboxes are updated accordingly, particularly regarding editing
README_SOURCE.md
and running local CI checks.
Merge Readiness
This pull request adds valuable documentation. However, due to a critical process issue where README.md
was edited directly instead of the source file (README_SOURCE.md
), the changes are at risk of being overwritten.
I recommend that the author address the feedback provided by:
- Moving the new content to
README_SOURCE.md
. - Regenerating
README.md
using the project's scripts (e.g.,npm run ci-check
). - Committing both updated files.
- Completing the PR template checklist.
Once these changes are made, the PR should be in good shape for another review. As a language model, I am not authorized to approve pull requests, so please ensure further review and approval by project maintainers before merging.
README.md
Outdated
## Dispatched Action Types | ||
|
||
When you dispatch an action creator, the **type** of the action is inferred by TypeScript. | ||
To see the actual string literal used under the hood, use the `getType` helper from `typesafe-actions`: | ||
|
||
```ts | ||
import { createAction, getType } from 'typesafe-actions'; | ||
|
||
// Define an action | ||
const addTodo = createAction('todos/ADD', resolve => { | ||
return (text: string) => resolve({ text }); | ||
}); | ||
|
||
// Infer its type | ||
type AddTodo = ReturnType<typeof addTodo>; | ||
console.log(getType(addTodo)); // logs: 'todos/ADD' | ||
|
||
|
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.
Thanks for adding this useful section on dispatched action types!
However, it looks like README.md
was edited directly. According to the project's contribution process (as indicated by the PR template checklist and the presence of README_SOURCE.md
and generate-readme.js
), changes to the README should be made in README_SOURCE.md
. Then, README.md
(including the Table of Contents) is automatically generated by running npm run ci-check
.
If README_SOURCE.md
isn't updated, these changes you've made directly in README.md
will unfortunately be overwritten and lost the next time the generation script runs.
Could you please:
- Move this new "Dispatched Action Types" section (lines 1-17 from your changes) into the
README_SOURCE.md
file?- A logical place for this section would be under the main
# Redux
heading. Given its relevance to action creators andtypesafe-actions
, you could add it as a new## Dispatched Action Types
section, perhaps near or after the existing## Action Creators 🌟
section. - Placing it here will also ensure it's correctly positioned relative to the main title and other content, rather than appearing at the very top of the file before the introductory
div
.
- A logical place for this section would be under the main
- After updating
README_SOURCE.md
, run the CI script locally (e.g.,npm run ci-check
). This should regenerateREADME.md
and correctly update its Table of Contents to include your new section. - Commit both the modified
README_SOURCE.md
and the newly generatedREADME.md
to your branch. - Finally, please review and complete the checklist in your pull request description.
This will ensure your valuable contribution is correctly integrated and maintained. The content of the section itself is clear and the example is helpful!
Description
Related issues:
Checklist
README_SOURCE.md
(NOTREADME.md
)npm run ci-check
to generate an updatedREADME.md