-
Notifications
You must be signed in to change notification settings - Fork 938
Updated typings for database methods #6090
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
Conversation
🦋 Changeset detectedLatest commit: 8221684 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Looks good, in addition to the small nit about readonly
(see comments), can you also add a changeset? To do this, run yarn changeset
in the root of the repo and follow the prompts (select database-types
as it suggests, then skip the "major" and "minor" options to let it default to "patch", then write a brief change note like "Updated typings for Reference methods"
packages/database-types/index.d.ts
Outdated
} | ||
|
||
export interface ServerValue { | ||
TIMESTAMP: Object; | ||
increment(delta: number): Object; | ||
} | ||
|
||
export interface TransactionResult { | ||
readonly committed: boolean; |
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.
The properties actually aren't readonly
on the database-compat TransactionResult
class, which is the only place this type will be applied, so it might be best to keep it looser and omit the readonly
keyword:
constructor(public committed: boolean, public snapshot: DataSnapshot) {} |
packages/firebase/compat/index.d.ts
Outdated
/** | ||
* Whether the transaction was successfully committed. | ||
*/ | ||
readonly committed: boolean; |
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.
See above comment regarding readonly
.
@hsubox76 thanks for the review, |
It seems like the Edit: oops, sorry, missed this earlier but the return types on the methods in
Which you can see is causing problems in the CI tests. I actually think |
@hsubox76 ah sorry, totally missed that 🙈
I'll have a go at changing those and see if that works :) |
@hsubox76 I've updated that file but there's still CI failures but its in a file I've not touched (I think anyway) - |
It was a flaky test. I re-ran it and it passed. Everything looks good, will merge! |
Ah great, thanks 👍 |
Fixes #6071. I've also update the return type for the
onComplete
handler that the methods also accept.I've copied the comments for the
TransactionResult
interface from the corresponding@firebase/database
package:firebase-js-sdk/packages/database/src/api/Transaction.ts
Lines 42 to 49 in 14ccbad