Skip to content

Commit fa3ec58

Browse files
fix: keep readonly on instance Event phase declarations for Flow
The instance-level declarations need `readonly` to match their literal types (0, 1, 2, 3). Without readonly, Flow treats them as invariant and rejects the Object.defineProperty value assignments as incompatible-type. The readonly annotation is type-level only (stripped at runtime); the actual runtime fix is writable+configurable on Object.defineProperty. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent a0d70aa commit fa3ec58

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • packages/react-native/src/private/webapis/dom/events

packages/react-native/src/private/webapis/dom/events/Event.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ export default class Event {
5050
static readonly AT_TARGET: 2;
5151
static readonly BUBBLING_PHASE: 3;
5252

53-
NONE: 0;
54-
CAPTURING_PHASE: 1;
55-
AT_TARGET: 2;
56-
BUBBLING_PHASE: 3;
53+
readonly NONE: 0;
54+
readonly CAPTURING_PHASE: 1;
55+
readonly AT_TARGET: 2;
56+
readonly BUBBLING_PHASE: 3;
5757

5858
_bubbles: boolean;
5959
_cancelable: boolean;

0 commit comments

Comments
 (0)