Not sure if this is an ngrx bug, maybe Angular CLI bug, or if it's even reproducible.
I started a fresh Angular app through the CLI, then added ngrx with ng add @ngrx/store@latest --minimal false as stated in the docs. That gave the following compiler error (v 11.0.0):
ERROR in node_modules/@ngrx/store/src/reducer_creator.d.ts:32:99 - error TS1005: ',' expected.
32 export declare function on<State, Creators extends readonly ActionCreator[]>(...args: [...creators: Creators, reducer: OnReducer<State, Creators>]): ReducerTypes<State, Creators>;
Downgrading to v10.2.1 resolved the issue. Then I uninstalled it completed, reinstalled latest (v11.0.0) with npm install (NOT the cli), and now it works :shrug:.
Able to init Angular app through CLI and install ngrx with Angular CLI as mentioned in the docs
NgRx latest, v11.0.0. Angular v11.2.0, node v.12.1.0, any, MacOS Big Sur
[ ] Yes (Assistance is provided if you need help submitting a pull request)
[x] No - not sure about source of issue
Same issue here @DrewMoody . A compiler error. A new project I started today. installed with npm install not cli
ERROR in node_modules/@ngrx/store/src/reducer_creator.d.ts:32:99 - error TS1005: ',' expected.
32 export declare function on
Downgrading to "@ngrx/store": "^10.1.2" solved it
I was not able to reproduce this.
Can you make sure that you're also on angular v11, and more important typescript v4.1?
@grayey had the same issue. Applied your fix. Worked for me.
Could not reproduce either. Ran the following:
yarn global remove @angular/cli
yarn global add @angular/cli
ng new my-app # selected defaults for all
cd my-app
ng add @ngrx/store@latest --minimal false
with successful output:
ℹ Using package manager: npm
✔ Package information loaded.
✔ Package successfully installed.
CREATE src/app/reducers/index.ts (359 bytes)
UPDATE src/app/app.module.ts (473 bytes)
UPDATE package.json (1225 bytes)
✔ Packages installed successfully.
environment:
Angular CLI: 11.2.1
Node: 14.15.5
OS: darwin x64
Angular: 11.2.1
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1102.1
@angular-devkit/build-angular 0.1102.1
@angular-devkit/core 11.2.1
@angular-devkit/schematics 11.2.1
@schematics/angular 11.2.1
@schematics/update 0.1102.1
rxjs 6.6.3
typescript 4.1.5
I'm closing this issue.
On stackoverflow this error also pops up in multiple questions, in all of the cases the culprit was a lower version of TypeScript.
If this issue is reproducible with the latest angular version, and the latest ngrx version, feel free to reopen (or create a new) this issue with the reproduction.
Downgrading to "@ngrx/store": "^10.1.2" solved it
thank you @grayey
Most helpful comment
Downgrading to "@ngrx/store": "^10.1.2" solved it