I am trying to convert timestamp object from Firestore to Date object in TypeScript using toDate().
import { AngularFirestore } from '@angular/fire/firestore';
...
constructor(private database?: AngularFirestore) {...}
...
const someVariable = a.date.toDate();
Although the functionality is working fine in development mode but I am getting TypeScript compile check error. Also I am not able to build prod version (using ng prod) because of this error.
a.date.toDate() ~~~~ src/app/project/some.service.ts:74:36 -
error TS2339: Property 'toDate' does not exist on type 'Date'.
Any suggestions how do I resolve this?