Skip to content
This repository has been archived by the owner on Feb 3, 2020. It is now read-only.

using createAction without type parameters is unsafe #28

Open
mixvar opened this issue May 20, 2019 · 0 comments
Open

using createAction without type parameters is unsafe #28

mixvar opened this issue May 20, 2019 · 0 comments

Comments

@mixvar
Copy link

mixvar commented May 20, 2019

currently:

 // action payload type is '{}' which is almost as bad as any
const anyAction = createAction('increment');

I think it would be safer to default to void or somehow force user to specifying type parameter and be explicit about using any:

const voidAction = createAction('increment'); // same as using <void>

// or
const illegalAction = createAction('increment'); //compile error

// still possible but explicit
const anyAction = createAction<any>('increment');

Tested with typescript 3.4.5 and all strict rules enabled.

mixvar pushed a commit to mixvar/redux-ts-utils that referenced this issue May 21, 2019
- enforce correct number of arguments using fuction overloads
- update README

closes knpwrs#27 and knpwrs#28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant