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
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
<div align="center">

## 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';

const addTodo = createAction('todos/ADD', resolve => {
return (text: string) => resolve({ text });
});

type AddTodo = ReturnType<typeof addTodo>;
console.log(getType(addTodo)); // 'todos/ADD'

# React & Redux in TypeScript - Complete Guide

_"This guide is a **living compendium** documenting the most important patterns and recipes on how to use **React** (and its Ecosystem) in a **functional style** using **TypeScript**. It will help you make your code **completely type-safe** while focusing on **inferring the types from implementation** so there is less noise coming from excessive type annotations and it's easier to write and maintain correct types in the long run."_
Expand Down
15 changes: 15 additions & 0 deletions README_SOURCE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
<div align="center">

## 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';

const addTodo = createAction('todos/ADD', resolve => {
return (text: string) => resolve({ text });
});

type AddTodo = ReturnType<typeof addTodo>;
console.log(getType(addTodo)); // 'todos/ADD'

# React & Redux in TypeScript - Complete Guide

_"This guide is a **living compendium** documenting the most important patterns and recipes on how to use **React** (and its Ecosystem) in a **functional style** using **TypeScript**. It will help you make your code **completely type-safe** while focusing on **inferring the types from implementation** so there is less noise coming from excessive type annotations and it's easier to write and maintain correct types in the long run."_
Expand Down
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"devDependencies": {
"all-contributors-cli": "6.9.3",
"doctoc": "1.4.0",
"doctoc": "^1.4.0",
"husky": "3.0.9"
},
"scripts": {
Expand Down