diff --git a/flow-typed/environments/streams.js b/flow-typed/environments/streams.js index 17bfae29e61..ce7ab0b394e 100644 --- a/flow-typed/environments/streams.js +++ b/flow-typed/environments/streams.js @@ -42,7 +42,7 @@ declare class ReadableStreamReader { closed: boolean; - cancel(reason: string): void; + cancel(reason: mixed): Promise; read(): Promise<{ value: ?any, done: boolean, @@ -57,7 +57,7 @@ declare interface UnderlyingSource { start?: (controller: ReadableStreamController) => ?Promise; pull?: (controller: ReadableStreamController) => ?Promise; - cancel?: (reason: string) => ?Promise; + cancel?: (reason: mixed) => ?Promise; } declare class TransformStream { @@ -78,8 +78,8 @@ type PipeToOptions = { }; type QueuingStrategy = { - highWaterMark: number, - size(chunk: ?any): number, + highWaterMark?: number, + size?: (chunk: ?any) => number, ... }; @@ -91,7 +91,7 @@ declare class ReadableStream { locked: boolean; - cancel(reason: string): void; + cancel(reason: mixed): Promise; getReader(): ReadableStreamReader; pipeThrough(transform: PipeThroughTransformStream, options: ?any): void; pipeTo(dest: WritableStream, options: ?PipeToOptions): Promise; @@ -106,7 +106,7 @@ declare interface UnderlyingSink { autoAllocateChunkSize?: number; type?: string; - abort?: (reason: string) => ?Promise; + abort?: (reason: mixed) => ?Promise; close?: (controller: WritableStreamController) => ?Promise; start?: (controller: WritableStreamController) => ?Promise; write?: (chunk: any, controller: WritableStreamController) => ?Promise; diff --git a/flow-typed/environments/web-animations.js b/flow-typed/environments/web-animations.js index ac059631f7c..92092d2c9dd 100644 --- a/flow-typed/environments/web-animations.js +++ b/flow-typed/environments/web-animations.js @@ -29,22 +29,22 @@ type AnimationPlaybackEvent$Init = Event$Init & { }; type BaseComputedKeyframe = {| - composite: CompositeOperationOrAuto, - computedOffset: number, - easing: string, - offset: number | null, + composite?: CompositeOperationOrAuto, + computedOffset?: number, + easing?: string, + offset?: number | null, |}; type BaseKeyframe = {| - composite: CompositeOperationOrAuto, - easing: string, - offset: number | null, + composite?: CompositeOperationOrAuto, + easing?: string, + offset?: number | null, |}; type BasePropertyIndexedKeyframe = {| - composite: CompositeOperationOrAuto | Array, - easing: string | Array, - offset: number | null | Array, + composite?: CompositeOperationOrAuto | Array, + easing?: string | Array, + offset?: number | null | Array, |}; type ComputedEffectTiming = {| @@ -67,28 +67,33 @@ type DocumentTimelineOptions = {| |}; type EffectTiming = {| - direction: PlaybackDirection, - easing: string, - fill: FillMode, - iterations: number, - iterationStart: number, + direction?: PlaybackDirection, + easing?: string, + fill?: FillMode, + iterations?: number, + iterationStart?: number, + delay?: number, + duration?: number | string, + endDelay?: number, |}; type GetAnimationsOptions = {| - pseudoElement: string | null, - subtree: boolean, + pseudoElement?: string | null, + subtree?: boolean, |}; type KeyframeAnimationOptions = {| ...KeyframeEffectOptions, - id: string, - timeline: AnimationTimeline | null, + id?: string, + timeline?: AnimationTimeline | null, + rangeStart?: string, + rangeEnd?: string, |}; type KeyframeEffectOptions = {| ...EffectTiming, - composite: CompositeOperation, - pseudoElement: string | null, + composite?: CompositeOperation, + pseudoElement?: string | null, |}; type Keyframe = { @@ -177,6 +182,7 @@ declare class KeyframeEffect extends AnimationEffect { constructor(source: KeyframeEffect): void; target: Element | null; + pseudoElement: string | null; composite: CompositeOperation; // This is actually web-animations-2 iterationComposite: IterationCompositeOperation; diff --git a/package.json b/package.json index 6969bc14f86..a6296bc8259 100644 --- a/package.json +++ b/package.json @@ -75,8 +75,8 @@ "eslint-plugin-react-internal": "link:./scripts/eslint-rules", "fbjs-scripts": "^3.0.1", "filesize": "^6.0.1", - "flow-bin": "^0.279.0", - "flow-remove-types": "^2.279.0", + "flow-bin": "^0.282.0", + "flow-remove-types": "^2.282.0", "flow-typed": "^4.1.1", "glob": "^7.1.6", "glob-stream": "^6.1.0", diff --git a/packages/internal-test-utils/internalAct.js b/packages/internal-test-utils/internalAct.js index 1a420bcf203..0bd87ef0457 100644 --- a/packages/internal-test-utils/internalAct.js +++ b/packages/internal-test-utils/internalAct.js @@ -165,6 +165,7 @@ export async function act(scope: () => Thenable): Thenable { } // $FlowFixMe[incompatible-return] + // $FlowFixMe[incompatible-type] return result; } finally { const depth = actingUpdatesScopeDepth; @@ -287,6 +288,7 @@ export async function serverAct(scope: () => Thenable): Thenable { } // $FlowFixMe[incompatible-return] + // $FlowFixMe[incompatible-type] return result; } finally { if (typeof process === 'object') { diff --git a/packages/react-client/src/ReactClientConsoleConfigBrowser.js b/packages/react-client/src/ReactClientConsoleConfigBrowser.js index f67e4afa0c4..3a8625177ea 100644 --- a/packages/react-client/src/ReactClientConsoleConfigBrowser.js +++ b/packages/react-client/src/ReactClientConsoleConfigBrowser.js @@ -35,7 +35,7 @@ export function bindToConsole( case 'groupEnd': case 'table': { // These methods cannot be colorized because they don't take a formatting string. - // $FlowFixMe + // $FlowFixMe[incompatible-type] return bind.apply(console[methodName], [console].concat(args)); // eslint-disable-line react-internal/no-production-logging } case 'assert': { @@ -68,6 +68,7 @@ export function bindToConsole( // The "this" binding in the "bind"; newArgs.unshift(console); - // $FlowFixMe + // $FlowFixMe[incompatible-type] + // $FlowFixMe[invalid-computed-prop] return bind.apply(console[methodName], newArgs); // eslint-disable-line react-internal/no-production-logging } diff --git a/packages/react-client/src/ReactClientConsoleConfigPlain.js b/packages/react-client/src/ReactClientConsoleConfigPlain.js index ee4c87ca613..3841007b492 100644 --- a/packages/react-client/src/ReactClientConsoleConfigPlain.js +++ b/packages/react-client/src/ReactClientConsoleConfigPlain.js @@ -25,7 +25,7 @@ export function bindToConsole( case 'groupEnd': case 'table': { // These methods cannot be colorized because they don't take a formatting string. - // $FlowFixMe + // $FlowFixMe[incompatible-type] return bind.apply(console[methodName], [console].concat(args)); // eslint-disable-line react-internal/no-production-logging } case 'assert': { @@ -49,6 +49,7 @@ export function bindToConsole( // The "this" binding in the "bind"; newArgs.unshift(console); - // $FlowFixMe + // $FlowFixMe[incompatible-type] + // $FlowFixMe[invalid-computed-prop] return bind.apply(console[methodName], newArgs); // eslint-disable-line react-internal/no-production-logging } diff --git a/packages/react-client/src/ReactClientConsoleConfigServer.js b/packages/react-client/src/ReactClientConsoleConfigServer.js index 6e69ef12a3c..6663549fbd7 100644 --- a/packages/react-client/src/ReactClientConsoleConfigServer.js +++ b/packages/react-client/src/ReactClientConsoleConfigServer.js @@ -36,7 +36,7 @@ export function bindToConsole( case 'groupEnd': case 'table': { // These methods cannot be colorized because they don't take a formatting string. - // $FlowFixMe + // $FlowFixMe[incompatible-type] return bind.apply(console[methodName], [console].concat(args)); // eslint-disable-line react-internal/no-production-logging } case 'assert': { @@ -69,6 +69,7 @@ export function bindToConsole( // The "this" binding in the "bind"; newArgs.unshift(console); - // $FlowFixMe + // $FlowFixMe[incompatible-type] + // $FlowFixMe[invalid-computed-prop] return bind.apply(console[methodName], newArgs); // eslint-disable-line react-internal/no-production-logging } diff --git a/packages/react-client/src/ReactFlightClient.js b/packages/react-client/src/ReactFlightClient.js index 49da30ccf4c..4beb9fe6617 100644 --- a/packages/react-client/src/ReactFlightClient.js +++ b/packages/react-client/src/ReactFlightClient.js @@ -283,12 +283,12 @@ ReactPromise.prototype.then = function ( const rejectCallback = reject; const wrapperPromise: Promise = new Promise((res, rej) => { resolve = value => { - // $FlowFixMe + // $FlowFixMe[prop-missing] wrapperPromise._debugInfo = this._debugInfo; res(value); }; reject = reason => { - // $FlowFixMe + // $FlowFixMe[prop-missing] wrapperPromise._debugInfo = this._debugInfo; rej(reason); }; @@ -720,6 +720,7 @@ function triggerErrorOnChunk( const streamChunk: InitializedStreamChunk = (chunk: any); const controller = streamChunk.reason; // $FlowFixMe[incompatible-call]: The error method should accept mixed. + // $FlowFixMe[incompatible-type] controller.error(error); return; } @@ -3207,6 +3208,7 @@ function startReadableStream( error(error: mixed): void { if (previousBlockedChunk === null) { // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] controller.error(error); } else { const blockedChunk = previousBlockedChunk; @@ -3920,7 +3922,7 @@ function initializeDebugInfo( } if (debugInfo.owner == null && response._debugRootOwner != null) { const componentInfoOrAsyncInfo: ReactComponentInfo | ReactAsyncInfo = - // $FlowFixMe: By narrowing `owner` to `null`, we narrowed `debugInfo` to `ReactComponentInfo` + // $FlowFixMe[incompatible-type]: By narrowing `owner` to `null`, we narrowed `debugInfo` to `ReactComponentInfo` debugInfo; // $FlowFixMe[cannot-write] componentInfoOrAsyncInfo.owner = response._debugRootOwner; @@ -4266,7 +4268,7 @@ function logComponentInfo( childrenEndTime: number, isLastComponent: boolean, ): void { - // $FlowFixMe: Refined. + // $FlowFixMe[incompatible-use]: Refined. if ( isLastComponent && root.status === ERRORED && @@ -4445,7 +4447,7 @@ function flushComponentPerformance( if (componentEndTime > childrenEndTime) { childrenEndTime = componentEndTime; } - // $FlowFixMe: Refined. + // $FlowFixMe[incompatible-type]: Refined. const componentInfo: ReactComponentInfo = candidateInfo; logComponentInfo( response, @@ -4469,7 +4471,7 @@ function flushComponentPerformance( if (endTime > childrenEndTime) { childrenEndTime = endTime; } - // $FlowFixMe: Refined. + // $FlowFixMe[incompatible-type]: Refined. const asyncInfo: ReactAsyncInfo = candidateInfo; const env = response._rootEnvironmentName; const promise = asyncInfo.awaited.value; @@ -4532,7 +4534,7 @@ function flushComponentPerformance( if (componentEndTime > childrenEndTime) { childrenEndTime = componentEndTime; } - // $FlowFixMe: Refined. + // $FlowFixMe[incompatible-type]: Refined. const componentInfo: ReactComponentInfo = candidateInfo; const env = response._rootEnvironmentName; logComponentAborted( diff --git a/packages/react-client/src/ReactFlightClientStreamConfigNode.js b/packages/react-client/src/ReactFlightClientStreamConfigNode.js index f544759ccce..c043447398c 100644 --- a/packages/react-client/src/ReactFlightClientStreamConfigNode.js +++ b/packages/react-client/src/ReactFlightClientStreamConfigNode.js @@ -15,7 +15,7 @@ export function createStringDecoder(): StringDecoder { return new TextDecoder(); } -const decoderOptions = {stream: true}; +const decoderOptions: {stream?: boolean, ...} = {stream: true}; export function readPartialStringChunk( decoder: StringDecoder, diff --git a/packages/react-client/src/ReactFlightReplyClient.js b/packages/react-client/src/ReactFlightReplyClient.js index f75f54f4ead..0b0e71b6a3a 100644 --- a/packages/react-client/src/ReactFlightReplyClient.js +++ b/packages/react-client/src/ReactFlightReplyClient.js @@ -535,6 +535,7 @@ export function processReply( if (isArray(value)) { // $FlowFixMe[incompatible-return] + // $FlowFixMe[incompatible-type] return value; } // TODO: Should we the Object.prototype.toString.call() to test for cross-realm objects? @@ -552,6 +553,7 @@ export function processReply( // $FlowFixMe[prop-missing]: FormData has forEach. value.forEach((originalValue: string | File, originalKey: string) => { // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] data.append(prefix + originalKey, originalValue); }); return serializeFormDataReference(refId); @@ -829,6 +831,7 @@ export function processReply( } modelRoot = model; // $FlowFixMe[incompatible-return] it's not going to be undefined because we'll encode it. + // $FlowFixMe[incompatible-type] return JSON.stringify(model, resolveToJSON); } @@ -855,6 +858,7 @@ export function processReply( formData.set(formFieldPrefix + '0', json); if (pendingParts === 0) { // $FlowFixMe[incompatible-call] this has already been refined. + // $FlowFixMe[incompatible-type] resolve(formData); } } @@ -934,6 +938,7 @@ function defaultEncodeFormAction( // $FlowFixMe[prop-missing] encodedFormData.forEach((value: string | File, key: string) => { // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] prefixedData.append('$ACTION_' + identifierPrefix + ':' + key, value); }); data = prefixedData; @@ -1184,6 +1189,7 @@ function bind(this: Function): Function { if (!referenceClosure) { // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] return FunctionBind.apply(this, arguments); } diff --git a/packages/react-debug-tools/src/ReactDebugHooks.js b/packages/react-debug-tools/src/ReactDebugHooks.js index db9495a97dd..89f4609e289 100644 --- a/packages/react-debug-tools/src/ReactDebugHooks.js +++ b/packages/react-debug-tools/src/ReactDebugHooks.js @@ -726,9 +726,11 @@ function useActionState( function useHostTransitionStatus(): TransitionStatus { const status = readContext( + // $FlowFixMe[incompatible-type] // $FlowFixMe[prop-missing] `readContext` only needs _currentValue ({ // $FlowFixMe[incompatible-cast] TODO: Incorrect bottom value without access to Fiber config. + // $FlowFixMe[incompatible-type] _currentValue: null, }: ReactContext), ); diff --git a/packages/react-dom-bindings/src/client/DOMPropertyOperations.js b/packages/react-dom-bindings/src/client/DOMPropertyOperations.js index df09445acc5..b783d4225b5 100644 --- a/packages/react-dom-bindings/src/client/DOMPropertyOperations.js +++ b/packages/react-dom-bindings/src/client/DOMPropertyOperations.js @@ -213,6 +213,7 @@ export function setValueForPropertyOnCustomComponent( } } // $FlowFixMe[incompatible-cast] value can't be casted to EventListener. + // $FlowFixMe[incompatible-type] node.addEventListener(eventName, (value: EventListener), useCapture); return; } diff --git a/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js b/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js index e4c45ccc4c3..f64d0eaebc1 100644 --- a/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js +++ b/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js @@ -1455,6 +1455,7 @@ export function applyViewTransitionName( const rects = instance.getClientRects(); if ( // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] countClientRects(rects) === 1 ) { // If the instance has a single client rect, that means that it can be @@ -1711,11 +1712,11 @@ function moveOutOfViewport( // while still letting it paint its "old" state to a snapshot. const transform = getComputedTransform(originalStyle); // Clear the long form properties. - // $FlowFixMe + // $FlowFixMe[prop-missing] element.style.translate = 'none'; - // $FlowFixMe + // $FlowFixMe[prop-missing] element.style.scale = 'none'; - // $FlowFixMe + // $FlowFixMe[prop-missing] element.style.rotate = 'none'; // Apply a translate to move it way out of the viewport. This is applied first // so that it is in the coordinate space of the parent and not after applying @@ -1798,7 +1799,7 @@ export function cloneRootViewTransitionContainer( if (getComputedStyle(positionedAncestor).position !== 'static') { break; } - // $FlowFixMe: This is refined. + // $FlowFixMe[incompatible-type]: This is refined. positionedAncestor = positionedAncestor.parentNode; } @@ -2004,7 +2005,6 @@ function cancelAllViewTransitionAnimations(scope: Element) { for (let i = 0; i < animations.length; i++) { const anim = animations[i]; const effect: KeyframeEffect = (anim.effect: any); - // $FlowFixMe const pseudo: ?string = effect.pseudoElement; if ( pseudo != null && @@ -2218,7 +2218,6 @@ export function startViewTransition( for (let i = 0; i < animations.length; i++) { const animation = animations[i]; const effect: KeyframeEffect = (animation.effect: any); - // $FlowFixMe const pseudoElement: ?string = effect.pseudoElement; if ( pseudoElement != null && @@ -2259,13 +2258,13 @@ export function startViewTransition( height !== undefined ) { // Replace the keyframes with ones that don't animate the width/height. - // $FlowFixMe + // $FlowFixMe[incompatible-type] effect.setKeyframes(keyframes); // Read back the new animation to see what the underlying width/height of the pseudo-element was. const computedStyle = getComputedStyle( - // $FlowFixMe + // $FlowFixMe[incompatible-type] effect.target, - // $FlowFixMe + // $FlowFixMe[incompatible-type] effect.pseudoElement, ); if ( @@ -2280,7 +2279,7 @@ export function startViewTransition( const last = keyframes[keyframes.length - 1]; last.width = width; last.height = height; - // $FlowFixMe + // $FlowFixMe[incompatible-type] effect.setKeyframes(keyframes); } } @@ -2562,7 +2561,6 @@ export function startGestureTransition( let longestDuration = 0; for (let i = 0; i < animations.length; i++) { const effect: KeyframeEffect = (animations[i].effect: any); - // $FlowFixMe const pseudoElement: ?string = effect.pseudoElement; if (pseudoElement == null) { } else if (pseudoElement.startsWith('::view-transition')) { @@ -2594,7 +2592,6 @@ export function startGestureTransition( continue; } const effect: KeyframeEffect = (anim.effect: any); - // $FlowFixMe const pseudoElement: ?string = effect.pseudoElement; if ( pseudoElement != null && @@ -2654,7 +2651,7 @@ export function startGestureTransition( } animateGesture( effect.getKeyframes(), - // $FlowFixMe: Always documentElement atm. + // $FlowFixMe[incompatible-type]: Always documentElement atm. effect.target, pseudoElement, timeline, @@ -2681,7 +2678,7 @@ export function startGestureTransition( const pseudoElementName = '::view-transition-group' + groupName; animateGesture( [{}, {}], - // $FlowFixMe: Always documentElement atm. + // $FlowFixMe[incompatible-type]: Always documentElement atm. effect.target, pseudoElementName, timeline, @@ -3203,6 +3200,7 @@ FragmentInstance.prototype.getRootNode = function ( getInstanceFromHostFiber(parentHostFiber); const rootNode = // $FlowFixMe[incompatible-cast] Flow expects Node + // $FlowFixMe[incompatible-type] (parentHostInstance.getRootNode(getRootNodeOptions): Document | ShadowRoot); return rootNode; }; @@ -4649,9 +4647,11 @@ export function getHoistableRoot(container: Container): HoistableRoot { return typeof container.getRootNode === 'function' ? /* $FlowFixMe[incompatible-cast] Flow types this as returning a `Node`, * but it's either a `Document` or `ShadowRoot`. */ + // $FlowFixMe[incompatible-type] (container.getRootNode(): Document | ShadowRoot) : container.nodeType === DOCUMENT_NODE ? // $FlowFixMe[incompatible-cast] We've constrained this to be a Document which satisfies the return type + // $FlowFixMe[incompatible-type] (container: Document) : container.ownerDocument; } @@ -4962,12 +4962,14 @@ function preinitStyle( } // Construct a Resource and cache it + // $FlowFixMe[incompatible-type] resource = { type: 'stylesheet', instance, count: 1, state, }; + // $FlowFixMe[incompatible-type] styles.set(key, resource); return; } diff --git a/packages/react-dom-bindings/src/client/estimateBandwidth.js b/packages/react-dom-bindings/src/client/estimateBandwidth.js index 4b143a5b562..7d1e542112d 100644 --- a/packages/react-dom-bindings/src/client/estimateBandwidth.js +++ b/packages/react-dom-bindings/src/client/estimateBandwidth.js @@ -98,7 +98,8 @@ export default function estimateBandwidth(): number { // Fallback to the navigator.connection estimate if available // $FlowFixMe[prop-missing] if (navigator.connection) { - // $FlowFixMe + // $FlowFixMe[prop-missing] + // $FlowFixMe[incompatible-use] const downlink: ?number = navigator.connection.downlink; if (typeof downlink === 'number') { return downlink; diff --git a/packages/react-dom-bindings/src/events/SyntheticEvent.js b/packages/react-dom-bindings/src/events/SyntheticEvent.js index acd50cf8e0c..c51ba896638 100644 --- a/packages/react-dom-bindings/src/events/SyntheticEvent.js +++ b/packages/react-dom-bindings/src/events/SyntheticEvent.js @@ -392,6 +392,7 @@ function getEventKey(nativeEvent: {[propName: string]: mixed}) { if (nativeEvent.type === 'keypress') { const charCode = getEventCharCode( // $FlowFixMe[incompatible-call] unable to narrow to `KeyboardEvent` + // $FlowFixMe[incompatible-type] nativeEvent, ); @@ -464,6 +465,7 @@ const KeyboardEventInterface: EventInterfaceType = { if (event.type === 'keypress') { return getEventCharCode( // $FlowFixMe[incompatible-call] unable to narrow to `KeyboardEvent` + // $FlowFixMe[incompatible-type] event, ); } @@ -488,6 +490,7 @@ const KeyboardEventInterface: EventInterfaceType = { if (event.type === 'keypress') { return getEventCharCode( // $FlowFixMe[incompatible-call] unable to narrow to `KeyboardEvent` + // $FlowFixMe[incompatible-type] event, ); } diff --git a/packages/react-dom-bindings/src/server/ReactDOMLegacyServerStreamConfig.js b/packages/react-dom-bindings/src/server/ReactDOMLegacyServerStreamConfig.js index 54c57685686..24424086a61 100644 --- a/packages/react-dom-bindings/src/server/ReactDOMLegacyServerStreamConfig.js +++ b/packages/react-dom-bindings/src/server/ReactDOMLegacyServerStreamConfig.js @@ -76,6 +76,7 @@ export function byteLengthOfBinaryChunk(chunk: BinaryChunk): number { export function closeWithError(destination: Destination, error: mixed): void { // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types. + // $FlowFixMe[incompatible-type] destination.destroy(error); } diff --git a/packages/react-dom-bindings/src/server/ReactDOMServerExternalRuntime.js b/packages/react-dom-bindings/src/server/ReactDOMServerExternalRuntime.js index 8a13babe2b9..fc85381d5d2 100644 --- a/packages/react-dom-bindings/src/server/ReactDOMServerExternalRuntime.js +++ b/packages/react-dom-bindings/src/server/ReactDOMServerExternalRuntime.js @@ -14,6 +14,7 @@ if (document.body != null) { installFizzInstrObserver(document.body); } // $FlowFixMe[incompatible-cast] + // $FlowFixMe[incompatible-type] handleExistingNodes((document.body: HTMLElement)); } else { // Document must be loading -- body may not exist yet if the fizz external @@ -26,6 +27,7 @@ if (document.body != null) { installFizzInstrObserver(document.body); } // $FlowFixMe[incompatible-cast] + // $FlowFixMe[incompatible-type] handleExistingNodes((document.body: HTMLElement)); // We can call disconnect without takeRecord here, @@ -70,10 +72,12 @@ function installFizzInstrObserver(target: Node) { function handleNode(node_: Node) { // $FlowFixMe[incompatible-cast] + // $FlowFixMe[incompatible-type] if (node_.nodeType !== 1 || !(node_: HTMLElement).dataset) { return; } // $FlowFixMe[incompatible-cast] + // $FlowFixMe[incompatible-type] const node = (node_: HTMLElement); const dataset = node.dataset; if (dataset['rxi'] != null) { diff --git a/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js b/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js index a93c32a947f..9c6eb622e12 100644 --- a/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js +++ b/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js @@ -3366,7 +3366,7 @@ function pushImg( // reenter this branch in a second pass for duplicate img hrefs. promotablePreloads.delete(key); - // $FlowFixMe - Flow should understand that this is a Resource if the condition was true + // $FlowFixMe[incompatible-call] - Flow should understand that this is a Resource if the condition was true renderState.highImagePreloads.add(resource); } } else if (!resumableState.imageResources.hasOwnProperty(key)) { diff --git a/packages/react-dom/src/client/ReactDOMClientFB.js b/packages/react-dom/src/client/ReactDOMClientFB.js index 872a4550aa3..a9e5cd7de19 100644 --- a/packages/react-dom/src/client/ReactDOMClientFB.js +++ b/packages/react-dom/src/client/ReactDOMClientFB.js @@ -83,6 +83,7 @@ function createPortal( // TODO: pass ReactDOM portal implementation as third argument // $FlowFixMe[incompatible-return] The Flow type is opaque but there's no way to actually create it. + // $FlowFixMe[incompatible-type] return createPortalImpl(children, container, null, key); } @@ -101,6 +102,7 @@ function flushSyncFromReconciler(fn: (() => R) | void): R | void { } } // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] return flushSyncWithoutWarningIfAlreadyRendering(fn); } diff --git a/packages/react-dom/src/client/ReactDOMDefaultTransitionIndicator.js b/packages/react-dom/src/client/ReactDOMDefaultTransitionIndicator.js index 37661849cad..751245a40df 100644 --- a/packages/react-dom/src/client/ReactDOMDefaultTransitionIndicator.js +++ b/packages/react-dom/src/client/ReactDOMDefaultTransitionIndicator.js @@ -43,11 +43,12 @@ export function defaultOnDefaultTransitionIndicator(): void | (() => void) { } } - // $FlowFixMe + // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] navigation.addEventListener('navigate', handleNavigate); - // $FlowFixMe + // $FlowFixMe[incompatible-call] navigation.addEventListener('navigatesuccess', handleNavigateComplete); - // $FlowFixMe + // $FlowFixMe[incompatible-call] navigation.addEventListener('navigateerror', handleNavigateComplete); function startFakeNavigation() { @@ -76,11 +77,12 @@ export function defaultOnDefaultTransitionIndicator(): void | (() => void) { return function () { isCancelled = true; - // $FlowFixMe + // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] navigation.removeEventListener('navigate', handleNavigate); - // $FlowFixMe + // $FlowFixMe[incompatible-call] navigation.removeEventListener('navigatesuccess', handleNavigateComplete); - // $FlowFixMe + // $FlowFixMe[incompatible-call] navigation.removeEventListener('navigateerror', handleNavigateComplete); if (pendingResolve !== null) { pendingResolve(); diff --git a/packages/react-dom/src/client/ReactDOMRootFB.js b/packages/react-dom/src/client/ReactDOMRootFB.js index 3a0205fe799..6520285b0fd 100644 --- a/packages/react-dom/src/client/ReactDOMRootFB.js +++ b/packages/react-dom/src/client/ReactDOMRootFB.js @@ -256,6 +256,7 @@ function legacyCreateRootFromDOMContainer( ? container.parentNode : container; // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] listenToAllSupportedEvents(rootContainerElement); flushSyncWork(); @@ -293,6 +294,7 @@ function legacyCreateRootFromDOMContainer( ? container.parentNode : container; // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] listenToAllSupportedEvents(rootContainerElement); // Initial mount should not be batched. @@ -425,6 +427,7 @@ export function render( } return legacyRenderSubtreeIntoContainer( null, + // $FlowFixMe[incompatible-type] React$Element is a subtype of ReactNodeList element, container, false, diff --git a/packages/react-dom/src/shared/ReactDOM.js b/packages/react-dom/src/shared/ReactDOM.js index f1d48bfacd4..973caabe766 100644 --- a/packages/react-dom/src/shared/ReactDOM.js +++ b/packages/react-dom/src/shared/ReactDOM.js @@ -64,6 +64,7 @@ function createPortal( // TODO: pass ReactDOM portal implementation as third argument // $FlowFixMe[incompatible-return] The Flow type is opaque but there's no way to actually create it. + // $FlowFixMe[incompatible-type] return createPortalImpl(children, container, null, key); } diff --git a/packages/react-dom/src/test-utils/FizzTestUtils.js b/packages/react-dom/src/test-utils/FizzTestUtils.js index 4d8b6cadbab..aabaf9306b6 100644 --- a/packages/react-dom/src/test-utils/FizzTestUtils.js +++ b/packages/react-dom/src/test-utils/FizzTestUtils.js @@ -95,7 +95,7 @@ async function executeScript(script: Element) { } try { - // $FlowFixMe + // $FlowFixMe[unsupported-syntax] require(scriptSrc); } catch (x) { const event = new window.ErrorEvent('error', {error: x}); diff --git a/packages/react-reconciler/src/ReactCapturedValue.js b/packages/react-reconciler/src/ReactCapturedValue.js index d53489cc3b7..feb0a9f0752 100644 --- a/packages/react-reconciler/src/ReactCapturedValue.js +++ b/packages/react-reconciler/src/ReactCapturedValue.js @@ -56,7 +56,9 @@ export function createCapturedValueFromError( stack: stack, }; if (typeof stack === 'string') { + // $FlowFixMe[incompatible-type] CapturedStacks.set(value, captured); } + // $FlowFixMe[incompatible-type] return captured; } diff --git a/packages/react-reconciler/src/ReactChildFiber.js b/packages/react-reconciler/src/ReactChildFiber.js index 2a726447263..c5aeebeebf6 100644 --- a/packages/react-reconciler/src/ReactChildFiber.js +++ b/packages/react-reconciler/src/ReactChildFiber.js @@ -2224,10 +2224,12 @@ export function validateSuspenseListChildren( enableAsyncIterableChildren && children.$$typeof === REACT_ELEMENT_TYPE && typeof children.type === 'function' && - // $FlowFixMe + // $FlowFixMe[incompatible-use] + // $FlowFixMe[method-unbinding] (Object.prototype.toString.call(children.type) === '[object GeneratorFunction]' || - // $FlowFixMe + // $FlowFixMe[incompatible-use] + // $FlowFixMe[method-unbinding] Object.prototype.toString.call(children.type) === '[object AsyncGeneratorFunction]') ) { diff --git a/packages/react-reconciler/src/ReactFiberCommitEffects.js b/packages/react-reconciler/src/ReactFiberCommitEffects.js index f7e20fe9261..ba4fbe29763 100644 --- a/packages/react-reconciler/src/ReactFiberCommitEffects.js +++ b/packages/react-reconciler/src/ReactFiberCommitEffects.js @@ -199,7 +199,7 @@ export function commitHookEffectListMount( addendum = ' You returned null. If your effect does not require clean ' + 'up, return undefined (or nothing).'; - // $FlowFixMe (@poteto) this check is safe on arbitrary non-null/void objects + // $FlowFixMe[incompatible-type] (@poteto) this check is safe on arbitrary non-null/void objects } else if (typeof destroy.then === 'function') { addendum = '\n\nIt looks like you wrote ' + @@ -924,7 +924,8 @@ function safelyCallDestroy( ); } else { try { - // $FlowFixMe(incompatible-call) Already bound to resource + // $FlowFixMe[incompatible-call] Already bound to resource + // $FlowFixMe[incompatible-type] destroy_(); } catch (error) { captureCommitPhaseError(current, nearestMountedAncestor, error); @@ -951,11 +952,11 @@ function commitProfiler( onRender( id, phase, - // $FlowFixMe: This should be always a number in profiling mode + // $FlowFixMe[incompatible-type]: This should be always a number in profiling mode finishedWork.actualDuration, - // $FlowFixMe: This should be always a number in profiling mode + // $FlowFixMe[incompatible-type]: This should be always a number in profiling mode finishedWork.treeBaseDuration, - // $FlowFixMe: This should be always a number in profiling mode + // $FlowFixMe[incompatible-type]: This should be always a number in profiling mode finishedWork.actualStartTime, commitStartTime, ); diff --git a/packages/react-reconciler/src/ReactFiberCommitWork.js b/packages/react-reconciler/src/ReactFiberCommitWork.js index ecacb0c1585..9c639c187a1 100644 --- a/packages/react-reconciler/src/ReactFiberCommitWork.js +++ b/packages/react-reconciler/src/ReactFiberCommitWork.js @@ -488,6 +488,7 @@ function commitBeforeMutationEffectsOnFiber( finishedWork.tag === SuspenseComponent && isSuspenseBoundaryBeingHidden(current, finishedWork) && // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] doesFiberContain(finishedWork, focusedInstanceHandle) ) { shouldFireAfterActiveInstanceBlur = true; diff --git a/packages/react-reconciler/src/ReactFiberHooks.js b/packages/react-reconciler/src/ReactFiberHooks.js index 66a390ebb81..b04f68da7af 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.js +++ b/packages/react-reconciler/src/ReactFiberHooks.js @@ -416,9 +416,9 @@ function warnIfAsyncClientComponent(Component: Function) { // for transpiled async functions. Neither mechanism is completely // bulletproof but together they cover the most common cases. const isAsyncFunction = - // $FlowIgnore[method-unbinding] + // $FlowFixMe[method-unbinding] Object.prototype.toString.call(Component) === '[object AsyncFunction]' || - // $FlowIgnore[method-unbinding] + // $FlowFixMe[method-unbinding] Object.prototype.toString.call(Component) === '[object AsyncGeneratorFunction]'; if (isAsyncFunction) { @@ -2647,6 +2647,7 @@ function updateEffectImpl( const prevEffect: Effect = currentHook.memoizedState; const prevDeps = prevEffect.deps; // $FlowFixMe[incompatible-call] (@poteto) + // $FlowFixMe[incompatible-type] if (areHookInputsEqual(nextDeps, prevDeps)) { hook.memoizedState = pushSimpleEffect( hookFlags, @@ -2727,6 +2728,7 @@ function mountEvent) => Return>( const ref = {impl: callback}; hook.memoizedState = ref; // $FlowIgnore[incompatible-return] + // $FlowFixMe[incompatible-type] return function eventFn() { if (isInvalidExecutionContextForEventFunction()) { throw new Error( @@ -2743,7 +2745,8 @@ function updateEvent) => Return>( const hook = updateWorkInProgressHook(); const ref = hook.memoizedState; useEffectEventImpl({ref, nextImpl: callback}); - // $FlowIgnore[incompatible-return] + // $FlowFixMe[incompatible-return] + // $FlowFixMe[incompatible-type] return function eventFn() { if (isInvalidExecutionContextForEventFunction()) { throw new Error( diff --git a/packages/react-reconciler/src/ReactFiberNewContext.js b/packages/react-reconciler/src/ReactFiberNewContext.js index 02792d863af..81c47d7b649 100644 --- a/packages/react-reconciler/src/ReactFiberNewContext.js +++ b/packages/react-reconciler/src/ReactFiberNewContext.js @@ -551,20 +551,24 @@ function readContextForConsumer( } // This is the first dependency for this component. Create a new list. + // $FlowFixMe[incompatible-type] lastContextDependency = contextItem; consumer.dependencies = __DEV__ - ? { + ? // $FlowFixMe[incompatible-type] + { lanes: NoLanes, firstContext: contextItem, _debugThenableState: null, } - : { + : // $FlowFixMe[incompatible-type] + { lanes: NoLanes, firstContext: contextItem, }; consumer.flags |= NeedsPropagation; } else { // Append a new context item. + // $FlowFixMe[incompatible-type] lastContextDependency = lastContextDependency.next = contextItem; } return value; diff --git a/packages/react-reconciler/src/ReactFiberPerformanceTrack.js b/packages/react-reconciler/src/ReactFiberPerformanceTrack.js index f926bd6085b..416badc9a1e 100644 --- a/packages/react-reconciler/src/ReactFiberPerformanceTrack.js +++ b/packages/react-reconciler/src/ReactFiberPerformanceTrack.js @@ -508,9 +508,11 @@ function logComponentEffectErrored( if (debugTask) { debugTask.run( // $FlowFixMe[method-unbinding] + // $FlowFixMe[incompatible-type] performance.measure.bind(performance, measureName, options), ); } else { + // $FlowFixMe[incompatible-type] performance.measure(measureName, options); } performance.clearMeasures(measureName); @@ -780,9 +782,11 @@ export function logBlockingStart( if (debugTask) { debugTask.run( // $FlowFixMe[method-unbinding] + // $FlowFixMe[incompatible-type] performance.measure.bind(performance, label, measureOptions), ); } else { + // $FlowFixMe[incompatible-type] performance.measure(label, measureOptions); } performance.clearMeasures(label); @@ -886,9 +890,11 @@ export function logGestureStart( if (debugTask) { debugTask.run( // $FlowFixMe[method-unbinding] + // $FlowFixMe[incompatible-type] performance.measure.bind(performance, label, measureOptions), ); } else { + // $FlowFixMe[incompatible-type] performance.measure(label, measureOptions); } performance.clearMeasures(label); @@ -1027,9 +1033,11 @@ export function logTransitionStart( if (debugTask) { debugTask.run( // $FlowFixMe[method-unbinding] + // $FlowFixMe[incompatible-type] performance.measure.bind(performance, label, measureOptions), ); } else { + // $FlowFixMe[incompatible-type] performance.measure(label, measureOptions); } performance.clearMeasures(label); diff --git a/packages/react-reconciler/src/ReactFiberThenable.js b/packages/react-reconciler/src/ReactFiberThenable.js index 643be63ffa1..84c6a93ceca 100644 --- a/packages/react-reconciler/src/ReactFiberThenable.js +++ b/packages/react-reconciler/src/ReactFiberThenable.js @@ -290,6 +290,7 @@ export function suspendCommit(): void { // This extra indirection only exists so it can handle passing // noopSuspenseyCommitThenable through to throwException. // TODO: Factor the thenable check out of throwException + // $FlowFixMe[incompatible-type] suspendedThenable = noopSuspenseyCommitThenable; throw SuspenseyCommitException; } diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.js b/packages/react-reconciler/src/ReactFiberWorkLoop.js index f7200458be1..53eb149b3ca 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.js @@ -2973,6 +2973,7 @@ function workLoopConcurrent(nonIdle: boolean) { const yieldAfter = now() + (nonIdle ? 25 : 5); do { // $FlowFixMe[incompatible-call] flow doesn't know that now() is side-effect free + // $FlowFixMe[incompatible-type] performUnitOfWork(workInProgress); } while (workInProgress !== null && now() < yieldAfter); } @@ -2983,6 +2984,7 @@ function workLoopConcurrentByScheduler() { // Perform work until Scheduler asks us to yield while (workInProgress !== null && !shouldYield()) { // $FlowFixMe[incompatible-call] flow doesn't know that shouldYield() is side-effect free + // $FlowFixMe[incompatible-type] performUnitOfWork(workInProgress); } } diff --git a/packages/react-server-dom-webpack/src/ReactFlightWebpackNodeLoader.js b/packages/react-server-dom-webpack/src/ReactFlightWebpackNodeLoader.js index 9799acc3a07..69967b1ff4f 100644 --- a/packages/react-server-dom-webpack/src/ReactFlightWebpackNodeLoader.js +++ b/packages/react-server-dom-webpack/src/ReactFlightWebpackNodeLoader.js @@ -726,7 +726,7 @@ async function transformModuleIfNeeded( if (sourceMappingURL) { const sourceMapResult = await loader( sourceMappingURL, - // $FlowFixMe + // $FlowFixMe[incompatible-type] { format: 'json', conditions: [], @@ -738,7 +738,8 @@ async function transformModuleIfNeeded( const sourceMapString = typeof sourceMapResult.source === 'string' ? sourceMapResult.source - : // $FlowFixMe + : // $FlowFixMe[incompatible-call] + // $FlowFixMe[extra-arg] sourceMapResult.source.toString('utf8'); sourceMap = JSON.parse(sourceMapString); diff --git a/packages/react-server-dom-webpack/src/ReactFlightWebpackReferences.js b/packages/react-server-dom-webpack/src/ReactFlightWebpackReferences.js index de437414ef1..2e8c25bb1b0 100644 --- a/packages/react-server-dom-webpack/src/ReactFlightWebpackReferences.js +++ b/packages/react-server-dom-webpack/src/ReactFlightWebpackReferences.js @@ -64,6 +64,7 @@ const FunctionBind = Function.prototype.bind; const ArraySlice = Array.prototype.slice; function bind(this: ServerReference): any { // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] const newFn = FunctionBind.apply(this, arguments); if (this.$$typeof === SERVER_REFERENCE_TAG) { if (__DEV__) { @@ -254,6 +255,8 @@ function getReference(target: Function, name: string | symbol): $FlowFixMe { const clientReference: ClientReference = registerClientReferenceImpl(({}: any), target.$$id, true); + // $FlowFixMe[incompatible-type] + // $FlowFixMe[incompatible-variance] const proxy = new Proxy(clientReference, proxyHandlers); // Treat this as a resolved Promise for React's use() @@ -301,6 +304,7 @@ function getReference(target: Function, name: string | symbol): $FlowFixMe { target.$$async, ); Object.defineProperty((reference: any), 'name', {value: name}); + // $FlowFixMe[incompatible-type] cachedReference = target[name] = new Proxy(reference, deepProxyHandlers); } return cachedReference; @@ -348,5 +352,8 @@ export function createClientModuleProxy( moduleId, false, ); + // $FlowFixMe[incompatible-type] + // $FlowFixMe[incompatible-variance] + // $FlowFixMe[incompatible-exact] return new Proxy(clientReference, proxyHandlers); } diff --git a/packages/react-server-dom-webpack/src/server/ReactFlightDOMServerNode.js b/packages/react-server-dom-webpack/src/server/ReactFlightDOMServerNode.js index 5e73d8eb3a5..a401db3fede 100644 --- a/packages/react-server-dom-webpack/src/server/ReactFlightDOMServerNode.js +++ b/packages/react-server-dom-webpack/src/server/ReactFlightDOMServerNode.js @@ -129,11 +129,12 @@ function startReadingFromDebugChannelReadable( const ws: WebSocket = (stream: any); ws.binaryType = 'arraybuffer'; ws.addEventListener('message', event => { - // $FlowFixMe + // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] onData(event.data); }); ws.addEventListener('error', event => { - // $FlowFixMe + // $FlowFixMe[prop-missing] onError(event.error); }); ws.addEventListener('close', onClose); @@ -610,6 +611,7 @@ function decodeReplyFromBusboy( reportGlobalError( response, // $FlowFixMe[incompatible-call] types Error and mixed are incompatible + // $FlowFixMe[incompatible-type] err, ); }); @@ -672,7 +674,8 @@ function decodeReplyFromAsyncIterable( reportGlobalError(response, reason); if (typeof (iterator: any).throw === 'function') { // The iterator protocol doesn't necessarily include this but a generator do. - // $FlowFixMe should be able to pass mixed + // $FlowFixMe[incompatible-call] should be able to pass mixed + // $FlowFixMe[prop-missing] iterator.throw(reason).then(error, error); } } diff --git a/packages/react-server/src/ReactFizzHooks.js b/packages/react-server/src/ReactFizzHooks.js index 119c2a0778f..9dfd5c3c2b7 100644 --- a/packages/react-server/src/ReactFizzHooks.js +++ b/packages/react-server/src/ReactFizzHooks.js @@ -546,7 +546,8 @@ function throwOnUseEffectEventCall() { export function useEffectEvent) => Return>( callback: F, ): F { - // $FlowIgnore[incompatible-return] + // $FlowFixMe[incompatible-return] + // $FlowFixMe[incompatible-type] return throwOnUseEffectEventCall; } @@ -630,7 +631,7 @@ function useActionState( const actionStateHookIndex = actionStateCounter++; const request: Request = (currentlyRenderingRequest: any); - // $FlowIgnore[prop-missing] + // $FlowFixMe[prop-missing] const formAction = action.$$FORM_ACTION; if (typeof formAction === 'function') { // This is a server action. These have additional features to enable @@ -652,7 +653,7 @@ function useActionState( let state = initialState; const componentKeyPath = (currentlyRenderingKeyPath: any); const postbackActionState = getFormState(request); - // $FlowIgnore[prop-missing] + // $FlowFixMe[prop-missing] const isSignatureEqual = action.$$IS_SIGNATURE_EQUAL; if ( postbackActionState !== null && @@ -686,9 +687,9 @@ function useActionState( boundAction(payload); }; - // $FlowIgnore[prop-missing] + // $FlowFixMe[prop-missing] if (typeof boundAction.$$FORM_ACTION === 'function') { - // $FlowIgnore[prop-missing] + // $FlowFixMe[prop-missing] dispatch.$$FORM_ACTION = (prefix: string) => { const metadata: ReactCustomFormAction = boundAction.$$FORM_ACTION(prefix); diff --git a/packages/react-server/src/ReactFizzNewContext.js b/packages/react-server/src/ReactFizzNewContext.js index 0a9fe3df4c3..f563091401c 100644 --- a/packages/react-server/src/ReactFizzNewContext.js +++ b/packages/react-server/src/ReactFizzNewContext.js @@ -163,6 +163,7 @@ export function switchContext(newSnapshot: ContextSnapshot): void { if (prev !== next) { if (prev === null) { // $FlowFixMe[incompatible-call]: This has to be non-null since it's not equal to prev. + // $FlowFixMe[incompatible-type] pushAllNext(next); } else if (next === null) { popAllPrevious(prev); diff --git a/packages/react-server/src/ReactFizzServer.js b/packages/react-server/src/ReactFizzServer.js index 4ad48d79fba..a99d245bb0c 100644 --- a/packages/react-server/src/ReactFizzServer.js +++ b/packages/react-server/src/ReactFizzServer.js @@ -1273,7 +1273,7 @@ function renderSuspenseBoundary( } return; } - // $FlowFixMe: Refined. + // $FlowFixMe[incompatible-type]: Refined. const task: RenderTask = someTask; const prevKeyPath = task.keyPath; @@ -2089,7 +2089,8 @@ function renderSuspenseList( // If it's an iterator we need to continue reading where we left // off. We can do that by reading the first few rows from the previous // thenable state. - // $FlowFixMe + // $FlowFixMe[incompatible-type] + // $FlowFixMe[underconstrained-implicit-instantiation] let step = readPreviousThenableFromState(); while (step !== undefined) { if (step.done) { @@ -2226,7 +2227,7 @@ function renderHostElement( props, )); if (isPreambleContext(newContext)) { - // $FlowFixMe: Refined + // $FlowFixMe[incompatible-type]: Refined renderPreamble(request, (task: RenderTask), segment, children); } else { // We use the non-destructive form because if something suspends, we still @@ -3414,7 +3415,8 @@ function retryNode(request: Request, task: Task): void { // If it's an iterator we need to continue reading where we left // off. We can do that by reading the first few rows from the previous // thenable state. - // $FlowFixMe + // $FlowFixMe[incompatible-type] + // $FlowFixMe[underconstrained-implicit-instantiation] let step = readPreviousThenableFromState(); while (step !== undefined) { if (step.done) { @@ -3704,7 +3706,7 @@ function renderChildrenArray( if (task.replay !== null) { replayFragment( request, - // $FlowFixMe: Refined. + // $FlowFixMe[incompatible-type]: Refined. task, children, childIndex, @@ -4097,7 +4099,7 @@ function renderNode( : null; const newTask = spawnNewSuspendedReplayTask( request, - // $FlowFixMe: Refined. + // $FlowFixMe[incompatible-type]: Refined. task, thenableState, ); @@ -4133,7 +4135,7 @@ function renderNode( : null; const newTask = spawnNewSuspendedReplayTask( request, - // $FlowFixMe: Refined. + // $FlowFixMe[incompatible-type]: Refined. task, thenableState, ); @@ -4198,7 +4200,7 @@ function renderNode( : null; const newTask = spawnNewSuspendedRenderTask( request, - // $FlowFixMe: Refined. + // $FlowFixMe[incompatible-type]: Refined. task, thenableState, ); @@ -4233,7 +4235,7 @@ function renderNode( : null; const newTask = spawnNewSuspendedRenderTask( request, - // $FlowFixMe: Refined. + // $FlowFixMe[incompatible-type]: Refined. task, thenableState, ); @@ -4944,13 +4946,13 @@ function retryTask(request: Request, task: Task): void { if (segment === null) { retryReplayTask( request, - // $FlowFixMe: Refined. + // $FlowFixMe[incompatible-type]: Refined. task, ); } else { retryRenderTask( request, - // $FlowFixMe: Refined. + // $FlowFixMe[incompatible-type]: Refined. task, segment, ); diff --git a/packages/react-server/src/ReactFlightActionServer.js b/packages/react-server/src/ReactFlightActionServer.js index 9062a6c03da..a1391083427 100644 --- a/packages/react-server/src/ReactFlightActionServer.js +++ b/packages/react-server/src/ReactFlightActionServer.js @@ -71,10 +71,12 @@ function decodeBoundActionMetaData( bound: null | Promise>, }>(actionResponse); // Force it to initialize - // $FlowFixMe + // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] refPromise.then(() => {}); if (refPromise.status !== 'fulfilled') { - // $FlowFixMe + // $FlowFixMe[incompatible-use] + // $FlowFixMe[prop-missing] throw refPromise.reason; } return refPromise.value; @@ -94,6 +96,7 @@ export function decodeAction( body.forEach((value: string | File, key: string) => { if (!key.startsWith('$ACTION_')) { // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] formData.append(key, value); return; } diff --git a/packages/react-server/src/ReactFlightReplyServer.js b/packages/react-server/src/ReactFlightReplyServer.js index 742cae6d201..3cab7f98516 100644 --- a/packages/react-server/src/ReactFlightReplyServer.js +++ b/packages/react-server/src/ReactFlightReplyServer.js @@ -318,6 +318,7 @@ function triggerErrorOnChunk( const streamChunk: InitializedStreamChunk = (chunk: any); const controller = streamChunk.reason; // $FlowFixMe[incompatible-call]: The error method should accept mixed. + // $FlowFixMe[incompatible-type] controller.error(error); return; } @@ -1178,6 +1179,7 @@ function parseReadableStream( error(error: mixed): void { if (previousBlockedChunk === null) { // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] controller.error(error); } else { const blockedChunk = previousBlockedChunk; @@ -1374,6 +1376,7 @@ function parseModelString( backingFormData.forEach((entry: File | string, entryKey: string) => { if (entryKey.startsWith(formPrefix)) { // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] data.append(entryKey.slice(formPrefix.length), entry); } }); diff --git a/packages/react-server/src/ReactFlightServer.js b/packages/react-server/src/ReactFlightServer.js index d5b534adb49..8559473d99e 100644 --- a/packages/react-server/src/ReactFlightServer.js +++ b/packages/react-server/src/ReactFlightServer.js @@ -394,6 +394,7 @@ function patchConsole(consoleInst: typeof console, methodName: string) { const originalMethod = descriptor.value; const originalName = Object.getOwnPropertyDescriptor( // $FlowFixMe[incompatible-call]: We should be able to get descriptors from any function. + // $FlowFixMe[incompatible-type] originalMethod, 'name', ); @@ -422,6 +423,7 @@ function patchConsole(consoleInst: typeof console, methodName: string) { emitConsoleChunk(request, methodName, owner, env, stack, args); } // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] return originalMethod.apply(this, arguments); }; if (originalName) { @@ -1142,7 +1144,7 @@ function serializeReadableStream( // receiving side. It also implies that different chunks can be split up or merged as opposed // to a readable stream that happens to have Uint8Array as the type which might expect it to be // received in the same slices. - // $FlowFixMe: This is a Node.js extension. + // $FlowFixMe[prop-missing]: This is a Node.js extension. let supportsBYOB: void | boolean = stream.supportsBYOB; if (supportsBYOB === undefined) { try { @@ -1220,7 +1222,6 @@ function serializeReadableStream( erroredTask(request, streamTask, reason); enqueueFlush(request); - // $FlowFixMe should be able to pass mixed reader.cancel(reason).then(error, error); } function abortStream() { @@ -1239,7 +1240,6 @@ function serializeReadableStream( erroredTask(request, streamTask, reason); enqueueFlush(request); } - // $FlowFixMe should be able to pass mixed reader.cancel(reason).then(error, error); } @@ -1353,7 +1353,8 @@ function serializeAsyncIterable( enqueueFlush(request); if (typeof (iterator: any).throw === 'function') { // The iterator protocol doesn't necessarily include this but a generator do. - // $FlowFixMe should be able to pass mixed + // $FlowFixMe[incompatible-call] should be able to pass mixed + // $FlowFixMe[prop-missing] iterator.throw(reason).then(error, error); } } @@ -1375,7 +1376,8 @@ function serializeAsyncIterable( } if (typeof (iterator: any).throw === 'function') { // The iterator protocol doesn't necessarily include this but a generator do. - // $FlowFixMe should be able to pass mixed + // $FlowFixMe[incompatible-call] should be able to pass mixed + // $FlowFixMe[prop-missing] iterator.throw(reason).then(error, error); } } @@ -1575,10 +1577,10 @@ function processServerComponentReturnValue( // tempting to try to return the value from a generator. if (iterator === iterableChild) { const isGeneratorComponent = - // $FlowIgnore[method-unbinding] + // $FlowFixMe[method-unbinding] Object.prototype.toString.call(Component) === '[object GeneratorFunction]' && - // $FlowIgnore[method-unbinding] + // $FlowFixMe[method-unbinding] Object.prototype.toString.call(iterableChild) === '[object Generator]'; if (!isGeneratorComponent) { @@ -1615,10 +1617,10 @@ function processServerComponentReturnValue( // tempting to try to return the value from a generator. if (iterator === iterableChild) { const isGeneratorComponent = - // $FlowIgnore[method-unbinding] + // $FlowFixMe[method-unbinding] Object.prototype.toString.call(Component) === '[object AsyncGeneratorFunction]' && - // $FlowIgnore[method-unbinding] + // $FlowFixMe[method-unbinding] Object.prototype.toString.call(iterableChild) === '[object AsyncGenerator]'; if (!isGeneratorComponent) { @@ -3222,16 +3224,17 @@ function serializeDebugBlob(request: Request, blob: Blob): string { // TODO: Emit the chunk early and refer to it later by dedupe. model.push(entry.value); // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] return reader.read().then(progress).catch(error); } function error(reason: mixed) { const digest = ''; emitErrorChunk(request, id, digest, reason, true, null); enqueueFlush(request); - // $FlowFixMe should be able to pass mixed reader.cancel(reason).then(noop, noop); } // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] reader.read().then(progress).catch(error); return '$B' + id.toString(16); } @@ -3270,6 +3273,7 @@ function serializeBlob(request: Request, blob: Blob): string { // TODO: Emit the chunk early and refer to it later by dedupe. model.push(entry.value); // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] return reader.read().then(progress).catch(error); } function error(reason: mixed) { @@ -3279,7 +3283,6 @@ function serializeBlob(request: Request, blob: Blob): string { request.cacheController.signal.removeEventListener('abort', abortBlob); erroredTask(request, newTask, reason); enqueueFlush(request); - // $FlowFixMe should be able to pass mixed reader.cancel(reason).then(error, error); } function abortBlob() { @@ -3298,13 +3301,13 @@ function serializeBlob(request: Request, blob: Blob): string { erroredTask(request, newTask, reason); enqueueFlush(request); } - // $FlowFixMe should be able to pass mixed reader.cancel(reason).then(error, error); } request.cacheController.signal.addEventListener('abort', abortBlob); // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] reader.read().then(progress).catch(error); return '$B' + newTask.id.toString(16); @@ -3889,6 +3892,7 @@ function renderModelDestructive( } // $FlowFixMe[incompatible-return] + // $FlowFixMe[incompatible-type] return value; } @@ -5018,6 +5022,7 @@ function renderDebugModel( } // $FlowFixMe[incompatible-return] + // $FlowFixMe[incompatible-type] return value; } @@ -5158,9 +5163,11 @@ function serializeDebugModel( debugNoOutline = model; try { // $FlowFixMe[incompatible-cast] stringify can return null + // $FlowFixMe[incompatible-type] return (stringify(model, replacer): string); } catch (x) { // $FlowFixMe[incompatible-cast] stringify can return null + // $FlowFixMe[incompatible-type] return (stringify( 'Unknown Value: React could not send it from the server.\n' + x.message, ): string); @@ -5222,9 +5229,11 @@ function emitOutlinedDebugModelChunk( let json: string; try { // $FlowFixMe[incompatible-cast] stringify can return null + // $FlowFixMe[incompatible-type] json = (stringify(model, replacer): string); } catch (x) { // $FlowFixMe[incompatible-cast] stringify can return null + // $FlowFixMe[incompatible-type] json = (stringify( 'Unknown Value: React could not send it from the server.\n' + x.message, ): string); diff --git a/packages/react-server/src/ReactFlightServerConfigDebugNode.js b/packages/react-server/src/ReactFlightServerConfigDebugNode.js index 9bb521be406..afd397b041e 100644 --- a/packages/react-server/src/ReactFlightServerConfigDebugNode.js +++ b/packages/react-server/src/ReactFlightServerConfigDebugNode.js @@ -237,7 +237,7 @@ export function initAsyncDebugInfo(): void { // If we begin before we resolve, that means that this is actually already resolved but // the promiseResolve hook is called at the end of the execution. So we track the time // in the before call instead. - // $FlowFixMe + // $FlowFixMe[incompatible-type] lastRanAwait = resolvePromiseOrAwaitNode(node, performance.now()); break; } diff --git a/packages/react-server/src/ReactServerConsoleConfigBrowser.js b/packages/react-server/src/ReactServerConsoleConfigBrowser.js index be8bf953467..19e03a14756 100644 --- a/packages/react-server/src/ReactServerConsoleConfigBrowser.js +++ b/packages/react-server/src/ReactServerConsoleConfigBrowser.js @@ -36,7 +36,7 @@ export function unbadgeConsole( case 'table': { // These methods cannot be colorized because they don't take a formatting string. // So we wouldn't have added any badge in the first place. - // $FlowFixMe + // $FlowFixMe[incompatible-type] return null; } case 'assert': { diff --git a/packages/react-server/src/ReactServerConsoleConfigPlain.js b/packages/react-server/src/ReactServerConsoleConfigPlain.js index d93e5f1a0dd..0208af4c975 100644 --- a/packages/react-server/src/ReactServerConsoleConfigPlain.js +++ b/packages/react-server/src/ReactServerConsoleConfigPlain.js @@ -27,7 +27,7 @@ export function unbadgeConsole( case 'table': { // These methods cannot be colorized because they don't take a formatting string. // So we wouldn't have added any badge in the first place. - // $FlowFixMe + // $FlowFixMe[incompatible-type] return null; } case 'assert': { diff --git a/packages/react-server/src/ReactServerConsoleConfigServer.js b/packages/react-server/src/ReactServerConsoleConfigServer.js index 7987b9b262f..bee6d7ad397 100644 --- a/packages/react-server/src/ReactServerConsoleConfigServer.js +++ b/packages/react-server/src/ReactServerConsoleConfigServer.js @@ -35,7 +35,7 @@ export function unbadgeConsole( case 'table': { // These methods cannot be colorized because they don't take a formatting string. // So we wouldn't have added any badge in the first place. - // $FlowFixMe + // $FlowFixMe[incompatible-type] return null; } case 'assert': { diff --git a/packages/react-server/src/ReactServerStreamConfigBrowser.js b/packages/react-server/src/ReactServerStreamConfigBrowser.js index 41d9aedd005..5fa325be5d4 100644 --- a/packages/react-server/src/ReactServerStreamConfigBrowser.js +++ b/packages/react-server/src/ReactServerStreamConfigBrowser.js @@ -179,6 +179,7 @@ export function closeWithError(destination: Destination, error: mixed): void { // $FlowFixMe[method-unbinding] if (typeof destination.error === 'function') { // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types. + // $FlowFixMe[incompatible-type] destination.error(error); } else { // Earlier implementations doesn't support this method. In that environment you're @@ -197,6 +198,7 @@ export function readAsDataURL(blob: Blob): Promise { return new Promise((resolve, reject) => { const reader = new FileReader(); // $FlowFixMe[incompatible-call]: We always expect a string result with readAsDataURL. + // $FlowFixMe[incompatible-type] reader.onloadend = () => resolve(reader.result); reader.onerror = reject; reader.readAsDataURL(blob); diff --git a/packages/react-server/src/ReactServerStreamConfigBun.js b/packages/react-server/src/ReactServerStreamConfigBun.js index a9079bee43a..06e419320c1 100644 --- a/packages/react-server/src/ReactServerStreamConfigBun.js +++ b/packages/react-server/src/ReactServerStreamConfigBun.js @@ -56,6 +56,7 @@ export function writeChunk( } // $FlowFixMe[incompatible-call]: write() is compatible with both types in Bun + // $FlowFixMe[incompatible-type] destination.write(chunk); } @@ -64,6 +65,7 @@ export function writeChunkAndReturn( chunk: PrecomputedChunk | Chunk | BinaryChunk, ): boolean { // $FlowFixMe[incompatible-call]: write() is compatible with both types in Bun + // $FlowFixMe[incompatible-type] return !!destination.write(chunk); } @@ -101,12 +103,14 @@ export function closeWithError(destination: Destination, error: mixed): void { // $FlowFixMe[method-unbinding] if (typeof destination.error === 'function') { // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types. + // $FlowFixMe[incompatible-type] destination.error(error); // $FlowFixMe[incompatible-use] // $FlowFixMe[method-unbinding] } else if (typeof destination.destroy === 'function') { // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types. + // $FlowFixMe[incompatible-type] destination.destroy(error); // $FlowFixMe[incompatible-use] diff --git a/packages/react-server/src/ReactServerStreamConfigEdge.js b/packages/react-server/src/ReactServerStreamConfigEdge.js index 90affdc6b8a..cdf4a372b8c 100644 --- a/packages/react-server/src/ReactServerStreamConfigEdge.js +++ b/packages/react-server/src/ReactServerStreamConfigEdge.js @@ -166,6 +166,7 @@ export function closeWithError(destination: Destination, error: mixed): void { // $FlowFixMe[method-unbinding] if (typeof destination.error === 'function') { // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types. + // $FlowFixMe[incompatible-type] destination.error(error); } else { // Earlier implementations doesn't support this method. In that environment you're diff --git a/packages/react-server/src/ReactServerStreamConfigNode.js b/packages/react-server/src/ReactServerStreamConfigNode.js index 90609da2c45..82396064e50 100644 --- a/packages/react-server/src/ReactServerStreamConfigNode.js +++ b/packages/react-server/src/ReactServerStreamConfigNode.js @@ -232,6 +232,7 @@ export function byteLengthOfBinaryChunk(chunk: BinaryChunk): number { export function closeWithError(destination: Destination, error: mixed): void { // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types. + // $FlowFixMe[incompatible-type] destination.destroy(error); } diff --git a/packages/react-server/src/ReactSharedInternalsServer.js b/packages/react-server/src/ReactSharedInternalsServer.js index efc3588a645..2dbb64c8d46 100644 --- a/packages/react-server/src/ReactSharedInternalsServer.js +++ b/packages/react-server/src/ReactSharedInternalsServer.js @@ -12,7 +12,9 @@ import type {SharedStateServer} from 'react/src/ReactSharedInternalsServer'; import * as React from 'react'; const ReactSharedInternalsServer: SharedStateServer = - // $FlowFixMe: It's defined in the one we resolve to. + // $FlowFixMe[prop-missing]: It's defined in the one we resolve to. + // $FlowFixMe[incompatible-type] + // $FlowFixMe[missing-export] React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; if (!ReactSharedInternalsServer) { diff --git a/packages/react/src/ReactCacheClient.js b/packages/react/src/ReactCacheClient.js index ef1e8d6d1da..8b029e7e43f 100644 --- a/packages/react/src/ReactCacheClient.js +++ b/packages/react/src/ReactCacheClient.js @@ -28,6 +28,7 @@ function noopCache, T>(fn: (...A) => T): (...A) => T { // accidentally depend on those details. return function () { // $FlowFixMe[incompatible-call]: We don't want to use rest arguments since we transpile the code. + // $FlowFixMe[incompatible-type] return fn.apply(null, arguments); }; } diff --git a/packages/react/src/ReactCacheImpl.js b/packages/react/src/ReactCacheImpl.js index 2ff7431fc51..d6e0491b6c3 100644 --- a/packages/react/src/ReactCacheImpl.js +++ b/packages/react/src/ReactCacheImpl.js @@ -58,6 +58,7 @@ export function cache, T>(fn: (...A) => T): (...A) => T { if (!dispatcher) { // If there is no dispatcher, then we treat this as not being cached. // $FlowFixMe[incompatible-call]: We don't want to use rest arguments since we transpile the code. + // $FlowFixMe[incompatible-type] return fn.apply(null, arguments); } const fnMap: WeakMap> = dispatcher.getCacheForType( @@ -112,6 +113,7 @@ export function cache, T>(fn: (...A) => T): (...A) => T { } try { // $FlowFixMe[incompatible-call]: We don't want to use rest arguments since we transpile the code. + // $FlowFixMe[incompatible-type] const result = fn.apply(null, arguments); const terminatedNode: TerminatedCacheNode = (cacheNode: any); terminatedNode.s = TERMINATED; diff --git a/packages/react/src/ReactChildren.js b/packages/react/src/ReactChildren.js index d4c41d6669a..3969d410d65 100644 --- a/packages/react/src/ReactChildren.js +++ b/packages/react/src/ReactChildren.js @@ -369,7 +369,7 @@ function mapChildren( context: mixed, ): ?Array { if (children == null) { - // $FlowFixMe limitation refining abstract types in Flow + // $FlowFixMe[incompatible-type] limitation refining abstract types in Flow return children; } const result: Array = []; diff --git a/packages/react/src/ReactLazy.js b/packages/react/src/ReactLazy.js index 47f37afbae2..bf2a1262f84 100644 --- a/packages/react/src/ReactLazy.js +++ b/packages/react/src/ReactLazy.js @@ -112,9 +112,11 @@ function lazyInitializer(payload: Payload): T { const debugValue = moduleObject == null ? undefined : moduleObject.default; resolveDebugValue(debugValue); - // $FlowFixMe + // $FlowFixMe[incompatible-use] + // $FlowFixMe[prop-missing] ioInfo.value.status = 'fulfilled'; - // $FlowFixMe + // $FlowFixMe[incompatible-use] + // $FlowFixMe[prop-missing] ioInfo.value.value = debugValue; } // Make the thenable introspectable @@ -143,12 +145,15 @@ function lazyInitializer(payload: Payload): T { // $FlowFixMe[cannot-write] ioInfo.end = performance.now(); // Hide unhandled rejections. - // $FlowFixMe + // $FlowFixMe[incompatible-use] + // $FlowFixMe[prop-missing] ioInfo.value.then(noop, noop); rejectDebugValue(error); - // $FlowFixMe + // $FlowFixMe[incompatible-use] + // $FlowFixMe[prop-missing] ioInfo.value.status = 'rejected'; - // $FlowFixMe + // $FlowFixMe[incompatible-use] + // $FlowFixMe[prop-missing] ioInfo.value.reason = error; } // Make the thenable introspectable diff --git a/packages/scheduler/src/SchedulerMinHeap.js b/packages/scheduler/src/SchedulerMinHeap.js index da997bad357..c2e33d00564 100644 --- a/packages/scheduler/src/SchedulerMinHeap.js +++ b/packages/scheduler/src/SchedulerMinHeap.js @@ -34,6 +34,7 @@ export function pop(heap: Heap): T | null { // $FlowFixMe[incompatible-type] heap[0] = last; // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] siftDown(heap, last, 0); } return first; diff --git a/packages/scheduler/src/SchedulerProfiling.js b/packages/scheduler/src/SchedulerProfiling.js index 9fdd5906af6..b7cc640c34a 100644 --- a/packages/scheduler/src/SchedulerProfiling.js +++ b/packages/scheduler/src/SchedulerProfiling.js @@ -48,6 +48,7 @@ function logEvent(entries: Array) { } const newEventLog = new Int32Array(eventLogSize * 4); // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] newEventLog.set(eventLog); eventLogBuffer = newEventLog.buffer; eventLog = newEventLog; diff --git a/packages/scheduler/src/forks/Scheduler.js b/packages/scheduler/src/forks/Scheduler.js index 88239b71067..8afdb15b2b1 100644 --- a/packages/scheduler/src/forks/Scheduler.js +++ b/packages/scheduler/src/forks/Scheduler.js @@ -164,6 +164,7 @@ function flushWork(initialTime: number) { if (currentTask !== null) { const currentTime = getCurrentTime(); // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] markTaskErrored(currentTask, currentTime); // $FlowFixMe[incompatible-use] found when upgrading Flow currentTask.isQueued = false; @@ -207,6 +208,7 @@ function workLoop(initialTime: number) { const didUserCallbackTimeout = currentTask.expirationTime <= currentTime; if (enableProfiling) { // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] markTaskRun(currentTask, currentTime); } const continuationCallback = callback(didUserCallbackTimeout); @@ -218,6 +220,7 @@ function workLoop(initialTime: number) { currentTask.callback = continuationCallback; if (enableProfiling) { // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] markTaskYield(currentTask, currentTime); } advanceTimers(currentTime); @@ -225,6 +228,7 @@ function workLoop(initialTime: number) { } else { if (enableProfiling) { // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] markTaskCompleted(currentTask, currentTime); // $FlowFixMe[incompatible-use] found when upgrading Flow currentTask.isQueued = false; @@ -310,6 +314,7 @@ function unstable_next(eventHandler: () => T): T { function unstable_wrapCallback) => mixed>(callback: T): T { var parentPriorityLevel = currentPriorityLevel; // $FlowFixMe[incompatible-return] + // $FlowFixMe[incompatible-type] // $FlowFixMe[missing-this-annot] return function () { // This is a fork of runWithPriority, inlined for performance. diff --git a/packages/scheduler/src/forks/SchedulerMock.js b/packages/scheduler/src/forks/SchedulerMock.js index cf76126410e..e478700064f 100644 --- a/packages/scheduler/src/forks/SchedulerMock.js +++ b/packages/scheduler/src/forks/SchedulerMock.js @@ -164,6 +164,7 @@ function flushWork(hasTimeRemaining: boolean, initialTime: number) { if (currentTask !== null) { const currentTime = getCurrentTime(); // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] markTaskErrored(currentTask, currentTime); // $FlowFixMe[incompatible-use] found when upgrading Flow currentTask.isQueued = false; @@ -208,6 +209,7 @@ function workLoop(hasTimeRemaining: boolean, initialTime: number): boolean { const didUserCallbackTimeout = currentTask.expirationTime <= currentTime; if (enableProfiling) { // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] markTaskRun(currentTask, currentTime); } const continuationCallback = callback(didUserCallbackTimeout); @@ -219,6 +221,7 @@ function workLoop(hasTimeRemaining: boolean, initialTime: number): boolean { currentTask.callback = continuationCallback; if (enableProfiling) { // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] markTaskYield(currentTask, currentTime); } advanceTimers(currentTime); @@ -234,6 +237,7 @@ function workLoop(hasTimeRemaining: boolean, initialTime: number): boolean { } else { if (enableProfiling) { // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] markTaskCompleted(currentTask, currentTime); // $FlowFixMe[incompatible-use] found when upgrading Flow currentTask.isQueued = false; @@ -313,6 +317,7 @@ function unstable_next(eventHandler: () => T): T { function unstable_wrapCallback) => mixed>(callback: T): T { var parentPriorityLevel = currentPriorityLevel; // $FlowFixMe[incompatible-return] + // $FlowFixMe[incompatible-type] // $FlowFixMe[missing-this-annot] return function () { // This is a fork of runWithPriority, inlined for performance. diff --git a/packages/shared/CheckStringCoercion.js b/packages/shared/CheckStringCoercion.js index a186d6755d9..b117b7acfe5 100644 --- a/packages/shared/CheckStringCoercion.js +++ b/packages/shared/CheckStringCoercion.js @@ -18,6 +18,7 @@ */ // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. +// $FlowFixMe[incompatible-type] function typeName(value: mixed): string { if (__DEV__) { // toStringTag is needed for namespaced types like Temporal.Instant @@ -27,11 +28,13 @@ function typeName(value: mixed): string { (value: any).constructor.name || 'Object'; // $FlowFixMe[incompatible-return] + // $FlowFixMe[incompatible-type] return type; } } // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. +// $FlowFixMe[incompatible-type] function willCoercionThrow(value: mixed): boolean { if (__DEV__) { try { diff --git a/yarn.lock b/yarn.lock index bfce9322918..5bffcc53432 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9222,17 +9222,17 @@ flatted@^3.2.9: resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a" integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw== -flow-bin@^0.279.0: - version "0.279.0" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.279.0.tgz#06e502a51d735083d715ef769f43bdcb0fc2bb61" - integrity sha512-Xf0T82atOcEf5auHvJfUF+wWIxieBuUJZBu2hlAizdhAzwqSJic74ZLaL6N5SsE0SY9PxPf3Z/lBU7iRpRa9Lw== +flow-bin@^0.282.0: + version "0.282.0" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.282.0.tgz#ecbbd0c032c37eb7791eb66a790b9902eab492a6" + integrity sha512-gZnUBsnMN8iYAcvJLEoF04gLaegv93h8IB1e4HURBaPuyUZoBaStAm5z24wl9NviaB66GbN+hZ9vxDSa+HzlzQ== -flow-remove-types@^2.279.0: - version "2.279.0" - resolved "https://registry.yarnpkg.com/flow-remove-types/-/flow-remove-types-2.279.0.tgz#3a3388d9158eba0f82c40d80d31d9640b883a3f5" - integrity sha512-bPFloMR/A2b/r/sIsf7Ix0LaMicCJNjwhXc4xEEQVzJCIz5u7C7XDaEOXOiqveKlCYK7DcBNn6R01Cbbc9gsYA== +flow-remove-types@^2.282.0: + version "2.293.0" + resolved "https://registry.yarnpkg.com/flow-remove-types/-/flow-remove-types-2.293.0.tgz#ff63c979bbf0da625cc5a9a33af546261ee23307" + integrity sha512-UoF3jXBZ3YH1SYSMq+bLchQ7HGOBykPHThCyl7FdWspCzcW1qQ2nVbkbv5fclzLOzlEZ42c8LpeliAC0tqORzA== dependencies: - hermes-parser "0.29.1" + hermes-parser "0.32.0" pirates "^3.0.2" vlq "^0.2.1" @@ -10114,23 +10114,11 @@ hermes-estree@0.25.1: resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.25.1.tgz#6aeec17d1983b4eabf69721f3aa3eb705b17f480" integrity sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw== -hermes-estree@0.29.1: - version "0.29.1" - resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.29.1.tgz#043c7db076e0e8ef8c5f6ed23828d1ba463ebcc5" - integrity sha512-jl+x31n4/w+wEqm0I2r4CMimukLbLQEYpisys5oCre611CI5fc9TxhqkBBCJ1edDG4Kza0f7CgNz8xVMLZQOmQ== - hermes-estree@0.32.0: version "0.32.0" resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.32.0.tgz#bb7da6613ab8e67e334a1854ea1e209f487d307b" integrity sha512-KWn3BqnlDOl97Xe1Yviur6NbgIZ+IP+UVSpshlZWkq+EtoHg6/cwiDj/osP9PCEgFE15KBm1O55JRwbMEm5ejQ== -hermes-parser@0.29.1: - version "0.29.1" - resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.29.1.tgz#436b24bcd7bb1e71f92a04c396ccc0716c288d56" - integrity sha512-xBHWmUtRC5e/UL0tI7Ivt2riA/YBq9+SiYFU7C1oBa/j2jYGlIF9043oak1F47ihuDIxQ5nbsKueYJDRY02UgA== - dependencies: - hermes-estree "0.29.1" - hermes-parser@0.32.0, hermes-parser@^0.32.0: version "0.32.0" resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.32.0.tgz#7916984ef6fdce62e7415d354cf35392061cd303"