From 04c6ea43adea2393a07ad01464743595190fd0d7 Mon Sep 17 00:00:00 2001 From: JC Perez Chavez Date: Wed, 4 Nov 2026 09:34:07 -0500 Subject: [PATCH] Remove $FlowExpectedError[sketchy-null-bool] (resolveIntersection.js) Summary: Replace the two nullable boolean checks `!prop.optional` and `!prop.readonly` with `prop.optional !== true` and `prop.readonly !== true`, and remove their `$FlowExpectedError[sketchy-null-bool]` suppressions. Both flags are `?boolean`. `!x` is true for `undefined`, `null` and `false`, and false only for `true`; `x !== true` gives the same result for every one of those values, so the required and mutable key sets are unchanged. Changelog: [Internal] Differential Revision: D128806000 Pull Request resolved: https://github.com/react/react-native/pull/59764 --- .../typescript/simplifyTypes/resolveIntersection.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/js-api/build-types/transforms/typescript/simplifyTypes/resolveIntersection.js b/scripts/js-api/build-types/transforms/typescript/simplifyTypes/resolveIntersection.js index fd3577c456f..f87633af703 100644 --- a/scripts/js-api/build-types/transforms/typescript/simplifyTypes/resolveIntersection.js +++ b/scripts/js-api/build-types/transforms/typescript/simplifyTypes/resolveIntersection.js @@ -84,13 +84,11 @@ export function resolveIntersection( continue; } - // $FlowExpectedError[sketchy-null-bool] Missing prop is the same as false - if (!prop.optional) { + if (prop.optional !== true) { requiredKeys.add(key); } - // $FlowExpectedError[sketchy-null-bool] Missing prop is the same as false - if (!prop.readonly) { + if (prop.readonly !== true) { mutableKeys.add(key); }