the-dr-lazy / deox

Functional Type-safe Flux Standard Utilities
https://deox.js.org
MIT License
206 stars 12 forks source link

fix: type for plain action creator. Fixes #143 #144

Closed SantoJambit closed 4 years ago

SantoJambit commented 4 years ago

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[bot] commented 4 years ago

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%> (ø) :arrow_up:

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 commented 4 years ago

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

the-dr-lazy commented 4 years ago

@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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

@thebrodmann hope this is what you wanted.

SantoJambit commented 4 years ago

@thebrodmann anything missing?

the-dr-lazy commented 4 years ago

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

the-dr-lazy commented 4 years ago

:tada: This PR is included in version 3.2.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

SantoJambit commented 4 years ago

Thanks!

the-dr-lazy commented 3 years ago

:tada: This PR is included in version 3.2.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: