mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
afea1d0c53
Added an explicit type to all $FlowFixMe suppressions to reduce over-suppressions of new errors that might be caused on the same lines. Also removes suppressions that aren't used (e.g. in a `@noflow` file as they're purely misleading) Test Plan: yarn flow-ci
57 lines
1.8 KiB
JavaScript
57 lines
1.8 KiB
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow
|
|
*/
|
|
|
|
import type {RowEncoding} from './ReactFlightNativeRelayProtocol';
|
|
|
|
import type {Response} from 'react-client/src/ReactFlightClient';
|
|
|
|
import {
|
|
createResponse,
|
|
resolveModel,
|
|
resolveModule,
|
|
resolveErrorDev,
|
|
resolveErrorProd,
|
|
close,
|
|
getRoot,
|
|
} from 'react-client/src/ReactFlightClient';
|
|
|
|
export {createResponse, close, getRoot};
|
|
|
|
export function resolveRow(response: Response, chunk: RowEncoding): void {
|
|
if (chunk[0] === 'O') {
|
|
// $FlowFixMe[incompatible-call] `Chunk` doesn't flow into `JSONValue` because of the `E` row type.
|
|
resolveModel(response, chunk[1], chunk[2]);
|
|
} else if (chunk[0] === 'I') {
|
|
// $FlowFixMe[incompatible-call] `Chunk` doesn't flow into `JSONValue` because of the `E` row type.
|
|
resolveModule(response, chunk[1], chunk[2]);
|
|
} else {
|
|
if (__DEV__) {
|
|
resolveErrorDev(
|
|
response,
|
|
chunk[1],
|
|
// $FlowFixMe[incompatible-call]: Flow doesn't support disjoint unions on tuples.
|
|
// $FlowFixMe[incompatible-use]
|
|
// $FlowFixMe[prop-missing]
|
|
chunk[2].digest,
|
|
// $FlowFixMe[incompatible-call]: Flow doesn't support disjoint unions on tuples.
|
|
// $FlowFixMe[incompatible-use]
|
|
chunk[2].message || '',
|
|
// $FlowFixMe[incompatible-call]: Flow doesn't support disjoint unions on tuples.
|
|
// $FlowFixMe[incompatible-use]
|
|
chunk[2].stack || '',
|
|
);
|
|
} else {
|
|
// $FlowFixMe[incompatible-call]: Flow doesn't support disjoint unions on tuples.
|
|
// $FlowFixMe[incompatible-use]
|
|
// $FlowFixMe[prop-missing]
|
|
resolveErrorProd(response, chunk[1], chunk[2].digest);
|
|
}
|
|
}
|
|
}
|