Issue
After upgrading to @angular/fire@21.0.0-rc.0, TypeScript compilation fails when calling .toDate() on Timestamp fields from Firestore documents.
Error
TS2339: Property 'toDate' does not exist on type 'FieldValue | WithFieldValue<Timestamp>'.
Property 'toDate' does not exist on type 'FieldValue'.
Reproduction
import { doc, docData, Timestamp } from '@angular/fire/firestore';
interface Member {
createdAt: Timestamp;
}
const member$ = docData(doc(firestore, 'members/123') as DocumentReference<Member>);
member$.subscribe((member) => {
// ERROR: Property 'toDate' does not exist
const date = member?.createdAt.toDate();
});
Environment
- @angular/fire: 21.0.0-rc.0
- @angular/core: 21.0.1
- firebase: 12.6.0 (from 11.8.0)
- TypeScript: 5.9.3
Analysis
Timestamp fields are being typed as FieldValue | WithFieldValue<Timestamp> instead of just Timestamp. The WithFieldValue type (meant for writes) is incorrectly being applied to read operations, causing TypeScript to think the field could be FieldValue, which doesn't have .toDate().
This appears to be a regression from the Firebase SDK v11→v12 upgrade in this RC.
Issue
After upgrading to
@angular/fire@21.0.0-rc.0, TypeScript compilation fails when calling.toDate()onTimestampfields from Firestore documents.Error
Reproduction
Environment
Analysis
Timestampfields are being typed asFieldValue | WithFieldValue<Timestamp>instead of justTimestamp. TheWithFieldValuetype (meant for writes) is incorrectly being applied to read operations, causing TypeScript to think the field could beFieldValue, which doesn't have.toDate().This appears to be a regression from the Firebase SDK v11→v12 upgrade in this RC.