Skip to content

Commit 04c6ea4

Browse files
authored
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: #59764
1 parent 45152f1 commit 04c6ea4

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

‎scripts/js-api/build-types/transforms/typescript/simplifyTypes/resolveIntersection.js‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,11 @@ export function resolveIntersection(
8484
continue;
8585
}
8686

87-
// $FlowExpectedError[sketchy-null-bool] Missing prop is the same as false
88-
if (!prop.optional) {
87+
if (prop.optional !== true) {
8988
requiredKeys.add(key);
9089
}
9190

92-
// $FlowExpectedError[sketchy-null-bool] Missing prop is the same as false
93-
if (!prop.readonly) {
91+
if (prop.readonly !== true) {
9492
mutableKeys.add(key);
9593
}
9694

0 commit comments

Comments
 (0)