DataPersistence is throwing a build error (using Ivy)
See original GitHub issueExpected Behavior
This is a very basic implementation of an ngrx effect using the DataPersistence.navigation method.
I expected the project to build; although, this is using Angular v9, which isn’t officially supported yet.
Current Behavior
The build fails with a lengthy error message (provided below).
Failure Information (for bugs)
`ERROR in src/app/+state/app.effects.ts:15:7 - error TS2322: Type ‘(_r: ActivatedRouteSnapshot, _state: AppState) => Observable<ActionCreator<“[App] App Launched”, () => TypedAction<“[App] App Launched”>>>’ is not assignable to type ‘(a: ActivatedRouteSnapshot, state?: AppState) => void | Action | Observable<Action>’. Type ‘Observable<ActionCreator<“[App] App Launched”, () => TypedAction<“[App] App Launched”>>>’ is not assignable to type ‘void | Action | Observable<Action>’. Type ‘Observable<ActionCreator<“[App] App Launched”, () => TypedAction<“[App] App Launched”>>>’ is not assignable to type ‘Observable<Action>’. The types of ‘source.operator.call’ are incompatible between these types. Type ‘(subscriber: import(“C:/dev/NxDataPersistenceBug/node_modules/rxjs/internal/Subscriber”).Subscriber<any>, source: any) => import(“C:/dev/NxDataPersistenceBug/node_modules/rxjs/internal/types”).TeardownLogic’ is not assignable to type ‘(subscriber: import(“C:/dev/NxDataPersistenceBug/node_modules/@nrwl/angular/node_modules/rxjs/internal/Subscriber”).Subscriber<any>, source: any) => import(“C:/dev/NxDataPersistenceBug/node_modules/@nrwl/angular/node_modules/rxjs/internal/types”).TeardownLogic’. Types of parameters ‘subscriber’ and ‘subscriber’ are incompatible. Property ‘_parentOrParents’ is missing in type ‘import(“C:/dev/NxDataPersistenceBug/node_modules/@nrwl/angular/node_modules/rxjs/internal/Subscriber”).Subscriber<any>’ but required in type ‘import(“C:/dev/NxDataPersistenceBug/node_modules/rxjs/internal/Subscriber”).Subscriber<any>’.
15 run: (_r: ActivatedRouteSnapshot, _state: AppState) => { ~~~
node_modules/rxjs/internal/Subscription.d.ts:23:15 23 protected _parentOrParents: Subscription | Subscription[]; ~~~~~~~~~~~~~~~~ ‘_parentOrParents’ is declared here. node_modules/@nrwl/angular/src/runtime/nx/data-persistence.d.ts:33:5 33 run(a: ActivatedRouteSnapshot, state?: T): Observable<Action> | Action | void; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The expected type comes from property ‘run’ which is declared here on type ‘HandleNavigationOpts<AppState>’`
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
- Clone this repo
- Npm install
- Ng build
- Observe error
(
If you can provide steps to reproduce from scratch, that would be enormously appreciated (i.e. where the first step is npx create-nx-workspace@latest repro-workspace
)
Context
Please provide any relevant information about your setup:
“dependencies”: { “@angular/animations”: “~9.0.0-rc.11”, “@angular/cdk”: “~9.0.0-rc.8”, “@angular/common”: “~9.0.0-rc.11”, “@angular/compiler”: “~9.0.0-rc.11”, “@angular/core”: “^9.0.0-rc.11”, “@angular/flex-layout”: “^9.0.0-beta.28”, “@angular/forms”: “~9.0.0-rc.11”, “@angular/material”: “^9.0.0-rc.8”, “@angular/platform-browser”: “~9.0.0-rc.11”, “@angular/platform-browser-dynamic”: “~9.0.0-rc.11”, “@angular/router”: “~9.0.0-rc.11”, “@ngrx/effects”: “^8.6.0”, “@ngrx/entity”: “^8.6.0”, “@ngrx/router-store”: “^8.6.0”, “@ngrx/store”: “^8.6.0”, “@ngrx/store-devtools”: “^8.6.0”, “@nrwl/angular”: “^8.12.0”, “@nrwl/workspace”: “^8.12.0”, “rxjs”: “^6.5.3”, “tslib”: “^1.10.0”, “zone.js”: “~0.10.2” }, “devDependencies”: { “@angular-devkit/build-angular”: “^0.900.0-rc.10”, “@angular-devkit/build-ng-packagr”: “~0.900.0-rc.10”, “@angular/cli”: “^9.0.0-rc.10”, “@angular/compiler-cli”: “~9.0.0-rc.11”, “@angular/language-service”: “~9.0.0-rc.11”, “@ngrx/schematics”: “^8.6.0”, “@types/node”: “^13.5.1”, “codelyzer”: “^5.0.0”, “ng-packagr”: “^9.0.0-rc.7”, “prettier”: “^1.19.1”, “ts-node”: “^8.6.2”, “tsickle”: “^0.38.0”, “tslint”: “~5.15.0”, “typescript”: “^3.7.5” }
A minimal reproduction scenario allows us to quickly confirm a bug (or point out coding problem) as well as confirm that we are fixing the right problem.
Failure Logs
Error message provided above.
Other
I know this is Ivy and Typescript 3.7.5, but I’m really curious about why this is breaking. Even if you don’t fix it right away, if you can give me some sort of advice as to where to look in the source code.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
This won’t be the case after #2264 lands.
The reason you are seeing this error message is because the typings are using two different versions of rxjs. If you can align them, it might work. However, I recommend waiting for the official release.
Removing package-lock.json and regenerating it with
npm install
seems to resolve the dependency problem.