Files
redux/test/typescript/actions.ts
Daniel Lytkin a5d44fab7a Update TypeScript definitions
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
2016-02-24 17:27:50 +06:00

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;
}