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

Support Typescript 2.4.x #17

Closed
1 of 9 tasks
SethDavenport opened this issue Jul 9, 2017 · 2 comments
Closed
1 of 9 tasks

Support Typescript 2.4.x #17

SethDavenport opened this issue Jul 9, 2017 · 2 comments

Comments

@SethDavenport
Copy link
Member

This is a...

  • feature request
  • bug report
  • usage question

What toolchain are you using for transpilation/bundling?

  • @angular/cli
  • Custom @ngTools/webpack
  • Raw ngc
  • SystemJS
  • Rollup
  • Other

Environment

NodeJS Version:
Typescript Version:
Angular Version:
@angular-redux/store version:
@angular/cli version: (if applicable)
OS:

Link to repo showing the issus

(optional, but helps a lot)

Expected Behaviour:

This should work fine (it does in typescript < 2.4)

import { routerReducer } from '@angular-redux/router';

export const rootReducer = composeReducers(
  combineReducers({
    // ... etc.
    router: routerReducer,
  }));

Actual Behaviour:

You get a TSC error (below).

Stack Trace/Error Message:

ERROR in /Users/sdavenport/code/angular-redux/example-app/src/app/store/reducers.ts (12,19): Argument of type '{ router: routerReducer...' is not assignable to parameter of type 'ReducersMapObject'.
  Property 'router' is incompatible with index signature.
    Type '(state: string, action: RouterAction) => string' is not assignable to type 'Reducer<any>'.
      Types of parameters 'action' and 'action' are incompatible.
        Type 'A' is not assignable to type 'RouterAction'.
          Type 'Action' is not assignable to type 'RouterAction'.
            Property 'payload' is missing in type 'Action'.

Additional Notes:

(optional)

@SethDavenport
Copy link
Member Author

Typescript's stricter checks for higher order functions have exposed a bug in the Redux typings, discussion here: reduxjs/redux#2467

A fix has been merged to Redux but it's waiting for a new npm release. In the meantime we might be able to get away with a downcast in the implementation of routerReducer.

SethDavenport added a commit to SethDavenport/router that referenced this issue Jul 9, 2017
* Updated to Typescript 2.4.1
* Added package-lock.json for npm 5+ users
* Turned on Typescript strict mode.
@SethDavenport
Copy link
Member Author

Fixed in @angular-redux/router@6.3.1.

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

No branches or pull requests

1 participant