Codemod and sign a bunch of out of date files#676
Conversation
Summary: Those js1 files are out of sync. Codemod'ed and signed manually Differential Revision: D95907848
Greptile SummaryThis PR is a codemod that modernizes Flow generic type constraint syntax in
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 8e0cb61 |
Greptile SummaryThis PR applies a codemod to Key concern:
Other observations:
Confidence Score: 2/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["ReactNativeTypes.js\n(@flow strict + @generated)"] --> B["Generic Bound Syntax\nBEFORE: <TElementType: React.ElementType>\nAFTER: <TElementType extends React.ElementType>"]
B --> C{File annotation?}
C -->|"@flow strict still present"| D["Flow type-checker\n❌ 'extends' is invalid Flow syntax\nExpects ':' for bounded generics"]
C -->|"If migrated to TypeScript"| E["TypeScript compiler\n✅ 'extends' is correct TS syntax"]
D --> F["Flow check FAILS\nfor all 5 changed signatures"]
E --> G["Remaining Flow types\n($ReadOnly, opaque type, mixed, ?)\nmust also be migrated"]
Last reviewed commit: 8e0cb61 |
|
|
||
| type InspectorDataGetter = ( | ||
| <TElementType: React.ElementType>( | ||
| <TElementType extends React.ElementType>( |
There was a problem hiding this comment.
Invalid generic bound syntax for a @flow strict file
This file is annotated @flow strict (line 9) and uses Flow-specific constructs throughout ($ReadOnly, $FlowFixMe, opaque type, mixed, ? nullable types). Flow uses the : colon syntax for bounded generics — extends is TypeScript syntax. The codemod changed all five occurrences of <TElementType: React.ElementType> to <TElementType extends React.ElementType>, which is not valid Flow and will cause flow check to fail under strict mode.
The same pattern applies at lines 146, 149, 175, and 178. For example:
| <TElementType extends React.ElementType>( | |
| <TElementType: React.ElementType>( |
All five occurrences would need to be reverted to : unless the file's @flow strict annotation is simultaneously removed and the remaining Flow-specific syntax ($ReadOnly, opaque type, etc.) is also migrated to TypeScript.
Mirror of facebook/react#35989
Original author: marcoww6
Summary: Those js1 files are out of sync. Codemod'ed and signed manually
Differential Revision: D95907848