Align TurboModule EventEmitter payload types across platforms - #58063
Open
christophpurrer wants to merge 1 commit into
Open
Align TurboModule EventEmitter payload types across platforms#58063christophpurrer wants to merge 1 commit into
christophpurrer wants to merge 1 commit into
Conversation
Summary: Codegen's `EventEmitter<T>` support for TurboModules diverged between platforms in two ways: - The explicit number types `Double`, `Float` and `Int32` worked as emitter payloads on Android and C++, but iOS rejected them at codegen time (plain `number` worked). iOS now maps all of them to `NSNumber *_Nonnull`, matching how plain `number` is already emitted. - `ArrayBuffer` was rejected on Android and iOS, but the C++ generator silently accepted it and produced a `jsi::ArrayBuffer` emitter. `ArrayBuffer` is not emittable on any platform — Android emitters always carry a `folly::dynamic` payload, which cannot hold raw bytes — and the schema type `NativeModuleEventEmitterBaseTypeAnnotation` already excluded it. It is now rejected everywhere. `ArrayBuffer` payloads are rejected in the shared parser, so Flow and TypeScript specs produce the same error, and the three generators keep an equivalent guard so schemas that are constructed without going through the parser fail the same way. `ArrayBuffer` remains supported as a method argument and as a synchronous return value. Changelog: [iOS][Added] - Support `Double`, `Float` and `Int32` payloads for TurboModule `EventEmitter`s [General][Breaking] - Reject `ArrayBuffer` as a TurboModule `EventEmitter` payload on all platforms Differential Revision: D116952150
|
@christophpurrer has exported this pull request. If you are a Meta employee, you can view the originating Diff in D116952150. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Codegen's
EventEmitter<T>support for TurboModules diverged between platformsin two ways:
Double,FloatandInt32worked as emitterpayloads on Android and C++, but iOS rejected them at codegen time (plain
numberworked). iOS now maps all of them toNSNumber *_Nonnull, matchinghow plain
numberis already emitted.ArrayBufferwas rejected on Android and iOS, but the C++ generator silentlyaccepted it and produced a
jsi::ArrayBufferemitter.ArrayBufferis notemittable on any platform — Android emitters always carry a
folly::dynamicpayload, which cannot hold raw bytes — and the schema type
NativeModuleEventEmitterBaseTypeAnnotationalready excluded it. It is nowrejected everywhere.
ArrayBufferpayloads are rejected in the shared parser, so Flow and TypeScriptspecs produce the same error, and the three generators keep an equivalent guard
so schemas that are constructed without going through the parser fail the same
way.
ArrayBufferremains supported as a method argument and as a synchronousreturn value.
Changelog:
[iOS][Added] - Support
Double,FloatandInt32payloads for TurboModuleEventEmitters[General][Breaking] - Reject
ArrayBufferas a TurboModuleEventEmitterpayload on all platformsDifferential Revision: D116952150