question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Angular v15 support

See original GitHub issue

Version info

Angular: 15.0.0

Firebase: 9.14.0

AngularFire: 7.4.1

Node: v16.18.1

NPM: 8.19.2

Operating system: macOS

How to reproduce these conditions

Failing test unit, Stackblitz demonstrating the problem

Steps to set up and reproduce

  1. Angular version upgraded v14 to v15. (blank project)
  2. ng add @angular/fire
  3. ng serve

Sample data and security rules

Debug output

Error: node_modules/@angular/fire/compat/firestore/interfaces.d.ts:13:18 - error TS2430: Interface ‘DocumentSnapshotExists<T>’ incorrectly extends interface ‘DocumentSnapshot<DocumentData>’. The types returned by ‘data(…)’ are incompatible between these types. Type ‘T’ is not assignable to type ‘DocumentData | undefined’. Type ‘T’ is not assignable to type ‘DocumentData’.

13 export interface DocumentSnapshotExists<T> extends firebase.firestore.DocumentSnapshot { ~~~~~~~~~~~~~~~~~~~~~~

node_modules/@angular/fire/compat/firestore/interfaces.d.ts:13:41 13 export interface DocumentSnapshotExists<T> extends firebase.firestore.DocumentSnapshot { ~ This type parameter might need an extends firebase.firestore.DocumentData constraint. node_modules/@angular/fire/compat/firestore/interfaces.d.ts:13:41 13 export interface DocumentSnapshotExists<T> extends firebase.firestore.DocumentSnapshot { ~ This type parameter might need an extends firebase.firestore.DocumentData | undefined constraint.

Error: node_modules/@angular/fire/compat/firestore/interfaces.d.ts:23:18 - error TS2430: Interface ‘QueryDocumentSnapshot<T>’ incorrectly extends interface ‘QueryDocumentSnapshot<DocumentData>’. The types returned by ‘data(…)’ are incompatible between these types. Type ‘T’ is not assignable to type ‘DocumentData’.

23 export interface QueryDocumentSnapshot<T> extends firebase.firestore.QueryDocumentSnapshot { ~~~~~~~~~~~~~~~~~~~~~

node_modules/@angular/fire/compat/firestore/interfaces.d.ts:23:40 23 export interface QueryDocumentSnapshot<T> extends firebase.firestore.QueryDocumentSnapshot { ~ This type parameter might need an extends firebase.firestore.DocumentData constraint.

Error: node_modules/@angular/fire/compat/firestore/interfaces.d.ts:26:18 - error TS2430: Interface ‘QuerySnapshot<T>’ incorrectly extends interface ‘QuerySnapshot<DocumentData>’. Types of property ‘docs’ are incompatible. Type ‘QueryDocumentSnapshot<T>[]’ is not assignable to type ‘QueryDocumentSnapshot<DocumentData>[]’. Type ‘QueryDocumentSnapshot<T>’ is not assignable to type ‘QueryDocumentSnapshot<DocumentData>’. The types returned by ‘data(…)’ are incompatible between these types. Type ‘T’ is not assignable to type ‘DocumentData’.

26 export interface QuerySnapshot<T> extends firebase.firestore.QuerySnapshot { ~~~~~~~~~~~~~

node_modules/@angular/fire/compat/firestore/interfaces.d.ts:26:32 26 export interface QuerySnapshot<T> extends firebase.firestore.QuerySnapshot { ~ This type parameter might need an extends firebase.firestore.DocumentData constraint.

Error: node_modules/@angular/fire/compat/firestore/interfaces.d.ts:29:18 - error TS2430: Interface ‘DocumentChange<T>’ incorrectly extends interface ‘DocumentChange<DocumentData>’. The types returned by ‘doc.data(…)’ are incompatible between these types. Type ‘T’ is not assignable to type ‘DocumentData’.

29 export interface DocumentChange<T> extends firebase.firestore.DocumentChange { ~~~~~~~~~~~~~~

node_modules/@angular/fire/compat/firestore/interfaces.d.ts:29:33 29 export interface DocumentChange<T> extends firebase.firestore.DocumentChange { ~ This type parameter might need an extends firebase.firestore.DocumentData constraint.

** Errors in the JavaScript console **

** Output from firebase.database().enableLogging(true); **

** Screenshots **

Expected behavior

Actual behavior

Issue Analytics

  • State:open
  • Created 10 months ago
  • Reactions:50
  • Comments:30 (1 by maintainers)

github_iconTop GitHub Comments

33reactions
le-plazacommented, Nov 22, 2022

I installed @angular/fire with --force, then went to node_modules/@angular/fire/compat/firestore/interfaces.d.ts

All of this that give errors image

Change it to this image

Basically just adding <T> at the end. Don’t know if that will work for you but it works for me.

8reactions
rgantcommented, Nov 22, 2022

In my experience, nothing gets a developer to mute and then accidentally forget about a ticket faster than a bunch of 👍 posts. Please just react to the ticket and don’t add comments unless they contain useful details for the developers to review.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Update Angular to v15
Angular v15 supports TypeScript version 4.8 or laterlink. In v15, Angular no longer supports TypeScript versions older than 4.8.
Read more >
Angular v15 support #6527 - valor-software/ngx-bootstrap
Installed v10 with angular 15 but got error: Could not resolve dependency: @angular/animations@"^14.0.0" from ngx-bootstrap@10.0.0 in package.
Read more >
Angular on Twitter: "v15 includes range selection support in ...
v15 includes range selection support in the Angular Material slider! To get a range input use: Code snippet demonstrating how to implement range ......
Read more >
Angular v15—She's Here! - Telerik
Angular 15 brings two amazing features out of developer preview: Standalone APIs ... CDK Listbox; Experimental ESBuild Support Improvements ...
Read more >
Angular 15 Has Been Released: What's New In It?
Angular v15 has extended its support for the node. · Angular 15 now only supports TypeScript version 4.8 or older than that. ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found