angularfire: AngularFire 7.2 doesn't compile with latest Angular 13.1 and Typescript 4.5

Update Angular & Typescript to latest (13.1.0 and 4.5.3) => ng serve errors in the terminal:

Error: node_modules/@angular/fire/compat/proxy.d.ts:7:49 - error TS2344: Type ‘T[K]’ does not satisfy the constraint ‘(…args: any) => any’. image

Caused by this file: https://github.com/angular/angularfire/blob/master/src/compat/proxy.ts Latest version of Typescript (4.5.3) doesn’t like T[K].

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 18
  • Comments: 21 (2 by maintainers)

Commits related to this issue

Most upvoted comments

Set skipLibCheck: true in your tsconfig for now.

A temporary fix for this is to revert typescript back to 4.4.4:

npm install typescript@4.4.4

skipLibCheck: true worked for me!

I’m also having the same problem:

Version info

Angular: 13.1.1

Firebase: 9.0.0

AngularFire: 7.0.4

Other (e.g. Ionic/Cordova, Node, browser, operating system): Chrome

How to reproduce these conditions

Failing test unit, Stackblitz demonstrating the problem

N/A

Upgrade to Typescript 4.5.3, Angular 13.1.1, AngularFire 7.0.4

Sample data and security rules

N/a

Debug output

** Errors in the JavaScript console **

Error: node_modules/@angular/fire/compat/proxy.d.ts:7:49 - error TS2344: Type ‘T[K]’ does not satisfy the constraint ‘(…args: any) => any’. Type ‘T[FunctionPropertyNames<T>]’ is not assignable to type ‘(…args: any) => any’. Type ‘T[T[keyof T] extends Function ? keyof T : never]’ is not assignable to type ‘(…args: any) => any’. Type ‘T[keyof T]’ is not assignable to type ‘(…args: any) => any’. Type ‘T[string] | T[number] | T[symbol]’ is not assignable to type ‘(…args: any) => any’. Type ‘T[string]’ is not assignable to type ‘(…args: any) => any’.

7 [K in FunctionPropertyNames<T>]: ReturnType<T[K]> extends Promise<any> ? K : never;

** Output from firebase.database().enableLogging(true); ** N/A

** Screenshots **

image

Expected behavior

Angular app compiles without any problems.

Actual behavior

Angular App no longer compiles

Same problem here!

Cutting 7.2.1 with the fix now

Add this 2 lines inside compilerOptions in your tsconfig.json

“skipDefaultLibCheck”: true, “skipLibCheck”: true,

skipLibCheck: true did NOT work for me.

skipLibCheck: true must be inside compilerOptions @GoSkiMN

Can confirm the issue with : “@angular/core”: “~13.1.1”, “@angular/fire”: “^7.2.0”,