feat!: Fix the UpdateData incorrect parameter type issue#1887
feat!: Fix the UpdateData incorrect parameter type issue#1887MarkDuckworth merged 28 commits intomainfrom
Conversation
|
I updated the name to |
dconeybe
left a comment
There was a problem hiding this comment.
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 :)
dconeybe
left a comment
There was a problem hiding this comment.
Soooooo close! Just a few very minor nits.
dconeybe
left a comment
There was a problem hiding this comment.
Two more tiny comments.
7d2fa23 to
2ee882e
Compare
dconeybe
left a comment
There was a problem hiding this comment.
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