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.282.0",
"flow-remove-types": "^2.282.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
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
}
16 changes: 9 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 @@ -720,6 +720,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 +3208,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 +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;
Expand Down Expand Up @@ -4266,7 +4268,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 +4447,7 @@ function flushComponentPerformance(
if (componentEndTime > childrenEndTime) {
childrenEndTime = componentEndTime;
}
// $FlowFixMe: Refined.
// $FlowFixMe[incompatible-type]: Refined.
const componentInfo: ReactComponentInfo = candidateInfo;
logComponentInfo(
response,
Expand All @@ -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;
Expand Down Expand Up @@ -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(
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
6 changes: 6 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 @@ -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);
}

Expand All @@ -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);
}
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -1184,6 +1189,7 @@ function bind(this: Function): Function {

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

Expand Down
2 changes: 2 additions & 0 deletions packages/react-debug-tools/src/ReactDebugHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -726,9 +726,11 @@ function useActionState<S, P>(

function useHostTransitionStatus(): TransitionStatus {
const status = readContext<TransitionStatus>(
// $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<TransitionStatus>),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading
Loading