Skip to content

Commit

Permalink
set one_sided_type_guards=true in fbsource (#45107)
Browse files Browse the repository at this point in the history
Summary:
This diff enables:
1.  [one-sided type guards](https://flow.org/en/docs/types/type-guards/#one-sided-type-guards) (`implies x is T`), and
2. stricter checking of type guard consistency (see [relevant docs page](https://flow.org/en/docs/types/type-guards/#toc-consistency-checks-of-type-guard-functions)).

To prevent many new errors from being introduced this diff also converts some two-sided type guards to [one-sided](https://flow.org/en/docs/types/type-guards/#one-sided-type-guards) ones.

Pull Request resolved: #45107

Updated the flowconfigs and synced flow_runner/codemods since the change has already been applied there:
```
js1 upgrade www-shared -p flow_runner/codemods
```

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D58874409

fbshipit-source-id: 959a6773701518a1d6aa35e2ec28fd4ce12d2e75
  • Loading branch information
panagosg7 authored and facebook-github-bot committed Jun 21, 2024
1 parent 8a6508c commit f7fe688
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/packages/react-nat
module.name_mapper='^@react-native/dev-middleware$' -> '<PROJECT_ROOT>/packages/dev-middleware'
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/packages/react-native/Libraries/Image/RelativeImageStub'

one_sided_type_guards=true

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
Expand Down

0 comments on commit f7fe688

Please sign in to comment.