Skip to content

refactor(storage)!: migrate to TypeScript and match firebase-js-sdk API#8824

Merged
russellwheatley merged 120 commits intomainfrom
storage-typescript
Apr 16, 2026
Merged

refactor(storage)!: migrate to TypeScript and match firebase-js-sdk API#8824
russellwheatley merged 120 commits intomainfrom
storage-typescript

Conversation

@russellwheatley
Copy link
Copy Markdown
Member

@russellwheatley russellwheatley commented Jan 8, 2026

Description

  • First TS migration to completely separate namespaced types from modular. namespaced types live in types/namespaced.ts and are almost identical to previous index.d.ts. This make it a really easy clean up when we switch off namespaced.
  • Matches firebase-js-sdk as close as possible now which includes below noted breaking changes:

Breaking Changes

  • breaking rename StorageReference to Reference to match firebase-js-sdk. See commit
  • breaking remove methods from Reference and put on internal Reference type for modular See commit
  • breaking remove methods from Storage and put on an internal Storage type for modular. See commit
  • breaking Type Reference is now StorageReference. [See commit]
  • breaking rename StorageReference class to Reference. See commit
  • breaking ListOptions updated to match firebase-js-sdk. See commit
  • breaking update ListResult to match firebase-js-sdk. See commit
  • breaking match SettableMetadata, UploadMetadata & FullMetadata. Also using NativeFirebaseError rather than Error. See commit
  • breaking updated TaskState and TaskEvent types to match firebase-js-sdk. See commit
  • breaking remove storage.statics.* types from modular. Need to import individually. See commit
  • breaking Task related API has been moved to match firebase-js-sdk. See commit.
  • breaking refactor!: use ref() instead of refFromUrl like firebase-js-sdk. See commit
  • breaking refactor!: remove toString() modular to match JS SDK. use ref.toString() instead. See commit
  • breaking refactor!: remove child(), use ref() instead to match JS. See commit
  • breaking refactor!: make ListOptions.pageToken nullable like JS SDK. See commit
  • breaking refactor!: update upload api to use UploadMetadata and deprecate md5hash so should use md5Hash See commit

Related issues

Release Summary

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
    • Other (macOS, web)
  • My change includes tests;
    • e2e tests added or updated in packages/\*\*/e2e
    • jest tests added or updated in packages/\*\*/__tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • No

Test Plan


Think react-native-firebase is great? Please consider supporting the project with any of the below:


Note

High Risk
High risk because it introduces breaking API renames (StorageReferenceReference) and reshapes core Storage task/list/ref behaviors and types, which can affect most Storage consumers at compile time and runtime.

Overview
Refactors @react-native-firebase/storage to TypeScript and reorganizes exports around a new types/storage.ts modular surface (with separate types/namespaced.ts kept for backwards compatibility).

Aligns the modular API more closely with the firebase-js-sdk: ref() now supports full gs:///https:// URLs (replacing refFromURL usage), child() and modular toString() helpers are removed in favor of ref(refOrStorage, path) overloads and Reference.toString(), and list option typing/handling is updated to allow nullable fields in modular calls.

Renames the public reference class from StorageReference to Reference, updates task/list internals (StorageTask, StorageListResult) to typed implementations, and adjusts task/error typing to use NativeFirebaseError plus async pause()/resume()/cancel() semantics. CI type-drift checking is extended to include Storage via new compare-types storage-js-sdk.d.ts and packages/storage/config.ts.

Reviewed by Cursor Bugbot for commit 3ee0a27. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel
Copy link
Copy Markdown

vercel bot commented Jan 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-native-firebase Error Error Apr 16, 2026 10:13am

Request Review

@github-actions
Copy link
Copy Markdown

Hello 👋, this PR has been opened for more than 14 days with no activity on it.

If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing!

You have 7 days until this gets closed automatically

@github-actions github-actions bot added the Stale label Jan 29, 2026
@mikehardy mikehardy removed the Stale label Jan 29, 2026
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3ee0a27. Configure here.

Comment thread packages/storage/lib/types/storage.ts
Comment thread packages/storage/lib/StorageTask.ts Outdated
Comment thread packages/storage/e2e/storage.e2e.js
mikehardy and others added 4 commits April 9, 2026 15:32
this was needed for react-native-macos immediately as it runs on 'latest-stable'
in CI, while react-native was pinned to a prior version so CI kept passing

local builds will fail without this though and do need it
…at still have methods (such as StorageReference) and fire console warning incorrectly
@cursor
Copy link
Copy Markdown

cursor bot commented Apr 10, 2026

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Copy link
Copy Markdown
Collaborator

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not as straightforward as app-distribution but still ... reasonably straightforward

some notes as I reviewed, but really only one question on the inclusion of app-check and crashlytics items in an unexpected spot. Resolve that reasonably + merge at will IMHO

Comment thread packages/app/lib/common/index.ts
Comment thread packages/storage/lib/namespaced.ts Outdated
Comment thread tsconfig.json
ListResult,
ListOptions,
} from './storage';
import type EventEmitter from 'react-native/Libraries/vendor/emitter/EventEmitter';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just noting for ambient awareness - react-native is working really hard to define an exported public API and get people to stop calling into the internals (e.g. Libraries/..etc. and we're going to need to clean this up very soon - either current react-native release or in the near future...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you know of an issue tracked and have it handy, put in slack channel, please. I'm thinking of having something that tracks important issues (that have an effect on us maintainers) that posts notifications on slack and this seems like a good use case.

Comment thread packages/storage/lib/types/namespaced.ts
Comment thread packages/storage/lib/types/storage.ts
@russellwheatley
Copy link
Copy Markdown
Member Author

Approval has been granted pending feedback is resolved 🙏

@russellwheatley russellwheatley merged commit 663b57c into main Apr 16, 2026
20 of 22 checks passed
@russellwheatley russellwheatley deleted the storage-typescript branch April 16, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants