Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codemod $Shape to Partial in xplat, suppressing errors [4] #36960

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const DUMMY_INSTANCE_KEY = 0;
// Defines map of annotations
// Use as following:
// {string: {key1: value1, key2: value2}}
export type AnnotationsMap = $Shape<{
export type AnnotationsMap = Partial<{
string: ?{[string]: string, ...},
int: ?{[string]: number, ...},
double: ?{[string]: number, ...},
Expand Down
12 changes: 7 additions & 5 deletions packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -892,20 +892,22 @@ type GenericStyleProp<+T> =
| $ReadOnlyArray<GenericStyleProp<T>>;

export type ____DangerouslyImpreciseStyleProp_Internal = GenericStyleProp<
$Shape<____DangerouslyImpreciseStyle_Internal>,
Partial<____DangerouslyImpreciseStyle_Internal>,
>;
export type ____ViewStyleProp_Internal = GenericStyleProp<
$ReadOnly<$Shape<____ViewStyle_Internal>>,
$ReadOnly<Partial<____ViewStyle_Internal>>,
>;
export type ____TextStyleProp_Internal = GenericStyleProp<
$ReadOnly<$Shape<____TextStyle_Internal>>,
$ReadOnly<Partial<____TextStyle_Internal>>,
>;
export type ____ImageStyleProp_Internal = GenericStyleProp<
$ReadOnly<$Shape<____ImageStyle_Internal>>,
$ReadOnly<Partial<____ImageStyle_Internal>>,
>;

export type ____Styles_Internal = {
+[key: string]: $Shape<____DangerouslyImpreciseStyle_Internal>,
// $FlowFixMe[incompatible-exact]
// $FlowFixMe[incompatible-type]
+[key: string]: Partial<____DangerouslyImpreciseStyle_Internal>,
...
};

Expand Down
3 changes: 1 addition & 2 deletions packages/react-native/flow-typed/npm/yargs_v17.x.x.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// flow-typed signature: cab38813101e0a162deaae556391abc8
// flow-typed version: f7c859e705/yargs_v17.x.x/flow_>=v0.104.x

declare module "yargs" {
Expand All @@ -9,7 +8,7 @@ declare module "yargs" {
...
};

declare type Options = $Shape<{
declare type Options = Partial<{
alias: string | Array<string>,
array: boolean,
boolean: boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const Item = ({item, separators}: RenderItemProps<string>) => {
};

type Props = {
exampleProps: $Shape<React.ElementConfig<typeof FlatList>>,
exampleProps: Partial<React.ElementConfig<typeof FlatList>>,
onTest?: ?() => void,
testLabel?: ?string,
testOutput?: ?string,
Expand Down Expand Up @@ -93,11 +93,14 @@ const BaseFlatListExample = React.forwardRef(
{props.children}
<FlatList
{...props.exampleProps}
// $FlowFixMe[incompatible-type]
ref={ref}
testID="flat_list"
// $FlowFixMe[incompatible-type]
data={DATA}
keyExtractor={(item, index) => item + index}
style={styles.list}
// $FlowFixMe[incompatible-type-arg]
renderItem={Item}
/>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const Item = ({item, section, separators}) => {
};

type Props = {
exampleProps: $Shape<React.ElementConfig<typeof SectionList>>,
exampleProps: Partial<React.ElementConfig<typeof SectionList>>,
onTest?: ?() => void,
testLabel?: ?string,
testOutput?: ?string,
Expand Down Expand Up @@ -98,6 +98,7 @@ const SectionListBaseExample: React.AbstractComponent<
ref={ref}
testID="section_list"
accessibilityRole="list"
// $FlowFixMe[incompatible-type]
sections={DATA}
keyExtractor={(item, index) => item + index}
style={styles.list}
Expand Down
2 changes: 1 addition & 1 deletion packages/virtualized-lists/Lists/StateSafePureComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class StateSafePureComponent<
}

setState(
partialState: ?($Shape<State> | ((State, Props) => ?$Shape<State>)),
partialState: ?(Partial<State> | ((State, Props) => ?Partial<State>)),
callback?: () => mixed,
): void {
if (typeof partialState === 'function') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export type Props<ItemT> = {
onUnmount: (cellKey: string) => void,
onUpdateSeparators: (
cellKeys: Array<?string>,
props: $Shape<SeparatorProps<ItemT>>,
props: Partial<SeparatorProps<ItemT>>,
) => void,
prevCellKey: ?string,
renderItem?: ?RenderItemType<ItemT>,
Expand Down
2 changes: 1 addition & 1 deletion packages/virtualized-lists/Lists/VirtualizedSectionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ function ItemWithSeparator(props: ItemWithSeparatorProps): React.Node {
},
updateProps: (
select: 'leading' | 'trailing',
newProps: $Shape<ItemWithSeparatorCommonProps>,
newProps: Partial<ItemWithSeparatorCommonProps>,
) => {
if (select === 'leading') {
if (LeadingSeparatorComponent != null) {
Expand Down