Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript errors on Firebase Admin v12.0.0 #2438

Closed
petrvecera opened this issue Jan 30, 2024 · 4 comments
Closed

TypeScript errors on Firebase Admin v12.0.0 #2438

petrvecera opened this issue Jan 30, 2024 · 4 comments
Assignees

Comments

@petrvecera
Copy link

petrvecera commented Jan 30, 2024

After update to firebase admin 12.0.0. we are unable to build any of our Firebase functions projects. We don't have problems on 11.11.1. As reported here on the forums #2411

The typescript errors come from inside the firebase libraries.

Env:

  • Node 20
  • Windows & Mac
  • TypeScript 5.3.3
../../node_modules/firebase-functions/lib/common/providers/database.d.ts:80:5 - error TS2416: Property 'child' in type 'DataSnapshot' is not assignable to the same property in base type 'DataSnapshot'.
  Type '(childPath: string) => DataSnapshot' is not assignable to type '(path: string) => DataSnapshot'.
    Call signature return types 'DataSnapshot' and 'DataSnapshot' are incompatible.
      The types of 'forEach' are incompatible between these types.
        Type '(action: (a: DataSnapshot) => boolean | void) => boolean' is not assignable to type '(action: (a: IteratedDataSnapshot) => boolean | void) => boolean'.
          Types of parameters 'action' and 'action' are incompatible.
            Types of parameters 'a' and 'a' are incompatible.
              Type 'DataSnapshot' is not assignable to type 'IteratedDataSnapshot'.
                Types of property 'key' are incompatible.
                  Type 'string | null' is not assignable to type 'string'.
                    Type 'null' is not assignable to type 'string'.

80     child(childPath: string): DataSnapshot;
       ~~~~~

../../node_modules/firebase-functions/lib/common/providers/database.d.ts:100:5 - error TS2416: Property 'forEach' in type 'DataSnapshot' is not assignable to the same property in base type 'DataSnapshot'.
  Type '(action: (a: DataSnapshot) => boolean | void) => boolean' is not assignable to type '(action: (a: IteratedDataSnapshot) => boolean | void) => boolean'.

100     forEach(action: (a: DataSnapshot) => boolean | void): boolean;
        ~~~~~~~


Found 2 errors in the same file, starting at: ../../node_modules/firebase-functions/lib/common/providers/database.d.ts:80

Additional info for the deps in project:

 "dependencies": {
    "@google-cloud/storage": "7.7.0",
    "axios": "1.6.2",
    "axios-retry": "4.0.0",
    "cors": "2.8.5",
    "date-fns": "2.30.0",
    "express": "4.18.2",
    "express-validator": "7.0.1",
    "firebase-admin": "12.0.0",
    "firebase-functions": "4.6.0",
    "firestore-size": "2.0.7",
    "lodash": "4.17.21",
  },
  "devDependencies": {
    "@types/cors": "2.8.17",
    "@types/express": "4.17.21",
    "@types/jest": "29.5.11",
    "@types/lodash": "4.14.202",
    "@types/node": "20.11.10",
    "@typescript-eslint/eslint-plugin": "6.13.1",
    "@typescript-eslint/parser": "6.13.1",
    "eslint": "8.55.0",
    "eslint-config-google": "0.14.0",
    "eslint-plugin-import": "2.29.0",
    "firebase-functions-test": "3.1.0",
    "jest": "29.7.0",
    "ts-jest": "29.1.1",
    "typescript": "5.3.3"
  }

Workaround:
In your tsconfig.json setup:

  "compilerOptions": {
    "skipLibCheck": true,
  },
@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@jibril101
Copy link

any updates on this?

@delebakare
Copy link

Any solution yet. This is affecting deployment

@lahirumaramba
Copy link
Member

lahirumaramba commented May 21, 2024

This should be fixed in the latest release. If you are still facing this issue, we can reopen later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants