Skip to content
Open
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
1 change: 1 addition & 0 deletions flow-typed/environments/bom.js
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,7 @@ declare class SharedWorker extends EventTarget {
declare function importScripts(...urls: Array<string | TrustedScriptURL>): void;

declare class WorkerGlobalScope extends EventTarget {
// $FlowFixMe[incompatible-variance]
self: this;
location: WorkerLocation;
navigator: WorkerNavigator;
Expand Down
1 change: 1 addition & 0 deletions flow-typed/environments/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,7 @@ declare class HTMLCollection<+Elem: Element> {
length: number;
item(nameOrIndex?: any, optionalIndex?: any): Elem | null;
namedItem(name: string): Elem | null;
// $FlowFixMe[incompatible-variance]
[index: number | string]: Elem;
}

Expand Down
3 changes: 3 additions & 0 deletions flow-typed/environments/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -1908,6 +1908,7 @@ type http$agentOptions = {
declare class http$Agent<+SocketT = net$Socket> {
constructor(options: http$agentOptions): void;
destroy(): void;
// $FlowFixMe[incompatible-variance]
freeSockets: {[name: string]: $ReadOnlyArray<SocketT>, ...};
getName(options: {
host: string,
Expand All @@ -1917,7 +1918,9 @@ declare class http$Agent<+SocketT = net$Socket> {
}): string;
maxFreeSockets: number;
maxSockets: number;
// $FlowFixMe[incompatible-variance]
requests: {[name: string]: $ReadOnlyArray<http$ClientRequest<SocketT>>, ...};
// $FlowFixMe[incompatible-variance]
sockets: {[name: string]: $ReadOnlyArray<SocketT>, ...};
}

Expand Down
2 changes: 1 addition & 1 deletion flow-typed/environments/streams.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ declare class ReadableStreamReader {

closed: boolean;

cancel(reason: string): void;
cancel(reason: string): Promise<void>;
read(): Promise<{
value: ?any,
done: boolean,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.307.1",
"flow-remove-types": "^2.307.1",
"flow-typed": "^4.1.1",
"glob": "^7.1.6",
"glob-stream": "^6.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/internal-test-utils/internalAct.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export async function act<T>(scope: () => Thenable<T>): Thenable<T> {
throw thrownError;
}

// $FlowFixMe[incompatible-return]
// $FlowFixMe[incompatible-type]
return result;
} finally {
const depth = actingUpdatesScopeDepth;
Expand Down Expand Up @@ -285,7 +285,7 @@ export async function serverAct<T>(scope: () => Thenable<T>): Thenable<T> {
throw thrownError;
}

// $FlowFixMe[incompatible-return]
// $FlowFixMe[incompatible-type]
return result;
} finally {
if (typeof process === 'object') {
Expand Down
1 change: 1 addition & 0 deletions packages/react-cache/src/LRU.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export function createLRU<T>(limit: number): LRU<T> {

function access(entry: Entry<T>): T {
const next = entry.next;
// $FlowFixMe[invalid-compare]
if (next !== null) {
// Entry already cached
const resolvedFirst: Entry<T> = (first: any);
Expand Down
5 changes: 3 additions & 2 deletions packages/react-client/src/ReactClientConsoleConfigBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down Expand Up @@ -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
}
5 changes: 3 additions & 2 deletions packages/react-client/src/ReactClientConsoleConfigPlain.js
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand All @@ -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
}
5 changes: 3 additions & 2 deletions packages/react-client/src/ReactClientConsoleConfigServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down Expand Up @@ -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
}
25 changes: 14 additions & 11 deletions packages/react-client/src/ReactFlightClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,12 @@ ReactPromise.prototype.then = function <T>(
const rejectCallback = reject;
const wrapperPromise: Promise<T> = 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);
};
Expand Down Expand Up @@ -499,6 +499,7 @@ function filterDebugInfo(
response: Response,
value: {_debugInfo: ReactDebugInfo, ...},
) {
// $FlowFixMe[invalid-compare]
if (response._debugEndTime === null) {
// No end time was defined, so we keep all debug info entries.
return;
Expand Down Expand Up @@ -722,7 +723,7 @@ function triggerErrorOnChunk<T>(
// a stream chunk since any other row shouldn't have more than one entry.
const streamChunk: InitializedStreamChunk<any> = (chunk: any);
const controller = streamChunk.reason;
// $FlowFixMe[incompatible-call]: The error method should accept mixed.
// $FlowFixMe[incompatible-type]: The error method should accept mixed.
controller.error(error);
return;
}
Expand Down Expand Up @@ -3294,7 +3295,7 @@ function startReadableStream<T>(
}
closed = true;
if (previousBlockedChunk === null) {
// $FlowFixMe[incompatible-call]
// $FlowFixMe[incompatible-type]
controller.error(error);
} else {
const blockedChunk = previousBlockedChunk;
Expand Down Expand Up @@ -3526,11 +3527,12 @@ function resolveErrorDev(
let error;
const errorOptions =
// We don't serialize Error.cause in prod so we never need to deserialize
// $FlowFixMe[constant-condition]
__DEV__ && 'cause' in errorInfo
? {
cause: reviveModel(
response,
// $FlowFixMe[incompatible-cast] -- Flow thinks `cause` in `cause?: JSONValue` can be undefined after `in` check.
// $FlowFixMe[incompatible-type] -- Flow thinks `cause` in `cause?: JSONValue` can be undefined after `in` check.
(errorInfo.cause: JSONValue),
errorInfo,
'cause',
Expand All @@ -3544,7 +3546,7 @@ function resolveErrorDev(
__DEV__ && isAggregateError
? reviveModel(
response,
// $FlowFixMe[incompatible-cast]
// $FlowFixMe[incompatible-type]
(errorInfo.errors: JSONValue),
errorInfo,
'errors',
Expand Down Expand Up @@ -4059,7 +4061,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;
Expand Down Expand Up @@ -4411,7 +4413,7 @@ function logComponentInfo(
childrenEndTime: number,
isLastComponent: boolean,
): void {
// $FlowFixMe: Refined.
// $FlowFixMe[incompatible-type]: Refined.
if (
isLastComponent &&
root.status === ERRORED &&
Expand Down Expand Up @@ -4590,7 +4592,7 @@ function flushComponentPerformance(
if (componentEndTime > childrenEndTime) {
childrenEndTime = componentEndTime;
}
// $FlowFixMe: Refined.
// $FlowFixMe[incompatible-type]: Refined.
const componentInfo: ReactComponentInfo = candidateInfo;
logComponentInfo(
response,
Expand All @@ -4614,7 +4616,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;
Expand Down Expand Up @@ -4677,7 +4679,7 @@ function flushComponentPerformance(
if (componentEndTime > childrenEndTime) {
childrenEndTime = componentEndTime;
}
// $FlowFixMe: Refined.
// $FlowFixMe[incompatible-type]: Refined.
const componentInfo: ReactComponentInfo = candidateInfo;
const env = response._rootEnvironmentName;
logComponentAborted(
Expand Down Expand Up @@ -5323,6 +5325,7 @@ function reviveModel(
for (let i = 0; i < value.length; i++) {
(value: any)[i] = reviveModel(response, value[i], value, '' + i);
}
// $FlowFixMe[invalid-compare]
if (value[0] === REACT_ELEMENT_TYPE) {
// React element tuple
return parseModelTuple(response, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export function readPartialStringChunk(
decoder: StringDecoder,
buffer: Uint8Array,
): string {
// $FlowFixMe[incompatible-type]
return decoder.decode(buffer, decoderOptions);
}

Expand Down
16 changes: 10 additions & 6 deletions packages/react-client/src/ReactFlightReplyClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,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?
Expand All @@ -601,7 +601,7 @@ export function processReply(
const prefix = formFieldPrefix + refId + '_';
// $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);
Expand Down Expand Up @@ -695,6 +695,7 @@ export function processReply(
const iteratorFn = getIteratorFn(value);
if (iteratorFn) {
const iterator = iteratorFn.call(value);
// $FlowFixMe[invalid-compare]
if (iterator === value) {
// Iterator, not Iterable
const iteratorId = nextPartId++;
Expand Down Expand Up @@ -885,7 +886,7 @@ export function processReply(
}
}
modelRoot = model;
// $FlowFixMe[incompatible-return] it's not going to be undefined because we'll encode it.
// $FlowFixMe[incompatible-type] it's not going to be undefined because we'll encode it.
return JSON.stringify(model, resolveToJSON);
}

Expand All @@ -911,7 +912,7 @@ export function processReply(
// Otherwise, we use FormData to let us stream in the result.
formData.set(formFieldPrefix + '0', json);
if (pendingParts === 0) {
// $FlowFixMe[incompatible-call] this has already been refined.
// $FlowFixMe[incompatible-type] this has already been refined.
resolve(formData);
}
}
Expand Down Expand Up @@ -990,7 +991,7 @@ function defaultEncodeFormAction(
const prefixedData = new FormData();
// $FlowFixMe[prop-missing]
encodedFormData.forEach((value: string | File, key: string) => {
// $FlowFixMe[incompatible-call]
// $FlowFixMe[incompatible-type]
prefixedData.append('$ACTION_' + identifierPrefix + ':' + key, value);
});
data = prefixedData;
Expand Down Expand Up @@ -1021,6 +1022,7 @@ function customEncodeFormAction(
);
}
let boundPromise: Promise<Array<any>> = (referenceClosure.bound: any);
// $FlowFixMe[invalid-compare]
if (boundPromise === null) {
boundPromise = Promise.resolve([]);
}
Expand Down Expand Up @@ -1200,6 +1202,7 @@ export function registerBoundServerReference<T: Function>(

// Expose encoder for use by SSR, as well as a special bind that can be used to
// keep server capabilities.
// $FlowFixMe[constant-condition]
if (usedWithSSR) {
// Only expose this in builds that would actually use it. Not needed in the browser.
const $$FORM_ACTION =
Expand Down Expand Up @@ -1240,7 +1243,7 @@ function bind(this: Function): Function {
const referenceClosure = knownServerReferences.get(this);

if (!referenceClosure) {
// $FlowFixMe[incompatible-call]
// $FlowFixMe[incompatible-type]
return FunctionBind.apply(this, arguments);
}

Expand Down Expand Up @@ -1276,6 +1279,7 @@ function bind(this: Function): Function {

// Expose encoder for use by SSR, as well as a special bind that can be used to
// keep server capabilities.
// $FlowFixMe[constant-condition]
if (usedWithSSR) {
// Only expose this in builds that would actually use it. Not needed on the client.
Object.defineProperties((newFn: any), {
Expand Down
6 changes: 5 additions & 1 deletion packages/react-debug-tools/src/ReactDebugHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ const SuspenseException: mixed = new Error(
);

function use<T>(usable: Usable<T>): T {
// $FlowFixMe[invalid-compare]
if (usable !== null && typeof usable === 'object') {
// $FlowFixMe[method-unbinding]
if (typeof usable.then === 'function') {
Expand Down Expand Up @@ -729,8 +730,9 @@ function useActionState<S, P>(
function useHostTransitionStatus(): TransitionStatus {
const status = readContext<TransitionStatus>(
// $FlowFixMe[prop-missing] `readContext` only needs _currentValue
// $FlowFixMe[incompatible-type]
({
// $FlowFixMe[incompatible-cast] TODO: Incorrect bottom value without access to Fiber config.
// $FlowFixMe[incompatible-type] TODO: Incorrect bottom value without access to Fiber config.
_currentValue: null,
}: ReactContext<TransitionStatus>),
);
Expand Down Expand Up @@ -1341,10 +1343,12 @@ export function inspectHooksOfFiber(
} else if (hasOwnProperty.call(currentFiber, 'dependencies_old')) {
const dependencies: Dependencies = (currentFiber: any).dependencies_old;
currentContextDependency =
// $FlowFixMe[invalid-compare]
dependencies !== null ? dependencies.firstContext : null;
} else if (hasOwnProperty.call(currentFiber, 'dependencies_new')) {
const dependencies: Dependencies = (currentFiber: any).dependencies_new;
currentContextDependency =
// $FlowFixMe[invalid-compare]
dependencies !== null ? dependencies.firstContext : null;
} else if (hasOwnProperty.call(currentFiber, 'contextDependencies')) {
const contextDependencies = (currentFiber: any).contextDependencies;
Expand Down
Loading
Loading