From 77c754c73344163906ef9c8fee2aa51abffa2354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Thu, 19 Nov 2026 03:47:19 -0800 Subject: [PATCH 1/2] Enable TypeScript-compatible Flow syntax in the OSS checker Summary: ## Context React Native implementation type improvements use `satisfies` and signed-readonly mapped types. The open-source Flow checker needs an explicit opt-in before source files can adopt these features. ## Changes - Enable `experimental.tslib_syntax=true` in the open-source Flow configuration. - Keep the syntax opt-in separate from the implementation refactors that use it. Changelog: [Internal] Differential Revision: D133191436 --- .flowconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/.flowconfig b/.flowconfig index e8573a844c1..29cdc377447 100644 --- a/.flowconfig +++ b/.flowconfig @@ -43,6 +43,7 @@ flow-typed/ packages/react-native/flow/ [options] +experimental.tslib_syntax=true builtin_lib=core-only emoji=true From fb7549ca0fe50cae9e007342711048d47ffe3fe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Thu, 19 Nov 2026 03:47:19 -0800 Subject: [PATCH 2/2] Type mutable style and event registry builders Summary: ## Context Style splitting builds fresh objects, while the listener registry allocates and deletes event slots. Using readonly API types for these mutable implementation objects requires unnecessary write suppressions. The listener registry is also sparse: event keys need not exist before registration. ## Changes - Derive a mutable view-style builder with a mapped type that removes readonly, keeping readonly style inputs and returned API types. - Make listener-registry slots mutable and optional while preserving readonly event argument tuples and registrations. - Remove six obsolete suppressions for readonly writes and style-builder initialization. - Preserve runtime code, null-prototype registry storage, and existing dynamic-key suppressions. Flow configurations that check React Native implementation source need `experimental.tslib_syntax=true` for signed-readonly mapped types. The preceding configuration-only change provides that opt-in for React Native's OSS validation. Changelog: [Internal] Differential Revision: D132934090 --- .../Libraries/StyleSheet/splitLayoutProps.js | 10 ++++------ .../Libraries/vendor/emitter/EventEmitter.js | 6 +++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/react-native/Libraries/StyleSheet/splitLayoutProps.js b/packages/react-native/Libraries/StyleSheet/splitLayoutProps.js index e37b9b749d0..16dc8d04643 100644 --- a/packages/react-native/Libraries/StyleSheet/splitLayoutProps.js +++ b/packages/react-native/Libraries/StyleSheet/splitLayoutProps.js @@ -10,17 +10,17 @@ import type {ViewStyle} from './StyleSheetTypes'; +type MutableViewStyle = {-readonly [K in keyof ViewStyle]: ViewStyle[K]}; + export default function splitLayoutProps(props: ?ViewStyle): { outer: ?ViewStyle, inner: ?ViewStyle, } { - let outer: ?ViewStyle = null; - let inner: ?ViewStyle = null; + let outer: ?MutableViewStyle = null; + let inner: ?MutableViewStyle = null; if (props != null) { - // $FlowFixMe[incompatible-exact] Will contain a subset of keys from `props`. outer = {}; - // $FlowFixMe[incompatible-exact] Will contain a subset of keys from `props`. inner = {}; for (const prop of Object.keys(props)) { @@ -53,13 +53,11 @@ export default function splitLayoutProps(props: ?ViewStyle): { case 'rowGap': case 'columnGap': case 'gap': - // $FlowFixMe[cannot-write] // $FlowFixMe[incompatible-use] // $FlowFixMe[prop-missing] outer[prop] = props[prop]; break; default: - // $FlowFixMe[cannot-write] // $FlowFixMe[incompatible-use] // $FlowFixMe[prop-missing] inner[prop] = props[prop]; diff --git a/packages/react-native/Libraries/vendor/emitter/EventEmitter.js b/packages/react-native/Libraries/vendor/emitter/EventEmitter.js index 79df1a4f2c2..7fcfb0b43d0 100644 --- a/packages/react-native/Libraries/vendor/emitter/EventEmitter.js +++ b/packages/react-native/Libraries/vendor/emitter/EventEmitter.js @@ -50,7 +50,9 @@ type Registry< Record>, >, > = { - [K in keyof TEventToArgsMap]: Set>, + -readonly [K in keyof TEventToArgsMap]?: Set< + Registration, + >, }; /** @@ -147,7 +149,6 @@ export default class EventEmitter< // $FlowFixMe[incompatible-type] this.#registry = Object.create(null); } else { - // $FlowFixMe[cannot-write] delete this.#registry[eventType]; } } @@ -177,7 +178,6 @@ function allocate< registry[eventType]; if (registrations == null) { registrations = new Set(); - // $FlowFixMe[cannot-write] registry[eventType] = registrations; } return registrations;