Skip to content

Property 'child' in type 'DataSnapshot' is not assignable to the same property in base type 'DataSnapshot'. after updating firebase-admin to v12.0.0 #1513

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

Closed
sceee opened this issue Jan 17, 2024 · 5 comments

Comments

@sceee
Copy link

sceee commented Jan 17, 2024

Related issues

Similar/the same issue as the closed issues #1442 and #1444 and #1496 (comment)

I am just reopening this so it gets attention as the comments in the closed issues might be overlooked.

[REQUIRED] Version info

node: v18.18.0

firebase-functions: 4.6.0

firebase-tools: 13.0.3

firebase-admin: 12.0.0

[REQUIRED] Test case

Occurs during build.

[REQUIRED] Steps to reproduce

Build.

[REQUIRED] Expected behavior

No typescript compile error.

[REQUIRED] Actual behavior

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;

Were you able to successfully deploy your functions?

No, as they cannot be built.

@google-oss-bot
Copy link
Collaborator

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@Ax0elz
Copy link

Ax0elz commented Jan 20, 2024

This seems like a regression that needs a hot fix ASAP. Can't use any of the aggregation since this forces you to downgrade the admin sdk version.

@mariopepe
Copy link

I am getting this error right now with:

  "dependencies": {
    "@faker-js/faker": "^8.4.0",
    "@types/google-libphonenumber": "^7.4.30",
    "@types/nodemailer": "^6.4.14",
    "axios": "^1.6.7",
    "firebase-admin": "^12.0.0",
    "firebase-functions": "^4.6.0",
    "fp-ts": "^2.16.2",
    "google-libphonenumber": "^3.2.34",
    "meilisearch": "^0.37.0",
    "nodemailer": "^6.9.8",
    "urlcat": "^3.1.0",
    "uuid": "^9.0.1"
  },

The error I get is:

npm run build

> build
> tsc

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

@kmiterror
Copy link

same error here
firebase-admin 12.0.0 and firebase-function 4.6.0 are somewhat incompatible

@exaby73
Copy link
Contributor

exaby73 commented Feb 7, 2024

This is fixed in #1517. I will close this issue for the same reason

@exaby73 exaby73 closed this as completed Feb 7, 2024
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

6 participants