Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

195
Views
Angular 2: Two different types with this name exist

In my Angular 2 app, I have following code:

import { Observable } from 'rxjs/Rx';
import { Subscription } from '@angular-cli/ast-tools/node_modules/rxjs/Rx';
...
private broadcastDataSubject: BehaviorSubject<Event>;
...
let sub: Subscription = this.broadcastDataSubject.asObservable().subject(event).subscribe(() => this.bla());

Problem is in the last row, code will not complile because of:

"Type 'Subscription' is not assignable to type 'Subscription'. Two different types with this name exist, but they are unrelated."

I have same code in my second project and it runs without problem.

about 4 years ago · Santiago Trujillo
3 answers
Answer question

0

The problem was that I had 2 same imports:

import { Subscription } from '@angular-cli/ast-tools/node_modules/rxjs/Rx';

One in the component and one in service.

about 4 years ago · Santiago Trujillo Report

0

I was having the same issue until I saw that I was importing my Observable from:

import { Observable } from '@firebase/util';

I changed it to:

import { Observable } from 'rxjs/Observable';

and it was working fine.

about 4 years ago · Santiago Trujillo Report

0

I got this error when I misspelt Observable. In the import I wrote:

import { Observable } from 'rxjs/observable';

where as it should be

import { Observable } from 'rxjs/Observable';

P.S. this was for the version 5.2.11

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!