Skip to content

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
## 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'


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

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:

  1. 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 and typesafe-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.
  2. After updating README_SOURCE.md, run the CI script locally (e.g., npm run ci-check). This should regenerate README.md and correctly update its Table of Contents to include your new section.
  3. Commit both the modified README_SOURCE.md and the newly generated README.md to your branch.
  4. 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!

<div align="center">

# React & Redux in TypeScript - Complete Guide
Expand Down