Skip to content

Commit 4f0bd0e

Browse files
marcoww6meta-codesync[bot]
authored andcommitted
Codemod : to extends to a few react-native-github package (#56025)
Summary: Pull Request resolved: #56025 Flow is migrating from colon style type parameter bound to `extends` Changelog:[internal] Reviewed By: SamChou19815 Differential Revision: D95867062 fbshipit-source-id: 201483bcbae9b628c8fbd9ffda70d8adfa3a2dc6
1 parent 665b801 commit 4f0bd0e

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

packages/react-native-codegen/src/CodegenSchema.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,15 @@ export type ReservedTypeAnnotation = Readonly<{
265265
/**
266266
* NativeModule Types
267267
*/
268-
export type Nullable<+T: NativeModuleTypeAnnotation> =
268+
export type Nullable<+T extends NativeModuleTypeAnnotation> =
269269
| NullableTypeAnnotation<T>
270270
| T;
271271

272-
export type NullableTypeAnnotation<+T: NativeModuleTypeAnnotation> = Readonly<{
273-
type: 'NullableTypeAnnotation',
274-
typeAnnotation: T,
275-
}>;
272+
export type NullableTypeAnnotation<+T extends NativeModuleTypeAnnotation> =
273+
Readonly<{
274+
type: 'NullableTypeAnnotation',
275+
typeAnnotation: T,
276+
}>;
276277

277278
export type NativeModuleSchema = Readonly<{
278279
type: 'NativeModule',
@@ -316,7 +317,7 @@ export type NativeModuleObjectTypeAnnotation = ObjectTypeAnnotation<
316317
>;
317318

318319
export type NativeModuleArrayTypeAnnotation<
319-
+T: Nullable<NativeModuleBaseTypeAnnotation>,
320+
+T extends Nullable<NativeModuleBaseTypeAnnotation>,
320321
> = ArrayTypeAnnotation<
321322
| T
322323
/**

packages/react-native-codegen/src/parsers/parsers-commons.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function wrapModuleSchema(
107107
}
108108

109109
// $FlowFixMe[unsupported-variance-annotation]
110-
function unwrapNullable<+T: NativeModuleTypeAnnotation>(
110+
function unwrapNullable<+T extends NativeModuleTypeAnnotation>(
111111
x: Nullable<T>,
112112
): [T, boolean] {
113113
if (x.type === 'NullableTypeAnnotation') {
@@ -118,7 +118,7 @@ function unwrapNullable<+T: NativeModuleTypeAnnotation>(
118118
}
119119

120120
// $FlowFixMe[unsupported-variance-annotation]
121-
function wrapNullable<+T: NativeModuleTypeAnnotation>(
121+
function wrapNullable<+T extends NativeModuleTypeAnnotation>(
122122
nullable: boolean,
123123
typeAnnotation: T,
124124
): Nullable<T> {

0 commit comments

Comments
 (0)