Skip to content

Commit b8d6b17

Browse files
committed
[flow] Upgrade from 0.279 -> 0.280
Flow 0.280 introduced stricter type checking for `incompatible-type` errors, requiring additional $FlowFixMe suppressions alongside existing ones. Changes: - Made `QueuingStrategy` properties optional in streams.js - Made all properties optional in Web Animations API types (EffectTiming, KeyframeAnimationOptions, etc.) - Added `$FlowFixMe[incompatible-type]` alongside existing suppressions in multiple files where Flow now reports additional type mismatches
1 parent 55480b4 commit b8d6b17

File tree

67 files changed

+165
-89
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+165
-89
lines changed

flow-typed/environments/streams.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ type PipeToOptions = {
7878
};
7979

8080
type QueuingStrategy = {
81-
highWaterMark: number,
82-
size(chunk: ?any): number,
81+
highWaterMark?: number,
82+
size?: (chunk: ?any) => number,
8383
...
8484
};
8585

flow-typed/environments/web-animations.js

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,22 @@ type AnimationPlaybackEvent$Init = Event$Init & {
2929
};
3030

3131
type BaseComputedKeyframe = {|
32-
composite: CompositeOperationOrAuto,
33-
computedOffset: number,
34-
easing: string,
35-
offset: number | null,
32+
composite?: CompositeOperationOrAuto,
33+
computedOffset?: number,
34+
easing?: string,
35+
offset?: number | null,
3636
|};
3737

3838
type BaseKeyframe = {|
39-
composite: CompositeOperationOrAuto,
40-
easing: string,
41-
offset: number | null,
39+
composite?: CompositeOperationOrAuto,
40+
easing?: string,
41+
offset?: number | null,
4242
|};
4343

4444
type BasePropertyIndexedKeyframe = {|
45-
composite: CompositeOperationOrAuto | Array<CompositeOperationOrAuto>,
46-
easing: string | Array<string>,
47-
offset: number | null | Array<number | null>,
45+
composite?: CompositeOperationOrAuto | Array<CompositeOperationOrAuto>,
46+
easing?: string | Array<string>,
47+
offset?: number | null | Array<number | null>,
4848
|};
4949

