-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: type for plain action creator. Fixes #143 #144
fix: type for plain action creator. Fixes #143 #144
Conversation
Release v3.2.0 and v3.1.0
Release v3.2.1
Codecov Report
@@ Coverage Diff @@
## master #144 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 10 10
Lines 56 56
Branches 9 9
=====================================
Hits 56 56
Continue to review full report at Codecov.
|
I'm assuming the deploy fails are not related to my PR. |
@SantoJambit Thank you for submitting this PR. Can you add a test case to DTS tests for this PR? It can check for type checker failure on application of arguments to a nullary function (action creator created by |
Correct me if I'm wrong, but I thought the snapshot already takes care of that: -exports[`createActionCreator createActionCreator('[Todo] truncate') (type) should match snapshot 1`] = `"(<_T>(...args: any[]) => { type: \\"[Todo] truncate\\"; }) & { type: \\"[Todo] truncate\\"; toString(): \\"[Todo] truncate\\"; }"`;
+exports[`createActionCreator createActionCreator('[Todo] truncate') (type) should match snapshot 1`] = `"ExactActionCreator<\\"[Todo] truncate\\", () => { type: \\"[Todo] truncate\\"; }>"`; This shows, that the returned function may not receive any args. |
I think I get what you want.. you want typescript errors in the dts.spec file. As long as this builds, I can try something. |
@thebrodmann hope this is what you wanted. |
@thebrodmann anything missing? |
Absolutely not. Sorry for the latency. Let's go for the release of this honor. |
🎉 This PR is included in version 3.2.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
* fix: type for plain action creator. Fixes #143 * fix: more type tests for createActionCreator * fix: adjustments after code review Co-authored-by: Mohammad Hasani <20781126+thebrodmann@users.noreply.github.com>
Thanks! |
* fix: type for plain action creator. Fixes #143 * fix: more type tests for createActionCreator * fix: adjustments after code review Co-authored-by: Mohammad Hasani <20781126+thebrodmann@users.noreply.github.com>
This reverts commit f228b81.
This reverts commit f228b81.
* fix: type for plain action creator. Fixes #143 * fix: more type tests for createActionCreator * fix: adjustments after code review Co-authored-by: Mohammad Hasani <20781126+thebrodmann@users.noreply.github.com>
🎉 This PR is included in version 3.2.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [3.3.0](v3.2.1...v3.3.0) (2020-10-01) ### Bug Fixes * handle.others instead of handle.default ([ffe271b](ffe271b)) * more explicit typing to avoid TS4025 ([25b78c3](25b78c3)) * type for plain action creator. ([#144](#144)) ([f228b81](f228b81)), closes [#143](#143) ### Features * default handler in createReducer ([0b3dfcf](0b3dfcf)), closes [#152](#152)
## [3.2.2](v3.2.1...v3.2.2) (2020-10-01) ### Bug Fixes * type for plain action creator. ([#144](#144)) ([5a43381](5a43381)), closes [#143](#143) ### Reverts * Revert "fix: type for plain action creator. (#144)" ([52cecce](52cecce)), closes [#144](#144) * Revert "chore(release): 3.2.2 [skip ci]" ([2c24a35](2c24a35)) * Revert "chore(deps): bump acorn from 5.7.3 to 5.7.4 in /examples/tasks" ([8ac4f81](8ac4f81)) * Revert "test: remove redundant tests" ([f3585b0](f3585b0)) * Revert "chore(dependencies): update lockfiles" ([0807302](0807302)) * Revert "feat: default handler in createReducer" ([8dc28bb](8dc28bb)) * Revert "fix: more explicit typing to avoid TS4025" ([c1b1d23](c1b1d23)) * Revert "refactor: create-handler-map.ts" ([12f7519](12f7519)) * Revert "fix: handle.others instead of handle.default" ([0c27324](0c27324)) * Revert "ci: thanks to Circle CI sanctions!" ([b95295f](b95295f)) * Revert "test: fix unknown `default` handler" ([bc569d7](bc569d7))
# [3.3.0](v3.2.1...v3.3.0) (2020-10-01) ### Bug Fixes * handle.others instead of handle.default ([ffe271b](ffe271b)) * more explicit typing to avoid TS4025 ([25b78c3](25b78c3)) * type for plain action creator. ([#144](#144)) ([f228b81](f228b81)), closes [#143](#143) ### Features * default handler in createReducer ([0b3dfcf](0b3dfcf)), closes [#152](#152)
* fix: type for plain action creator. Fixes the-dr-lazy#143 * fix: more type tests for createActionCreator * fix: adjustments after code review Co-authored-by: Mohammad Hasani <20781126+thebrodmann@users.noreply.github.com>
## [3.2.2](the-dr-lazy/deox@v3.2.1...v3.2.2) (2020-03-16) ### Bug Fixes * type for plain action creator. ([the-dr-lazy#144](the-dr-lazy#144)) ([709fe60](the-dr-lazy@709fe60)), closes [the-dr-lazy#143](the-dr-lazy#143)
# [3.3.0](the-dr-lazy/deox@v3.2.1...v3.3.0) (2020-10-01) ### Bug Fixes * handle.others instead of handle.default ([ffe271b](the-dr-lazy@ffe271b)) * more explicit typing to avoid TS4025 ([25b78c3](the-dr-lazy@25b78c3)) * type for plain action creator. ([the-dr-lazy#144](the-dr-lazy#144)) ([f228b81](the-dr-lazy@f228b81)), closes [the-dr-lazy#143](the-dr-lazy#143) ### Features * default handler in createReducer ([0b3dfcf](the-dr-lazy@0b3dfcf)), closes [the-dr-lazy#152](the-dr-lazy#152)
# [3.3.0](v3.2.1...v3.3.0) (2020-10-09) ### Bug Fixes * handle.others instead of handle.default ([ffe271b](ffe271b)) * more explicit typing to avoid TS4025 ([25b78c3](25b78c3)) * type for plain action creator. ([#144](#144)) ([f228b81](f228b81)), closes [#143](#143) ### Features * default handler in createReducer ([0b3dfcf](0b3dfcf)), closes [#152](#152)
# [3.3.0](v3.2.1...v3.3.0) (2020-10-17) ### Bug Fixes * handle.others instead of handle.default ([ffe271b](ffe271b)) * more explicit typing to avoid TS4025 ([25b78c3](25b78c3)) * type for plain action creator. ([#144](#144)) ([f228b81](f228b81)), closes [#143](#143) * use symbol for the `others` handler ([3aa61fe](3aa61fe)) ### Features * default handler in createReducer ([0b3dfcf](0b3dfcf)), closes [#152](#152)
I had to create a new type
ExactActionCreator
since theActionCreator
type did not specify TCallable. ModifyingActionCreator
didn't seem viable since it would introduce a breaking change.Not sure about the name of this new type. maybe you have a better idea.