-
Notifications
You must be signed in to change notification settings - Fork 149
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
feat!: Fix the UpdateData incorrect parameter type issue #1887
Conversation
I updated the name to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some pervasive updates required for this PR. Any function that takes a DocumentReference, CollectionReference, etc. must have its template parameter updated to take <AppModelType, DbModelType extends DocumentData>
. For example, BulkWriter.set()
and BulkWriter.delete()
. This includes function signatures that use unknown
as the type for the first type parameter.
Right now this isn't showing up as a compilation error because nodejs-firestore depends on TypeScript 4.7.4; however, if you switch it to 5.1.3 in package.json you get 536 build errors when running npm install
. This is because the newer version of TypeScript does more rigorous type checking, complaining about incompatible type usages that the older version did not detect.
These build errors should be fixed so that we don't break customers who are using the newer versions of TypeScript. Note that this had to be done in the web sdk too.
If you're using IntelliJ you can select the newer version of TypeScript and watch all of the red squigglies show up :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There might need to be some more discussion on the right approach. I have a feeling we might disagree on some of the changes. There are cases where we want to use any
and unknown
, and those discussions might be better handled over GVC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Soooooo close! Just a few very minor nits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two more tiny comments.
7d2fa23
to
2ee882e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add test coverage for calling FirebaseFirestore.getAll() with document references that have type converters, or pin the type parameters back to DocumentData, as it was before this PR.
If you choose to pin the parameters, ONLY pin the types in firestore.d.ts; in index.ts, leave the signature as-is. It is true that they are somewhat out of sync, but this out-of-syncness reduces the diff of this PR and keeps it focussed. |
Port firebase/firebase-js-sdk#7310 to NodeJS