Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

196
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda