При попытке получить элементы появляется следующая ошибка:
Type 'Observable<unknown[]>' is not assignable to type 'Observable<Event[]>'.
Type 'unknown[]' is not assignable to type 'Event[]'.
Type '{}' is missing the following properties from type 'Event': code, name, password, pollCat
events.service.ts
:
import { Injectable } from '@angular/core';
import { AngularFirestore, AngularFirestoreCollection, AngularFirestoreDocument} from 'angularfire2/firestore';
import { Event } from '../models/events'
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class EventsService {
eventsCollection : AngularFirestoreCollection<Event>;
events : Observable<Event[]>;
constructor(public afs: AngularFirestore) {
this.events = this.afs.collection('Events').valueChanges();
}
getEvents()
{
return this.events;
}
}
events.ts
:
export interface Event{
code: string;
name: string;
password: string;
pollCat : string;
}