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

Mapped type for combineReducers in index.d.ts #2182

Merged
merged 2 commits into from
Jan 5, 2017
Merged

Mapped type for combineReducers in index.d.ts #2182

merged 2 commits into from
Jan 5, 2017

Conversation

mkusher
Copy link
Contributor

@mkusher mkusher commented Jan 5, 2017

From #2177

  1. Added generic interface for Dispatch(from master)
  2. Updated reducer type to support strict null checks
  3. Added mapped type for combineReducers, so that result reducer type can be inferred from arguments

Updated typescript to 2.1.4
Updated typescript-definition-tester to 0.0.5
Updated typescript tests to use proper import
Added mapped type to index.d.ts
Updated Reducer<S> type in index.d.ts
Add strictNullChecks flag to typescript spec
@timdorr
Copy link
Member

timdorr commented Jan 5, 2017

Thanks!

@timdorr timdorr merged commit e90c835 into reduxjs:next Jan 5, 2017
@mkusher mkusher deleted the combine-reducers-type-next branch January 5, 2017 20:07
timdorr pushed a commit that referenced this pull request Jan 5, 2017
* Add mapped type for combineReducers in index.d.ts

Updated typescript to 2.1.4
Updated typescript-definition-tester to 0.0.5
Updated typescript tests to use proper import
Added mapped type to index.d.ts

* add strict null check for reducer

Updated Reducer<S> type in index.d.ts
Add strictNullChecks flag to typescript spec
@drewnoakes
Copy link

This looks great and I'd love to use it. As it's merged to next, is there an npm package containing this definition file somewhere?

@aikoven
Copy link
Collaborator

aikoven commented Jan 29, 2017

@drewnoakes For now you can use updated typings by adding this to your package.json dependencies:

"redux-next": "reactjs/redux#next"

And telling TypeScript to look for Redux typings there:

// tsconfig.json
{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "redux": ["node_modules/redux-next"]
    }
  }
}

@drewnoakes
Copy link

@aikoven thanks very much, this looks great.

To confirm, redux-next is a different NPM package. It should be used in place of redux, or are you suggesting using redux-next in dev-dependencies and only taking its type declarations? Is that even possible?

@aikoven
Copy link
Collaborator

aikoven commented Feb 3, 2017

It is not an NPM package, "reactjs/redux#next means the files from Redux GitHub repository on the next branch. So you'll end up with two versions of Redux in your node_modules, but the next one will be called redux-next. Then you're just telling TS where the typings for redux are.

timdorr pushed a commit that referenced this pull request Apr 25, 2017
* Add mapped type for combineReducers in index.d.ts

Updated typescript to 2.1.4
Updated typescript-definition-tester to 0.0.5
Updated typescript tests to use proper import
Added mapped type to index.d.ts

* add strict null check for reducer

Updated Reducer<S> type in index.d.ts
Add strictNullChecks flag to typescript spec
@MichaelTontchev
Copy link

MichaelTontchev commented May 27, 2017

@aikoven sorry to necro this old thread, but when can we expect this change to go through to @types/redux ?

@aikoven
Copy link
Collaborator

aikoven commented May 29, 2017

@MichaelTontchev Redux typings are bundled with redux NPM package so you don't have to install @types/redux separately.

Unfortunately, we can't release this change without bumping major version of redux, so we have to wait indefinitely until a critical mass of breaking changes forms v4 of Redux.

I'd be happy to put Redux typings to @types, but currently, it would mean that they must be kept in DefinitelyTyped which is not convenient for multiple reasons. Hopefully one day we can use @types while maintaining typings in a separate repo. And I guess this will happen before v4.

@MichaelTontchev
Copy link

Got it.

Just curious: any idea why there is a separate @types/redux, then? Is it different from the typings maintained in this repo?

timdorr pushed a commit that referenced this pull request Oct 22, 2017
* Add mapped type for combineReducers in index.d.ts

Updated typescript to 2.1.4
Updated typescript-definition-tester to 0.0.5
Updated typescript tests to use proper import
Added mapped type to index.d.ts

* add strict null check for reducer

Updated Reducer<S> type in index.d.ts
Add strictNullChecks flag to typescript spec
timdorr pushed a commit that referenced this pull request Oct 22, 2017
* Add mapped type for combineReducers in index.d.ts

Updated typescript to 2.1.4
Updated typescript-definition-tester to 0.0.5
Updated typescript tests to use proper import
Added mapped type to index.d.ts

* add strict null check for reducer

Updated Reducer<S> type in index.d.ts
Add strictNullChecks flag to typescript spec
timdorr pushed a commit that referenced this pull request Oct 23, 2017
* Add mapped type for combineReducers in index.d.ts

Updated typescript to 2.1.4
Updated typescript-definition-tester to 0.0.5
Updated typescript tests to use proper import
Added mapped type to index.d.ts

* add strict null check for reducer

Updated Reducer<S> type in index.d.ts
Add strictNullChecks flag to typescript spec
timdorr pushed a commit that referenced this pull request Nov 3, 2017
* Add mapped type for combineReducers in index.d.ts

Updated typescript to 2.1.4
Updated typescript-definition-tester to 0.0.5
Updated typescript tests to use proper import
Added mapped type to index.d.ts

* add strict null check for reducer

Updated Reducer<S> type in index.d.ts
Add strictNullChecks flag to typescript spec
timdorr pushed a commit that referenced this pull request Nov 16, 2017
* Add mapped type for combineReducers in index.d.ts

Updated typescript to 2.1.4
Updated typescript-definition-tester to 0.0.5
Updated typescript tests to use proper import
Added mapped type to index.d.ts

* add strict null check for reducer

Updated Reducer<S> type in index.d.ts
Add strictNullChecks flag to typescript spec
seantcoyote pushed a commit to seantcoyote/redux that referenced this pull request Jan 14, 2018
* Add mapped type for combineReducers in index.d.ts

Updated typescript to 2.1.4
Updated typescript-definition-tester to 0.0.5
Updated typescript tests to use proper import
Added mapped type to index.d.ts

* add strict null check for reducer

Updated Reducer<S> type in index.d.ts
Add strictNullChecks flag to typescript spec
tomipaul pushed a commit to tomipaul/redux that referenced this pull request Apr 8, 2018
* Add mapped type for combineReducers in index.d.ts

Updated typescript to 2.1.4
Updated typescript-definition-tester to 0.0.5
Updated typescript tests to use proper import
Added mapped type to index.d.ts

* add strict null check for reducer

Updated Reducer<S> type in index.d.ts
Add strictNullChecks flag to typescript spec
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.

5 participants