Repository navigation
Remove 6 $FlowFixMe[sketchy-null-*] suppressions (Button, URL, ScrollView, RNTester) - #59211
Closed
jcperez-ch wants to merge 1 commit into
Closed
jcperez-ch wants to merge 1 commit into
jcperez-ch wants to merge 1 commit into
Conversation
…View, RNTester)
Summary:
Replaces six `$FlowFixMe[sketchy-null-string|bool|number]` suppressions with explicit checks that keep the exact runtime behavior, including for `''`, `0` and `NaN`.
- `Button`: `ariaLabel || accessibilityLabel` became `ariaLabel != null && ariaLabel !== '' ? ariaLabel : accessibilityLabel`, so an empty `aria-label` still falls back to `accessibilityLabel`.
- `URL`: in the constructor, `!base` became `base == null || base === ''`. A `URL` instance is always truthy, so this matches the old check.
- `ScrollView` (2): `keyboardShouldPersistTaps` is typed `?('always' | 'never' | 'handled')`, whose values are never falsy. So `!keyboardShouldPersistTaps` is the same as `keyboardShouldPersistTaps == null`.
- RNTester `PressableExample`: `setForce(event.nativeEvent?.force || 1)` became `touchForce != null && Boolean(touchForce) ? touchForce : 1`, reading the value into a local const. `Boolean()` keeps the `0`/`NaN` fallback exactly as `||` did, and `!= null` lets Flow refine the value to `number`.
- RNTester `useJsStalls`: `!state.stallIntervalId` became `!Boolean(state.stallIntervalId)`. The interval ID is an opaque `IntervalID` in the OSS Flow libdefs, so it can't be compared with `0`; `Boolean()` keeps the exact semantics.
No new suppressions, casts, comments, or tests.
Changelog: [Internal]
Differential Revision: D126162944
|
@jcperez-ch has exported this pull request. If you are a Meta employee, you can view the originating Diff in D126162944. |
Collaborator
|
This pull request was successfully merged by @jcperez-ch in a64b21b When will my fix make it into a release? | How to file a pick request? |
|
This pull request has been merged in a64b21b. |
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:
Replaces six
$FlowFixMe[sketchy-null-string|bool|number]suppressions with explicit checks that keep the exact runtime behavior, including for'',0andNaN.Button:ariaLabel || accessibilityLabelbecameariaLabel != null && ariaLabel !== '' ? ariaLabel : accessibilityLabel, so an emptyaria-labelstill falls back toaccessibilityLabel.URL: in the constructor,!basebecamebase == null || base === ''. AURLinstance is always truthy, so this matches the old check.ScrollView(2):keyboardShouldPersistTapsis typed?('always' | 'never' | 'handled'), whose values are never falsy. So!keyboardShouldPersistTapsis the same askeyboardShouldPersistTaps == null.PressableExample:setForce(event.nativeEvent?.force || 1)becametouchForce != null && Boolean(touchForce) ? touchForce : 1, reading the value into a local const.Boolean()keeps the0/NaNfallback exactly as||did, and!= nulllets Flow refine the value tonumber.useJsStalls:!state.stallIntervalIdbecame!Boolean(state.stallIntervalId). The interval ID is an opaqueIntervalIDin the OSS Flow libdefs, so it can't be compared with0;Boolean()keeps the exact semantics.No new suppressions, casts, comments, or tests.
Changelog: [Internal]
Differential Revision: D126162944