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
12 changes: 6 additions & 6 deletions 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: mixed): Promise<void>;
read(): Promise<{
value: ?any,
done: boolean,
Expand All @@ -57,7 +57,7 @@ declare interface UnderlyingSource {

start?: (controller: ReadableStreamController) => ?Promise<void>;
pull?: (controller: ReadableStreamController) => ?Promise<void>;
cancel?: (reason: string) => ?Promise<void>;
cancel?: (reason: mixed) => ?Promise<void>;
}

declare class TransformStream {
Expand All @@ -78,8 +78,8 @@ type PipeToOptions = {
};

type QueuingStrategy = {
highWaterMark: number,
size(chunk: ?any): number,
highWaterMark?: number,
size?: (chunk: ?any) => number,
...
};

Expand All @@ -91,7 +91,7 @@ declare class ReadableStream {

locked: boolean;

cancel(reason: string): void;
cancel(reason: mixed): Promise<void>;
getReader(): ReadableStreamReader;
pipeThrough(transform: PipeThroughTransformStream, options: ?any): void;
pipeTo(dest: WritableStream, options: ?PipeToOptions): Promise<void>;
Expand All @@ -106,7 +106,7 @@ declare interface UnderlyingSink {
autoAllocateChunkSize?: number;
type?: string;

abort?: (reason: string) => ?Promise<void>;
abort?: (reason: mixed) => ?Promise<void>;
close?: (controller: WritableStreamController) => ?Promise<void>;
start?: (controller: WritableStreamController) => ?Promise<void>;
write?: (chunk: any, controller: WritableStreamController) => ?Promise<void>;
Expand Down
48 changes: 27 additions & 21 deletions flow-typed/environments/web-animations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<CompositeOperationOrAuto>,
easing: string | Array<string>,
offset: number | null | Array<number | null>,
composite?: CompositeOperationOrAuto | Array<CompositeOperationOrAuto>,
easing?: string | Array<string>,
offset?: number | null | Array<number | null>,
|};

type ComputedEffectTiming = {|
Expand All @@ -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 = {
Expand Down Expand Up @@ -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;
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.286.0",
"flow-remove-types": "^2.286.0",
"flow-typed": "^4.1.1",
"glob": "^7.1.6",
"glob-stream": "^6.1.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/internal-test-utils/internalAct.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ export async function act<T>(scope: () => Thenable<T>): Thenable<T> {
}

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

// $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] Entry.next can be null at runtime
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
}
17 changes: 10 additions & 7 deletions packages/react-client/src/ReactFlightClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,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 @@ -501,6 +501,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 @@ -720,6 +721,7 @@ function triggerErrorOnChunk<T>(
const streamChunk: InitializedStreamChunk<any> = (chunk: any);
const controller = streamChunk.reason;
// $FlowFixMe[incompatible-call]: The error method should accept mixed.
// $FlowFixMe[incompatible-type]
controller.error(error);
return;
}
Expand Down Expand Up @@ -3207,6 +3209,7 @@ function startReadableStream<T>(
error(error: mixed): void {
if (previousBlockedChunk === null) {
// $FlowFixMe[incompatible-call]
// $FlowFixMe[incompatible-type]
controller.error(error);
} else {
const blockedChunk = previousBlockedChunk;
Expand Down Expand Up @@ -3920,7 +3923,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 @@ -4266,7 +4269,7 @@ function logComponentInfo(
childrenEndTime: number,
isLastComponent: boolean,
): void {
// $FlowFixMe: Refined.
// $FlowFixMe[incompatible-use]: Refined.
if (
isLastComponent &&
root.status === ERRORED &&
Expand Down Expand Up @@ -4445,7 +4448,7 @@ function flushComponentPerformance(
if (componentEndTime > childrenEndTime) {
childrenEndTime = componentEndTime;
}
// $FlowFixMe: Refined.
// $FlowFixMe[incompatible-type]: Refined.
const componentInfo: ReactComponentInfo = candidateInfo;
logComponentInfo(
response,
Expand All @@ -4469,7 +4472,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 @@ -4532,7 +4535,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
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions packages/react-client/src/ReactFlightReplyClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -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);
Expand Down Expand Up @@ -645,6 +647,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 @@ -829,6 +832,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);
}

Expand All @@ -855,6 +859,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);
}
}
Expand Down Expand Up @@ -934,6 +939,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;
Expand Down Expand Up @@ -964,6 +970,7 @@ function customEncodeFormAction(
);
}
let boundPromise: Promise<Array<any>> = (referenceClosure.bound: any);
// $FlowFixMe[invalid-compare]
if (boundPromise === null) {
boundPromise = Promise.resolve([]);
}
Expand Down Expand Up @@ -1184,6 +1191,7 @@ function bind(this: Function): Function {

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const getModuleDebugInfo = $$$config.getModuleDebugInfo;
export const dispatchHint = $$$config.dispatchHint;
export const prepareDestinationForModule =
$$$config.prepareDestinationForModule;
export const usedWithSSR = true;
export const usedWithSSR: boolean = true;

export opaque type Source = mixed;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ export * from 'react-client/src/ReactClientConsoleConfigBrowser';
export * from 'react-server-dom-esm/src/client/ReactFlightClientConfigBundlerESM';
export * from 'react-server-dom-esm/src/client/ReactFlightClientConfigTargetESMBrowser';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const usedWithSSR = false;
export const usedWithSSR: boolean = false;
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ export * from 'react-client/src/ReactClientConsoleConfigBrowser';
export * from 'react-server-dom-parcel/src/client/ReactFlightClientConfigBundlerParcel';
export * from 'react-server-dom-parcel/src/client/ReactFlightClientConfigTargetParcelBrowser';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const usedWithSSR = false;
export const usedWithSSR: boolean = false;
Loading
Loading