refactor(database)!: migrate to TypeScript#8977
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Code Review
This pull request migrates the @react-native-firebase/database package to TypeScript, introducing robust type definitions for both modular and namespaced APIs and updating the build infrastructure to use react-native-builder-bob. The changes include refactoring core classes like DatabaseDataSnapshot and DatabaseQuery to .ts and adding a snapshot of the Firebase JS SDK types for comparison. The review feedback suggests aligning the forEach callback signature with the official SDK, removing redundant type casts, and replacing unnecessary as never returns with explicit return statements for better code clarity.
mikehardy
left a comment
There was a problem hiding this comment.
amazing - huge portion of the remaining TS work, ready to go
|
Updated to main and re-pushed to verify things still work since we're not using a merge queue here release notes will come from the commit, so here's the draft of the commit message pulled from the description: BREAKING CHANGE: database types now match firebase-js-sdk as closely as possible Please see https://rnfirebase.io/migrating-to-v25 for help migrating if needed react-native-firebase has a goal to be a drop-in replacement for firebase-js-sdk, with native extensions and performance. It has always worked that way at the javascript level but the typescript types have been divergent We are fixing that as we refactor to typescript. Please bear with us as we get closer to our goal of react-native-firebase matching firebase-js-sdk both in functionality where possible, but also in exact typescript typing. Specifics for Database:
|
Description
Breaking changes
ServerValuenamed export from@react-native-firebase/database; consumers must useserverTimestamp()/increment()or the preserved namespacedfirebase.database.ServerValueAPI instead. 352f44agoOffline(db)andgoOnline(db)so they no longer return a chainable value, which breaks consumer code thatawaits them or calls.then(...)on them. 461786bDatabaseReference,Query,DataSnapshot,OnDisconnect, andQueryConstraintno longer expose the older namespaced instance-style API in their public typings; TypeScript consumers may need to switch to the function-based modular helpers. db5f53bgetServerTime(db)to a synchronousDatereturn in the modular type surface, so TypeScript consumers that previously treated it as promise-like will need to update their code. a8c2fabRelated issues
Release Summary
Checklist
AndroidiOSOther(macOS, web)e2etests added or updated inpackages/\*\*/e2ejesttests added or updated inpackages/\*\*/__tests__Test Plan
Think
react-native-firebaseis great? Please consider supporting the project with any of the below:React Native FirebaseandInvertaseon Twitter