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

Typescript support for Redux4 #100

Merged
merged 3 commits into from
May 27, 2019
Merged

Typescript support for Redux4 #100

merged 3 commits into from
May 27, 2019

Conversation

AbraaoAlves
Copy link
Contributor

Just for Closes #99

@@ -1,11 +1,12 @@
import * as tt from 'typescript-definition-tester'

describe('TypeScript definitions', function () {
this.timeout(4000);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why, but some times compiler waist much time to process the whole test.

a3 :createReducer<number>({ [act1.getType()]: () => 1 }, 0),
a4 :createReducer<boolean>(onOff, true),
a5 :createReducer<number>(onOff, 1)
});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the advantage of combining rather than just creating them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a way to know about Reducer type compatibility between redux-act and redux Reducer type

interface Reducer<S> {
(state: S, action: Redux.AnyAction): S
interface Reducer<S, A extends Redux.Action = Redux.AnyAction> {
(state: S | undefined, action: A): S
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When would the state be undefined in the reduce function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for compatibility with redux Reducer type

It was updated on this PR: reduxjs/redux#2563

@pauldijou pauldijou merged commit 9c0936f into pauldijou:master May 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Typescript support for Redux4
2 participants