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

164
Views
Angular 2: existen dos tipos diferentes con este nombre

En mi aplicación Angular 2, tengo el siguiente código:

 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());

El problema está en la última fila, el código no se compilará debido a:

"El tipo 'Suscripción' no se puede asignar al tipo 'Suscripción'. Existen dos tipos diferentes con este nombre, pero no están relacionados".

Tengo el mismo código en mi segundo proyecto y se ejecuta sin problemas.

about 4 years ago · Santiago Trujillo
3 answers
Answer question

0

El problema era que tenía 2 importaciones iguales :

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

Uno en el componente y otro en servicio .

about 4 years ago · Santiago Trujillo Report

0

Estaba teniendo el mismo problema hasta que vi que estaba importando mi Observable desde:

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

Lo cambié a:

 import { Observable } from 'rxjs/Observable';

y estaba funcionando bien.

about 4 years ago · Santiago Trujillo Report

0

Recibí este error cuando escribí mal Observable . En la importación escribí:

 import { Observable } from 'rxjs/observable';

donde como debe ser

 import { Observable } from 'rxjs/Observable';

PD: esto era para la versión 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!