-
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74005e8
commit 557b8e4
Showing
29 changed files
with
8,846 additions
and
4,866 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"printWidth": 80, | ||
"semi": true, | ||
"singleQuote": true, | ||
"trailingComma": "es5" | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { StringType } from './type-helpers'; | ||
export declare function action<T extends StringType, E>(type: T, payload: undefined, meta: undefined, error: E): { | ||
type: T; | ||
error: E; | ||
}; | ||
export declare function action<T extends StringType, M, E>(type: T, payload: undefined, meta: M, error: E): { | ||
type: T; | ||
meta: M; | ||
error: E; | ||
}; | ||
export declare function action<T extends StringType, P, E>(type: T, payload: P, meta: undefined, error: E): { | ||
type: T; | ||
payload: P; | ||
error: E; | ||
}; | ||
export declare function action<T extends StringType, P, M, E>(type: T, payload: P, meta: M, error: E): { | ||
type: T; | ||
payload: P; | ||
meta: M; | ||
error: E; | ||
}; | ||
export declare function action<T extends StringType, M>(type: T, payload: undefined, meta: M): { | ||
type: T; | ||
meta: M; | ||
}; | ||
export declare function action<T extends StringType, P, M>(type: T, payload: P, meta: M): { | ||
type: T; | ||
payload: P; | ||
meta: M; | ||
}; | ||
export declare function action<T extends StringType, P>(type: T, payload: P): { | ||
type: T; | ||
payload: P; | ||
}; | ||
export declare function action<T extends StringType>(type: T): { | ||
type: T; | ||
}; |
12 changes: 12 additions & 0 deletions
12
codesandbox/src/typesafe-actions/create-action-deprecated.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { StringType } from './type-helpers'; | ||
interface FSA<T extends StringType, P = {}, M = {}, E = boolean> { | ||
type: T; | ||
payload?: P; | ||
meta?: M; | ||
error?: E; | ||
} | ||
export declare function createActionDeprecated<T extends StringType, AC extends (...args: any[]) => FSA<T>>(actionType: T, creatorFunction: AC): AC; | ||
export declare function createActionDeprecated<T extends StringType, AC extends () => { | ||
type: T; | ||
}>(actionType: T): AC; | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { StringType, ActionCreator } from './type-helpers'; | ||
export declare type PayloadMetaAction<T extends StringType, P, M> = P extends undefined ? M extends undefined ? { | ||
type: T; | ||
} : { | ||
type: T; | ||
meta: M; | ||
} : M extends undefined ? { | ||
type: T; | ||
payload: P; | ||
} : { | ||
type: T; | ||
payload: P; | ||
meta: M; | ||
}; | ||
export declare function createAction<T extends StringType, AC extends ActionCreator<T> = () => { | ||
type: T; | ||
}>(type: T, createHandler?: (actionCallback: <P = undefined, M = undefined>(payload?: P, meta?: M) => PayloadMetaAction<T, P, M>) => AC): AC; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { StringType, ActionBuilderConstructor } from './type-helpers'; | ||
export interface AsyncActionBuilder<T1 extends StringType, T2 extends StringType, T3 extends StringType> { | ||
<P1, P2, P3>(): AsyncActionBuilderConstructor<T1, T2, T3, P1, P2, P3>; | ||
} | ||
export declare type AsyncActionBuilderConstructor<T1 extends StringType, T2 extends StringType, T3 extends StringType, P1, P2, P3> = { | ||
request: ActionBuilderConstructor<T1, P1>; | ||
success: ActionBuilderConstructor<T2, P2>; | ||
failure: ActionBuilderConstructor<T3, P3>; | ||
}; | ||
export declare function createAsyncAction<T1 extends StringType, T2 extends StringType, T3 extends StringType>(requestType: T1, successType: T2, failureType: T3): AsyncActionBuilder<T1, T2, T3>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { ActionCreator, StringType } from './type-helpers'; | ||
export declare function createCustomAction<T extends StringType, AC extends ActionCreator<T> = () => { | ||
type: T; | ||
}>(type: T, createHandler?: (type: T) => AC): AC; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { StringType, ActionBuilderConstructor, ActionBuilderMap } from './type-helpers'; | ||
export interface ActionBuilder<T extends StringType> { | ||
<P = undefined, M = undefined>(): ActionBuilderConstructor<T, P, M>; | ||
map<R, P = undefined, M = undefined>(fn: (payload: P, meta: M) => R): ActionBuilderMap<T, R, P, M>; | ||
} | ||
export declare function createStandardAction<T extends StringType>(type: T): ActionBuilder<T>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import { StringType, ActionCreator, TypeMeta } from './type-helpers'; | ||
export declare function getType<T extends StringType>(actionCreator: ActionCreator<T> & TypeMeta<T>): T; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export { action } from './action'; | ||
export { createAction } from './create-action'; | ||
export { createStandardAction } from './create-standard-action'; | ||
export { createCustomAction } from './create-custom-action'; | ||
export { createAsyncAction } from './create-async-action'; | ||
export { createReducer } from './create-reducer'; | ||
export { getType } from './get-type'; | ||
export { isOfType } from './is-of-type'; | ||
export { isActionOf } from './is-action-of'; | ||
export { ActionType, StateType, ActionCreator, TypeMeta } from './type-helpers'; | ||
export { createActionDeprecated } from './create-action-deprecated'; |
Oops, something went wrong.