mirror of
https://github.com/zhigang1992/redux.git
synced 2026-06-15 02:29:07 +08:00
Remove redundant type parameters from `Dispatch` type Remove redundant `combineReducers` overload Simplify `StoreCreator` type by using optional arguments Remove redundant type parameters from `Middleware` type Update `compose` definitions to cover case with zero arguments and case with multiple arguments for innermost function Add JSDoc
62 lines
948 B
TypeScript
62 lines
948 B
TypeScript
import {Action as ReduxAction} from "../../index.d.ts";
|
|
|
|
|
|
namespace FSA {
|
|
interface Action<P> extends ReduxAction {
|
|
payload: P;
|
|
}
|
|
|
|
const action: Action<string> = {
|
|
type: 'ACTION_TYPE',
|
|
payload: 'test',
|
|
}
|
|
|
|
const payload: string = action.payload;
|
|
}
|
|
|
|
|
|
namespace FreeShapeAction {
|
|
interface Action extends ReduxAction {
|
|
[key: string]: any;
|
|
}
|
|
|
|
const action: Action = {
|
|
type: 'ACTION_TYPE',
|
|
text: 'test',
|
|
}
|
|
|
|
const text: string = action['text'];
|
|
}
|
|
|
|
|
|
namespace StringLiteralTypeAction {
|
|
type ActionType = 'A' | 'B' | 'C';
|
|
|
|
interface Action extends ReduxAction {
|
|
type: ActionType;
|
|
}
|
|
|
|
const action: Action = {
|
|
type: 'A'
|
|
}
|
|
|
|
const type: ActionType = action.type;
|
|
}
|
|
|
|
|
|
namespace EnumTypeAction {
|
|
enum ActionType {
|
|
A, B, C
|
|
}
|
|
|
|
interface Action extends ReduxAction {
|
|
type: ActionType;
|
|
}
|
|
|
|
const action: Action = {
|
|
type: ActionType.A
|
|
}
|
|
|
|
const type: ActionType = action.type;
|
|
}
|