I'm trying to upgrade my app to use ngrx-4.0.0, using the migration guide.
The 'ng serve' is throwing a lot of typescript erros, like:
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/models.d.ts (6,52): ',' expected.
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/models.d.ts (9,58): ',' expected.
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/models.d.ts (12,59): ',' expected.
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/models.d.ts (15,51): ',' expected.
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/models.d.ts (10,21): Generic type 'ActionReducer
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/models.d.ts (13,18): Generic type 'ActionReducerMap' requires 3 type argument(s).
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/models.d.ts (13,75): Generic type 'ActionReducer
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/models.d.ts (17,15): Generic type 'ActionReducerMap' requires 3 type argument(s).
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/models.d.ts (17,40): Generic type 'ActionReducer
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/models.d.ts (18,21): Generic type 'ActionReducerFactory
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/models.d.ts (20,20): Generic type 'ActionReducer
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/reducer_manager.d.ts (6,68): Generic type 'ActionReducer
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/reducer_manager.d.ts (11,61): Generic type 'ActionReducer
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/reducer_manager.d.ts (16,84): Generic type 'ActionReducerMap' requires 3 type argument(s).
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/reducer_manager.d.ts (16,128): Generic type 'ActionReducerFactory
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/reducer_manager.d.ts (17,77): Generic type 'StoreFeature
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/reducer_manager.d.ts (18,26): Generic type 'StoreFeature
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/reducer_manager.d.ts (19,38): Generic type 'ActionReducer
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/store_module.d.ts (15,53): ',' expected.
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/store_module.d.ts (21,40): ',' expected.
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/store_module.d.ts (22,43): ',' expected.
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/store_module.d.ts (23,43): ',' expected.
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/store_module.d.ts (12,27): Generic type 'StoreFeature
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/store_module.d.ts (17,22): Generic type 'ActionReducerFactory
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/store_module.d.ts (18,20): Generic type 'ActionReducer
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/store_module.d.ts (21,60): Generic type 'ActionReducerMap' requires 3 type argument(s).
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/store_module.d.ts (21,100): Generic type 'ActionReducerMap' requires 3 type argument(s).
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/store_module.d.ts (21,134): Generic type 'StoreConfig' requires 3 type argument(s).
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/store_module.d.ts (22,84): Generic type 'ActionReducerMap' requires 3 type argument(s).
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/store_module.d.ts (22,117): Generic type 'StoreConfig' requires 3 type argument(s).
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/store_module.d.ts (23,83): Generic type 'ActionReducer
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/store_module.d.ts (23,113): Generic type 'StoreConfig' requires 3 type argument(s).
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/state.d.ts (16,57): ',' expected.
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/state.d.ts (20,57): ',' expected.
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/state.d.ts (20,84): Generic type 'StateActionPair' requires 3 type argument(s).
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/state.d.ts (20,142): Generic type 'ActionReducer
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/state.d.ts (20,165): Generic type 'StateActionPair' requires 3 type argument(s).
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/store.d.ts (21,31): ',' expected.
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/store.d.ts (25,46): ',' expected.
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/store.d.ts (25,78): Generic type 'ActionReducer
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/utils.d.ts (2,61): ',' expected.
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/utils.d.ts (2,81): Generic type 'ActionReducerMap' requires 3 type argument(s).
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/utils.d.ts (2,133): Generic type 'ActionReducer
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/utils.d.ts (12,62): Generic type 'ActionReducerFactory
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/utils.d.ts (12,109): Generic type 'ActionReducer
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store/src/utils.d.ts (12,137): Generic type 'ActionReducerFactory
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/effects/src/actions.d.ts (4,32): ',' expected.
ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/effects/src/actions.d.ts (7,40): Generic type 'Actions
' requires 2 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store-devtools/src/reducer.d.ts (37,15): Generic type 'ActionReducer
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store-devtools/src/reducer.d.ts (37,43): Generic type 'ActionReducer
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/@ngrx/store-devtools/src/config.d.ts (5,14): Generic type 'ActionReducer
' requires 3 type argument(s). ERROR in /home/christian/dev/projects/f-cms/node_modules/ngrx-store-freeze/dist/index.d.ts (5,52): Generic type 'ActionReducer
' requires 3 type argument(s).
I don't know if this is something related to my environment, some error when I tried to upgrade them (I have removed the node_modules folder and package-lock.json and installed from zero). Any tips about it?
You need to have at least TypeScript 2.3 or above with version 4. TypeScript 2.4.1 along with RxJS 5.4.2 would be ideal
Getting the same error. I upgraded to typescript Version 2.4.2 and rxjs to 5.4.3 but that does not solve the problem.
@Hosar, I had the same issue, but was able to resolve it with typescript v2.3.4 with rxjs v5.3.0
Have you tried to rm -rf node_modules and then reinstall all the dependencies with npm install? That worked for me :-)
I did the remove of node_modules and reinstall of all packages but that did not fix the issue.
I'm using angular-cli for Angular 4, the problem is with some dependencies, not know exactly which ones.
I was able to fix it with the following packages:
"devDependencies": {
"@angular/animations": "^4.2.0",
"@angular/cli": "^1.2.0",
"@angular/common": "^4.2.0",
"@angular/compiler": "^4.2.0",
"@angular/compiler-cli": "^4.2.0",
"@angular/core": "^4.2.0",
"@angular/forms": "^4.2.0",
"@angular/http": "^4.2.0",
"@angular/material": "^2.0.0-beta.7",
"@angular/platform-browser": "^4.2.0",
"@angular/platform-browser-dynamic": "^4.2.0",
"@angular/platform-server": "^4.2.0",
"@angular/router": "^4.2.0",
"@ngrx/db": "^2.0.1",
"@types/fs-extra": "^2.1.0",
"@types/glob": "^5.0.30",
"@types/jasmine": "2.5.38",
"@types/node": "^7.0.5",
"@types/ora": "^0.3.31",
"@types/rimraf": "^0.0.28",
"chokidar": "^1.7.0",
"chokidar-cli": "^1.2.0",
"codelyzer": "^2.1.1",
"conventional-changelog": "^1.1.4",
"core-js": "^2.4.1",
"coveralls": "^2.13.0",
"cpy-cli": "^1.0.1",
"deep-freeze": "^0.0.1",
"fs-extra": "^2.1.2",
"glob": "^7.1.1",
"hammerjs": "^2.0.8",
"husky": "^0.14.3",
"jasmine": "^2.5.3",
"jasmine-core": "~2.5.2",
"jasmine-marbles": "^0.0.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"lerna": "^2.0.0",
"module-alias": "^2.0.0",
"ngrx-store-freeze": "^0.1.9",
"nyc": "^10.1.2",
"ora": "^1.2.0",
"prettier": "^1.5.2",
"protractor": "~5.1.0",
"reflect-metadata": "^0.1.9",
"rimraf": "^2.5.4",
"rollup": "^0.41.4",
"rxjs": "^5.4.0",
"sorcery": "^0.10.0",
"ts-node": "^3.1.0",
"tslib": "1.6.0",
"tslint": "^4.4.2",
"typescript": "^2.4.0",
"uglify-js": "^2.8.22",
"zone.js": "^0.8.12"
},
"dependencies": {
"@angular/cdk": "^2.0.0-beta.8",
"opencollective": "^1.0.3"
},
Changing from "typescript": "~2.2.0" to "typescript": "~2.3.3" works for me
My config:
"dependencies": {
"@angular/animations": "^4.4.6",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"@ngrx/core": "^1.2.0",
"@ngrx/store": "^4.1.0",
"core-js": "^2.4.1",
"rxjs": "^5.1.0",
"web-animations-js": "^2.3.1",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "^1.4.9",
"@angular/compiler-cli": "^4.0.0",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "~2.3.3"
}
for me it was a wrong import
`
import { combineReducers } from '@ngrx/store/src/utils';
// should be:
import { combineReducers } from '@ngrx/store';
Most helpful comment
You need to have at least TypeScript 2.3 or above with version 4. TypeScript 2.4.1 along with RxJS 5.4.2 would be ideal