I've been stuck in a loop for hours, so here's another tricky question:
Currently inside a lerna
mono repo with two sub projects, namely ProjectA
and ProjectB
.
Both ProjectA
and ProjectB
have a dependency on rxjs
.
In addition, ProjectB
depends on ProjectA
, which is managed by lerna
through symlinks.
The issue arises within ProjectB
, where I have a file containing the following imports:
import { Subject } from 'rxjs/Subject'
import { Observable } from "rxjs/Observable";
Within this file, there is a class with a private variable of type Subject
, exposed as an Observable
. However, TypeScript is throwing the error:
Type '
' is not assignable to type 'Subject<ActionRequestResult<any>>
'. Property 'source' is protected but type 'Observable<ActionRequestResult<any>>
Observable<T>
' is not a class derived from 'Observable<T>
'.
Further investigation reveals that the two rxjs
imports at the top of the file are actually sourced from different locations. Hence, although Subject
extends Observable
, they are not compatible within my file.
I tried installing rxjs
at the root project level (where lerna.json
resides), but since ProjectB
has a dependency on webpack-cli
which transitively relies on rxjs
, it still ends up being installed in ProjectB
.
Uncertain about the next steps, I wonder if this is a bug or a configuration issue?
Given that ProjectA
internally utilizes Subject
, I suspect TypeScript might be misinterpreting the project structure, causing this snag.
Any insights or suggestions?