5050
type ComputedEffectTiming = {|
@@ -67,28 +67,33 @@ type DocumentTimelineOptions = {|
6767
|};
6868

6969
type EffectTiming = {|
70-
direction: PlaybackDirection,
71-
easing: string,
72-
fill: FillMode,
73-
iterations: number,
74-
iterationStart: number,
70+
direction?: PlaybackDirection,
71+
easing?: string,
72+
fill?: FillMode,
73+
iterations?: number,
74+
iterationStart?: number,
75+
delay?: number,
76+
duration?: number | string,
77+
endDelay?: number,
7578
|};
7679

7780
type GetAnimationsOptions = {|
78-
pseudoElement: string | null,
79-
subtree: boolean,
81+
pseudoElement?: string | null,
82+
subtree?: boolean,
8083
|};
8184

8285
type KeyframeAnimationOptions = {|
8386
...KeyframeEffectOptions,
84-
id: string,
85-
timeline: AnimationTimeline | null,
87+
id?: string,
88+
timeline?: AnimationTimeline | null,
89+
rangeStart?: string,
90+
rangeEnd?: string,
8691
|};
8792

8893
type KeyframeEffectOptions = {|
8994
...EffectTiming,
90-
composite: CompositeOperation,
91-
pseudoElement: string | null,
95+
composite?: CompositeOperation,
96+
pseudoElement?: string | null,
9297
|};
9398

9499
type Keyframe = {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@
7575
"eslint-plugin-react-internal": "link:./scripts/eslint-rules",
7676
"fbjs-scripts": "^3.0.1",
7777
"filesize": "^6.0.1",
78-
"flow-bin": "^0.279.0",
79-
"flow-remove-types": "^2.279.0",
78+
"flow-bin": "^0.280.0",
79+
"flow-remove-types": "^2.280.0",
8080
"flow-typed": "^4.1.1",
8181
"glob": "^7.1.6",
8282
"glob-stream": "^6.1.0",

packages/internal-test-utils/internalAct.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ export async function act<T>(scope: () => Thenable<T>): Thenable<T> {
165165
}
166166

167167
// $FlowFixMe[incompatible-return]
168+
// $FlowFixMe[incompatible-type]
168169
return result;
169170
} finally {
170171
const depth = actingUpdatesScopeDepth;
@@ -287,6 +288,7 @@ export async function serverAct<T>(scope: () => Thenable<T>): Thenable<T> {
287288
}
288289

289290
// $FlowFixMe[incompatible-return]
291+
// $FlowFixMe[incompatible-type]
290292
return result;
291293
} finally {
292294
if (typeof process === 'object') {

packages/react-client/src/ReactFlightClient.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,7 @@ function triggerErrorOnChunk<T>(
720720
const streamChunk: InitializedStreamChunk<any> = (chunk: any);
721721
const controller = streamChunk.reason;
722722
// $FlowFixMe[incompatible-call]: The error method should accept mixed.
723+
// $FlowFixMe[incompatible-type]
723724
controller.error(error);
724725
return;
725726
}
@@ -3207,6 +3208,7 @@ function startReadableStream<T>(
32073208
error(error: mixed): void {
32083209
if (previousBlockedChunk === null) {
32093210
// $FlowFixMe[incompatible-call]
3211+
// $FlowFixMe[incompatible-type]
32103212
controller.error(error);
32113213
} else {
32123214
const blockedChunk = previousBlockedChunk;

packages/react-client/src/ReactFlightReplyClient.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ export function processReply(
535535

536536
if (isArray(value)) {
537537
// $FlowFixMe[incompatible-return]
538+
// $FlowFixMe[incompatible-type]
538539
return value;
539540
}
540541
// TODO: Should we the Object.prototype.toString.call() to test for cross-realm objects?
@@ -552,6 +553,7 @@ export function processReply(
552553
// $FlowFixMe[prop-missing]: FormData has forEach.
553554
value.forEach((originalValue: string | File, originalKey: string) => {
554555
// $FlowFixMe[incompatible-call]
556+
// $FlowFixMe[incompatible-type]
555557
data.append(prefix + originalKey, originalValue);
556558
});
557559
return serializeFormDataReference(refId);
@@ -829,6 +831,7 @@ export function processReply(
829831
}
830832
modelRoot = model;
831833
// $FlowFixMe[incompatible-return] it's not going to be undefined because we'll encode it.
834+
// $FlowFixMe[incompatible-type]
832835
return JSON.stringify(model, resolveToJSON);
833836
}
834837

@@ -855,6 +858,7 @@ export function processReply(
855858
formData.set(formFieldPrefix + '0', json);
856859
if (pendingParts === 0) {
857860
// $FlowFixMe[incompatible-call] this has already been refined.
861+
// $FlowFixMe[incompatible-type]
858862
resolve(formData);
859863
}
860864
}
@@ -934,6 +938,7 @@ function defaultEncodeFormAction(
934938
// $FlowFixMe[prop-missing]
935939
encodedFormData.forEach((value: string | File, key: string) => {
936940
// $FlowFixMe[incompatible-call]
941+
// $FlowFixMe[incompatible-type]
937942
prefixedData.append('$ACTION_' + identifierPrefix + ':' + key, value);
938943
});
939944
data = prefixedData;
@@ -1184,6 +1189,7 @@ function bind(this: Function): Function {
11841189

11851190
if (!referenceClosure) {
11861191
// $FlowFixMe[incompatible-call]
1192+
// $FlowFixMe[incompatible-type]
11871193
return FunctionBind.apply(this, arguments);
11881194
}
11891195

packages/react-debug-tools/src/ReactDebugHooks.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,9 +726,11 @@ function useActionState<S, P>(
726726

727727
function useHostTransitionStatus(): TransitionStatus {
728728
const status = readContext<TransitionStatus>(
729+
// $FlowFixMe[incompatible-type]
729730
// $FlowFixMe[prop-missing] `readContext` only needs _currentValue
730731
({
731732
// $FlowFixMe[incompatible-cast] TODO: Incorrect bottom value without access to Fiber config.
733+
// $FlowFixMe[incompatible-type]
732734
_currentValue: null,
733735
}: ReactContext<TransitionStatus>),
734736
);

packages/react-devtools-core/src/backend.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ export function connectToDevTools(options: ?ConnectOptions) {
188188
}
189189

190190
// TODO (npm-packages) Warn if "isBackendStorageAPISupported"
191-
// $FlowFixMe[incompatible-call] found when upgrading Flow
191+
// $FlowFixMe[incompatible-type] found when upgrading Flow
192192
const agent = new Agent(bridge, isProfiling, onReloadAndProfile);
193193
if (typeof onReloadAndProfileFlagsReset === 'function') {
194194
onReloadAndProfileFlagsReset();
@@ -212,7 +212,7 @@ export function connectToDevTools(options: ?ConnectOptions) {
212212
// Setup React Native style editor if the environment supports it.
213213
if (resolveRNStyle != null || hook.resolveRNStyle != null) {
214214
setupNativeStyleEditor(
215-
// $FlowFixMe[incompatible-call] found when upgrading Flow
215+
// $FlowFixMe[incompatible-type] found when upgrading Flow
216216
bridge,
217217
agent,
218218
((resolveRNStyle || hook.resolveRNStyle: any): ResolveNativeStyle),

packages/react-devtools-core/src/standalone.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ function initialize(socket: WebSocket) {
265265
socket.close();
266266
});
267267

268-
// $FlowFixMe[incompatible-call] found when upgrading Flow
268+
// $FlowFixMe[incompatible-type] found when upgrading Flow
269269
store = new Store(bridge, {
270270
checkBridgeProtocolCompatibility: true,
271271
supportsTraceUpdates: true,

packages/react-devtools-shared/src/backend/fiber/renderer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4701,7 +4701,7 @@ export function attach(
47014701
return;
47024702
}
47034703
pushOperation(SUSPENSE_TREE_OPERATION_REORDER_CHILDREN);
4704-
// $FlowFixMe[incompatible-call] TODO: Allow filtering SuspenseNode
4704+
// $FlowFixMe[incompatible-type] TODO: Allow filtering SuspenseNode
47054705
pushOperation(parentInstance.instance.id);
47064706
pushOperation(numChildren);
47074707
for (let i = 0; i < nextChildren.length; i++) {

0 commit comments

Comments
 (0)