Skip to content

Commit

Permalink
Fix typings
Browse files Browse the repository at this point in the history
  • Loading branch information
cjies committed May 21, 2018
1 parent 841d00c commit 503089a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
"author": "CJies <cijies@gmail.com>",
"license": "MIT",
"files": ["dist"],
"main": "dist/duck.js",
"module": "dist/duck.module.js",
"main": "./dist/duck.js",
"module": "./dist/duck.module.js",
"types": "./dist/duck.d.ts",
"scripts": {
"precommit": "pretty-quick --staged",
"prebuild": "rm -rf ./dist",
Expand Down
2 changes: 1 addition & 1 deletion src/duck.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* An action type in string
*/
const ActionType: string;
type ActionType = string;

/**
* An object to describe action
Expand Down
36 changes: 17 additions & 19 deletions src/duck.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,22 @@ type ActionCases<S> = {
[actionType: ActionType]: (S, Action) => void,
};

declare module 'redux-duck-immer' {
/**
* Define an action type
*/
declare export function defineType(...actionTypes: string[]): ActionType;
/**
* Define an action type
*/
declare export function defineType(...actionTypes: string[]): ActionType;

/**
* Create an action creator
*/
declare export function createAction(
actionType: ActionType
): (payload: any) => Action;
/**
* Create an action creator
*/
declare export function createAction(
actionType: ActionType
): (payload: any) => Action;

/**
* Create a reducer with immer supports
*/
declare export function createReducer(
initState: any,
cases: ActionCases<any>
): <S>(state: S, action: Action) => S;
}
/**
* Create a reducer with immer supports
*/
declare export function createReducer(
initState: any,
cases: ActionCases<any>
): <S>(state: S, action: Action) => S;

0 comments on commit 503089a

Please sign in to comment.