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

156
Vistas
Type 'Observable<unknown[]>' is not assignable to type 'Observable<User[]>'

I got this error:

Type 'Observable<unknown[]>' is not assignable to type 'Observable<User[]>'.

I'm trying to fetch data from firestore.

I use Observable for the first time (I watch some videos about observable, but here I can't use why I do not understand). Can you help me?

by the way, user is this:

export interface User {
  email: string;
  uid: string;
}

my codes here:

  usersCollection: AngularFirestoreCollection<User>;
  users: Observable<User[]>;
   constructor(public auth: AngularFireAuth, public db: AngularFirestore) {
    **this.users(problem here)** = this.db.collection("users").valueChanges();
  }
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can fix it by passing the User type as a generic parameter to the collection like the following:

this.users = this.db.collection<User>("users").valueChanges();

This will return Observable<User[]> from the valueChanges.

about 4 years ago · Juan Pablo Isaza Denunciar

0

You can use any[] after the variable name to get rid of this error

about 4 years ago · Juan Pablo Isaza 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