Skip to content
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

Merged
merged 5 commits into from
Mar 16, 2020

Conversation

SantoJambit
Copy link
Contributor

I had to create a new type ExactActionCreator since the ActionCreator type did not specify TCallable. Modifying ActionCreator 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.

@codecov
Copy link

codecov bot commented Mar 4, 2020

Codecov Report

Merging #144 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #144   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          10     10           
  Lines          56     56           
  Branches        9      9           
=====================================
  Hits           56     56
Impacted Files Coverage Δ
src/create-action-creator.ts 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d209aba...b997cb5. Read the comment docs.

@SantoJambit
Copy link
Contributor Author

I'm assuming the deploy fails are not related to my PR.

@the-dr-lazy
Copy link
Owner

the-dr-lazy commented Mar 4, 2020

@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 createActionCreator).

@SantoJambit
Copy link
Contributor Author

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.

@SantoJambit
Copy link
Contributor Author

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.

@SantoJambit
Copy link
Contributor Author

@thebrodmann hope this is what you wanted.

@SantoJambit
Copy link
Contributor Author

@thebrodmann anything missing?

@the-dr-lazy
Copy link
Owner

Absolutely not. Sorry for the latency. Let's go for the release of this honor.

@the-dr-lazy the-dr-lazy changed the base branch from master to next March 16, 2020 15:51
@the-dr-lazy the-dr-lazy merged commit 709fe60 into the-dr-lazy:next Mar 16, 2020
the-dr-lazy pushed a commit that referenced this pull request Mar 16, 2020
## [3.2.2](v3.2.1...v3.2.2) (2020-03-16)

### Bug Fixes

* type for plain action creator. ([#144](#144)) ([709fe60](709fe60)), closes [#143](#143)
@the-dr-lazy
Copy link
Owner

🎉 This PR is included in version 3.2.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@the-dr-lazy the-dr-lazy added this to the v3.2.2 milestone Mar 16, 2020
the-dr-lazy added a commit that referenced this pull request Mar 16, 2020
* 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>
@SantoJambit SantoJambit deleted the plain-action-creator branch March 17, 2020 08:58
@SantoJambit
Copy link
Contributor Author

Thanks!

the-dr-lazy added a commit that referenced this pull request Oct 1, 2020
* 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>
the-dr-lazy pushed a commit that referenced this pull request Oct 1, 2020
## [3.2.2](v3.2.1...v3.2.2) (2020-03-16)

### Bug Fixes

* type for plain action creator. ([#144](#144)) ([709fe60](709fe60)), closes [#143](#143)
the-dr-lazy added a commit that referenced this pull request Oct 1, 2020
the-dr-lazy added a commit that referenced this pull request Oct 1, 2020
the-dr-lazy added a commit that referenced this pull request Oct 1, 2020
* 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>
the-dr-lazy pushed a commit that referenced this pull request Oct 1, 2020
## [3.2.2](v3.2.1...v3.2.2) (2020-03-16)

### Bug Fixes

* type for plain action creator. ([#144](#144)) ([709fe60](709fe60)), closes [#143](#143)
@the-dr-lazy
Copy link
Owner

🎉 This PR is included in version 3.2.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

github-actions bot pushed a commit that referenced this pull request Oct 1, 2020
# [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)
github-actions bot pushed a commit that referenced this pull request Oct 1, 2020
## [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))
@the-dr-lazy the-dr-lazy mentioned this pull request Oct 1, 2020
github-actions bot pushed a commit that referenced this pull request Oct 1, 2020
# [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)
Jazzmanpw pushed a commit to Jazzmanpw/deox that referenced this pull request Oct 6, 2020
* 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>
Jazzmanpw pushed a commit to Jazzmanpw/deox that referenced this pull request Oct 6, 2020
Jazzmanpw pushed a commit to Jazzmanpw/deox that referenced this pull request Oct 6, 2020
# [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)
github-actions bot pushed a commit that referenced this pull request Oct 9, 2020
# [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)
github-actions bot pushed a commit that referenced this pull request Oct 17, 2020
# [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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants