Property ‘toDate’ does not exist on type ‘Date’ Angular firestore

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 =;

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. ~~~~ 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?

Source: Angular Questions