I have been attempting to incorporate Typescript into my Firebase project, but unfortunately I am encountering the following errors:
error TS2693: 'Note' only refers to a type, but is being used as a value here.
The code snippet I used is as follows:
interface Note {
image: string;
name: string;
pdf: string;
}
const itemname = Note.name;
Unfortunately, this approach does not seem to be effective.
Below are the import statements:
import {
AngularFirestore,
AngularFirestoreCollection,
AngularFirestoreDocument,
} from '@angular/fire/firestore';
import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import 'rxjs/add/operator/map';
Here is another segment of the code:
export class Advance11Component implements OnInit {
notesCollection: AngularFirestoreCollection<Note>;
notes: Observable<Note[]>;
constructor(private afs: AngularFirestore) {}
ngOnInit(): void {
this.notesCollection = this.afs
.collection('class11AdvancedTheory')
.doc(itemname)
.collection(itemname, (ref) => {
return ref;
});
this.notes = this.notesCollection.valueChanges();
}
}