store icon indicating copy to clipboard operation
store copied to clipboard

Error on redux.dispatch

Open danieldaeschle opened this issue 8 years ago • 23 comments

This is a...

  • [ ] feature request
  • [X] bug report
  • [ ] usage question

What toolchain are you using for transpilation/bundling?

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

Environment

NodeJS Version: 8.11.1 Typescript Version: 2.4.2 Angular Version: 5.0.0 @angular-redux/store version: 7.1.1 @angular/cli version: 1.7.4 OS: Ubuntu 16.04

Expected Behaviour:

It should work :laughing:

Actual Behaviour:

This message on compiling:

ERROR in node_modules/@angular-redux/store/lib/src/components/ng-redux.d.ts(10,31): error TS2420: Class 'NgRedux<RootState>' incorrectly implements interface 'ObservableStore<RootState>'.
  Types of property 'dispatch' are incompatible.
    Type 'Dispatch<RootState>' is not assignable to type 'Dispatch<AnyAction>'.
      Type 'RootState' is not assignable to type 'AnyAction'.
node_modules/@angular-redux/store/lib/src/components/ng-redux.d.ts(37,33): error TS2344: Type 'RootState' does not satisfy the constraint 'Action<any>'.
node_modules/@angular-redux/store/lib/src/components/root-store.d.ts(18,24): error TS2344: Type 'RootState' does not satisfy the constraint 'Action<any>'.
src/app/actions/note.ts(15,31): error TS2345: Argument of type '{ type: string; payload: Note; }' is not assignable to parameter of type 'IAppState'.
  Object literal may only specify known properties, and 'type' does not exist in type 'IAppState'.
src/app/actions/note.ts(19,31): error TS2345: Argument of type '{ type: string; payload: Note; }' is not assignable to parameter of type 'IAppState'.
  Object literal may only specify known properties, and 'type' does not exist in type 'IAppState'.
src/app/components/notedesk/notedesk.component.ts(2,32): error TS2307: Cannot find module '../shared/article.service'.
src/app/components/notedesk/notedesk.component.ts(3,25): error TS2307: Cannot find module '../shared/models/article'.

Additional Notes:

image image image

Message transalted from german:

The argument of type "{ type: string; payload: Note; }" cannot be assigned to the "IAppState" type parameter.
  The object literal can only specify known properties, and "type" is not available in the "IAppState" type.

danieldaeschle avatar Apr 21 '18 13:04 danieldaeschle

https://github.com/noteslab/web/tree/redux

danieldaeschle avatar Apr 21 '18 13:04 danieldaeschle

Updated to newest angular - still same error

danieldaeschle avatar Apr 21 '18 14:04 danieldaeschle

Same thing for me :(

depe6 avatar Apr 23 '18 11:04 depe6

Are you all using Redux 4.0?

fredrik-macrobond avatar Apr 25 '18 07:04 fredrik-macrobond

Newest Version. Should be 4.0

danieldaeschle avatar Apr 25 '18 08:04 danieldaeschle

Same problem here. Only downgrade of Redux to v3.7.2 fixes the issue.

konstantin-roehm avatar Apr 25 '18 11:04 konstantin-roehm

Downgraded to Redux v3.7.2 from Redux 4. I'm using "@angular-redux/store": "7", but still had the same problem. Though when I combined my reducers, I had to specify the IAppState in order for it to work.

export const rootReducer = combineReducers({ common: commonReducer, });

LandSprutte avatar Apr 28 '18 08:04 LandSprutte

Same problem here.

ethanmick avatar Apr 30 '18 23:04 ethanmick

PR to fix this issue: #522

In the mean time I've been just updating the respective .d.ts with dispatch: Dispatch<AnyAction>

christikaes avatar May 02 '18 03:05 christikaes

Working the first time on Redux with angular and facing the same issue. Any help?

akashseth31 avatar May 02 '18 07:05 akashseth31

@akashseth31 it is a bug

danieldaeschle avatar May 02 '18 07:05 danieldaeschle

Is this fixed ?

kyyash avatar May 04 '18 10:05 kyyash

PR isn't merged yet.

danieldaeschle avatar May 04 '18 10:05 danieldaeschle

Any ETA or any workaround ? Please advise.

kyyash avatar May 07 '18 10:05 kyyash

Use ngrx/store

danieldaeschle avatar May 07 '18 10:05 danieldaeschle

i want to use it in conjunction with @angular-redux/form.

kyyash avatar May 07 '18 10:05 kyyash

Then you have to wait for the fix or downgrade redux to version v3.7.2 which has already been said in this issue.

danieldaeschle avatar May 07 '18 10:05 danieldaeschle

if we use angular-redux/store and angular-redux/form, how to we downgrade redux alone when using npm from angular cli ?

kyyash avatar May 07 '18 11:05 kyyash

@kyyash My package.json looks like this.

"@angular-redux/form": "^6.6.0", "@angular-redux/router": "^6.3.1", "@angular-redux/store": "^6.5.7", "redux": "^3.7.2",

kthomas182 avatar May 07 '18 11:05 kthomas182

also add "@types/redux": "3.6.0",

zinderud avatar May 09 '18 16:05 zinderud