Compare commits

..

1 Commits

Author SHA1 Message Date
Lauren Tan
d2bce7bf3e [flow] Upgrade from 0.286 -> 0.292
Updates flow-typed definitions and adds suppressions for regressions
  in the updated type definitions:
  - TextDecoder: constructor options should be optional
  - TextEncoder: missing encodeInto method
  - ReadableStreamDefaultReader: cancel() returns Promise<void>
  - Animation types: missing optional properties
  - error-stack-parser: module type export
2025-12-08 13:07:23 -08:00
15 changed files with 3008 additions and 4581 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -45,7 +45,7 @@ declare class DataTransferItem {
getAsFileSystemHandle?: () => Promise<?FileSystemHandle>;
}
declare type DOMStringMap = {[key: string]: string, ...};
declare type DOMStringMap = { [key: string]: string, ... };
declare class DOMStringList {
@@iterator(): Iterator<string>;
@@ -55,7 +55,7 @@ declare class DOMStringList {
contains(string): boolean;
}
declare type ElementDefinitionOptions = {|extends?: string|};
declare type ElementDefinitionOptions = {| extends?: string |};
declare interface CustomElementRegistry {
define(
@@ -71,7 +71,7 @@ declare interface CustomElementRegistry {
declare class EventSource extends EventTarget {
constructor(
url: string,
configuration?: {withCredentials: boolean, ...}
configuration?: { withCredentials: boolean, ... }
): void;
+CLOSED: 2;
+CONNECTING: 0;
@@ -145,7 +145,7 @@ declare class ToggleEvent extends Event {
}
// TODO: HTMLDocument
type FocusOptions = {preventScroll?: boolean, ...};
type FocusOptions = { preventScroll?: boolean, ... };
declare class HTMLElement extends Element {
blur(): void;
@@ -154,10 +154,10 @@ declare class HTMLElement extends Element {
getBoundingClientRect(): DOMRect;
forceSpellcheck(): void;
showPopover(options?: {|source?: HTMLElement|}): void;
showPopover(options?: {| source?: HTMLElement |}): void;
hidePopover(): void;
togglePopover(
options?: boolean | {|force?: boolean, source?: HTMLElement|}
options?: boolean | {| force?: boolean, source?: HTMLElement |}
): boolean;
accessKey: string;
@@ -261,7 +261,7 @@ declare class HTMLElement extends Element {
declare class HTMLSlotElement extends HTMLElement {
name: string;
assignedNodes(options?: {flatten: boolean, ...}): Node[];
assignedNodes(options?: { flatten: boolean, ... }): Node[];
}
declare class HTMLTableElement extends HTMLElement {
@@ -1566,7 +1566,7 @@ declare function requestIdleCallback(
timeRemaining: () => number,
...
}) => void,
opts?: {timeout: number, ...}
opts?: { timeout: number, ... }
): IdleCallbackID;
declare function cancelIdleCallback(id: IdleCallbackID): void;
declare var localStorage: Storage;

File diff suppressed because it is too large Load Diff

View File

@@ -5,22 +5,22 @@ type FrameType = 'auxiliary' | 'top-level' | 'nested' | 'none';
type VisibilityState = 'hidden' | 'visible' | 'prerender' | 'unloaded';
declare class WindowClient extends Client {
visibilityState: VisibilityState;
focused: boolean;
focus(): Promise<WindowClient>;
navigate(url: string): Promise<WindowClient>;
visibilityState: VisibilityState,
focused: boolean,
focus(): Promise<WindowClient>,
navigate(url: string): Promise<WindowClient>,
}
declare class Client {
id: string;
reserved: boolean;
url: string;
frameType: FrameType;
postMessage(message: any, transfer?: Iterator<any> | Array<any>): void;
id: string,
reserved: boolean,
url: string,
frameType: FrameType,
postMessage(message: any, transfer?: Iterator<any> | Array<any>): void,
}
declare class ExtendableEvent extends Event {
waitUntil(f: Promise<mixed>): void;
waitUntil(f: Promise<mixed>): void,
}
type NotificationEvent$Init = {
@@ -28,12 +28,12 @@ type NotificationEvent$Init = {
notification: Notification,
action?: string,
...
};
}
declare class NotificationEvent extends ExtendableEvent {
constructor(type: string, eventInitDict?: NotificationEvent$Init): void;
+notification: Notification;
+action: string;
constructor(type: string, eventInitDict?: NotificationEvent$Init):void;
+notification: Notification,
+action: string,
}
type ForeignFetchOptions = {
@@ -43,15 +43,15 @@ type ForeignFetchOptions = {
};
declare class InstallEvent extends ExtendableEvent {
registerForeignFetch(options: ForeignFetchOptions): void;
registerForeignFetch(options: ForeignFetchOptions): void,
}
declare class FetchEvent extends ExtendableEvent {
request: Request;
clientId: string;
isReload: boolean;
respondWith(response: Response | Promise<Response>): void;
preloadResponse: Promise<?Response>;
request: Request,
clientId: string,
isReload: boolean,
respondWith(response: Response | Promise<Response>): void,
preloadResponse: Promise<?Response>,
}
type ClientType = 'window' | 'worker' | 'sharedworker' | 'all';
@@ -63,68 +63,65 @@ type ClientQueryOptions = {
};
declare class Clients {
get(id: string): Promise<?Client>;
matchAll(options?: ClientQueryOptions): Promise<Array<Client>>;
openWindow(url: string): Promise<?WindowClient>;
claim(): Promise<void>;
get(id: string): Promise<?Client>,
matchAll(options?: ClientQueryOptions): Promise<Array<Client>>,
openWindow(url: string): Promise<?WindowClient>,
claim(): Promise<void>,
}
type ServiceWorkerState =
| 'installing'
type ServiceWorkerState = 'installing'
| 'installed'
| 'activating'
| 'activated'
| 'redundant';
declare class ServiceWorker extends EventTarget {
scriptURL: string;
state: ServiceWorkerState;
scriptURL: string,
state: ServiceWorkerState,
postMessage(message: any, transfer?: Iterator<any>): void;
postMessage(message: any, transfer?: Iterator<any>): void,
onstatechange?: EventHandler;
onstatechange?: EventHandler,
}
declare class NavigationPreloadState {
enabled: boolean;
headerValue: string;
enabled: boolean,
headerValue: string,
}
declare class NavigationPreloadManager {
enable: Promise<void>;
disable: Promise<void>;
setHeaderValue(value: string): Promise<void>;
getState: Promise<NavigationPreloadState>;
enable: Promise<void>,
disable: Promise<void>,
setHeaderValue(value: string): Promise<void>,
getState: Promise<NavigationPreloadState>,
}
type PushSubscriptionOptions = {
userVisibleOnly?: boolean,
applicationServerKey?: string | ArrayBuffer | $ArrayBufferView,
...
};
}
declare class PushSubscriptionJSON {
endpoint: string;
expirationTime: number | null;
keys: {[string]: string, ...};
endpoint: string,
expirationTime: number | null,
keys: { [string]: string, ... };
}
declare class PushSubscription {
+endpoint: string;
+expirationTime: number | null;
+options: PushSubscriptionOptions;
getKey(name: string): ArrayBuffer | null;
toJSON(): PushSubscriptionJSON;
unsubscribe(): Promise<boolean>;
+endpoint: string,
+expirationTime: number | null,
+options: PushSubscriptionOptions,
getKey(name: string): ArrayBuffer | null,
toJSON(): PushSubscriptionJSON,
unsubscribe(): Promise<boolean>,
}
declare class PushManager {
+supportedContentEncodings: Array<string>;
subscribe(options?: PushSubscriptionOptions): Promise<PushSubscription>;
getSubscription(): Promise<PushSubscription | null>;
permissionState(
options?: PushSubscriptionOptions
): Promise<'granted' | 'denied' | 'prompt'>;
+supportedContentEncodings: Array<string>,
subscribe(options?: PushSubscriptionOptions): Promise<PushSubscription>,
getSubscription(): Promise<PushSubscription | null>,
permissionState(options?: PushSubscriptionOptions): Promise<'granted' | 'denied' | 'prompt'>,
}
type ServiceWorkerUpdateViaCache = 'imports' | 'all' | 'none';
@@ -135,25 +132,20 @@ type GetNotificationOptions = {
};
declare class ServiceWorkerRegistration extends EventTarget {
+installing: ?ServiceWorker;
+waiting: ?ServiceWorker;
+active: ?ServiceWorker;
+navigationPreload: NavigationPreloadManager;
+scope: string;
+updateViaCache: ServiceWorkerUpdateViaCache;
+pushManager: PushManager;
+installing: ?ServiceWorker,
+waiting: ?ServiceWorker,
+active: ?ServiceWorker,
+navigationPreload: NavigationPreloadManager,
+scope: string,
+updateViaCache: ServiceWorkerUpdateViaCache,
+pushManager: PushManager,
getNotifications?: (
filter?: GetNotificationOptions
) => Promise<$ReadOnlyArray<Notification>>;
showNotification?: (
title: string,
options?: NotificationOptions
) => Promise<void>;
update(): Promise<void>;
unregister(): Promise<boolean>;
getNotifications?: (filter?: GetNotificationOptions) => Promise<$ReadOnlyArray<Notification>>,
showNotification?: (title: string, options?: NotificationOptions) => Promise<void>,
update(): Promise<void>,
unregister(): Promise<boolean>,
onupdatefound?: EventHandler;
onupdatefound?: EventHandler,
}
type WorkerType = 'classic' | 'module';
@@ -166,41 +158,39 @@ type RegistrationOptions = {
};
declare class ServiceWorkerContainer extends EventTarget {
+controller: ?ServiceWorker;
+ready: Promise<ServiceWorkerRegistration>;
+controller: ?ServiceWorker,
+ready: Promise<ServiceWorkerRegistration>,
getRegistration(
clientURL?: string
): Promise<ServiceWorkerRegistration | void>;
getRegistrations(): Promise<Iterator<ServiceWorkerRegistration>>;
getRegistration(clientURL?: string): Promise<ServiceWorkerRegistration | void>,
getRegistrations(): Promise<Iterator<ServiceWorkerRegistration>>,
register(
scriptURL: string | TrustedScriptURL,
options?: RegistrationOptions
): Promise<ServiceWorkerRegistration>;
startMessages(): void;
): Promise<ServiceWorkerRegistration>,
startMessages(): void,
oncontrollerchange?: EventHandler;
onmessage?: EventHandler;
onmessageerror?: EventHandler;
oncontrollerchange?: EventHandler,
onmessage?: EventHandler,
onmessageerror?: EventHandler,
}
/**
* This feature has been removed from the Web standards.
*/
declare class ServiceWorkerMessageEvent extends Event {
data: any;
lastEventId: string;
origin: string;
ports: Array<MessagePort>;
source: ?(ServiceWorker | MessagePort);
data: any,
lastEventId: string,
origin: string,
ports: Array<MessagePort>,
source: ?(ServiceWorker | MessagePort),
}
declare class ExtendableMessageEvent extends ExtendableEvent {
data: any;
lastEventId: string;
origin: string;
ports: Array<MessagePort>;
source: ?(ServiceWorker | MessagePort);
data: any,
lastEventId: string,
origin: string,
ports: Array<MessagePort>,
source: ?(ServiceWorker | MessagePort),
}
type CacheQueryOptions = {
@@ -209,30 +199,30 @@ type CacheQueryOptions = {
ignoreVary?: boolean,
cacheName?: string,
...
};
}
declare class Cache {
match(request: RequestInfo, options?: CacheQueryOptions): Promise<Response>;
match(request: RequestInfo, options?: CacheQueryOptions): Promise<Response>,
matchAll(
request: RequestInfo,
options?: CacheQueryOptions
): Promise<Array<Response>>;
add(request: RequestInfo): Promise<void>;
addAll(requests: Array<RequestInfo>): Promise<void>;
put(request: RequestInfo, response: Response): Promise<void>;
delete(request: RequestInfo, options?: CacheQueryOptions): Promise<boolean>;
): Promise<Array<Response>>,
add(request: RequestInfo): Promise<void>,
addAll(requests: Array<RequestInfo>): Promise<void>,
put(request: RequestInfo, response: Response): Promise<void>,
delete(request: RequestInfo, options?: CacheQueryOptions): Promise<boolean>,
keys(
request?: RequestInfo,
options?: CacheQueryOptions
): Promise<Array<Request>>;
): Promise<Array<Request>>,
}
declare class CacheStorage {
match(request: RequestInfo, options?: CacheQueryOptions): Promise<Response>;
has(cacheName: string): Promise<true>;
open(cacheName: string): Promise<Cache>;
delete(cacheName: string): Promise<boolean>;
keys(): Promise<Array<string>>;
match(request: RequestInfo, options?: CacheQueryOptions): Promise<Response>,
has(cacheName: string): Promise<true>,
open(cacheName: string): Promise<Cache>,
delete(cacheName: string): Promise<boolean>,
keys(): Promise<Array<string>>,
}
// Service worker global scope

View File

@@ -1,73 +1,73 @@
// flow-typed signature: e6e6768618776352dd676f63502aea4d
// flow-typed version: 40e7dfcbd5/streams/flow_>=v0.261.x
type TextEncodeOptions = {options?: boolean, ...};
type TextEncodeOptions = { options?: boolean, ... };
declare class ReadableStreamController {
constructor(
stream: ReadableStream,
underlyingSource: UnderlyingSource,
size: number,
highWaterMark: number
): void;
highWaterMark: number,
): void,
desiredSize: number;
desiredSize: number,
close(): void;
enqueue(chunk: any): void;
error(error: Error): void;
close(): void,
enqueue(chunk: any): void,
error(error: Error): void,
}
declare class ReadableStreamBYOBRequest {
constructor(controller: ReadableStreamController, view: $TypedArray): void;
constructor(controller: ReadableStreamController, view: $TypedArray): void,
view: $TypedArray;
view: $TypedArray,
respond(bytesWritten: number): ?any;
respondWithNewView(view: $TypedArray): ?any;
respond(bytesWritten: number): ?any,
respondWithNewView(view: $TypedArray): ?any,
}
declare class ReadableByteStreamController extends ReadableStreamController {
constructor(
stream: ReadableStream,
underlyingSource: UnderlyingSource,
highWaterMark: number
): void;
highWaterMark: number,
): void,
byobRequest: ReadableStreamBYOBRequest;
byobRequest: ReadableStreamBYOBRequest,
}
declare class ReadableStreamReader {
constructor(stream: ReadableStream): void;
constructor(stream: ReadableStream): void,
closed: boolean;
closed: boolean,
cancel(reason: mixed): Promise<void>;
cancel(reason: string): void,
read(): Promise<{
value: ?any,
done: boolean,
...
}>;
releaseLock(): void;
}>,
releaseLock(): void,
}
declare interface UnderlyingSource {
autoAllocateChunkSize?: number;
type?: string;
autoAllocateChunkSize?: number,
type?: string,
start?: (controller: ReadableStreamController) => ?Promise<void>;
pull?: (controller: ReadableStreamController) => ?Promise<void>;
cancel?: (reason: mixed) => ?Promise<void>;
start?: (controller: ReadableStreamController) => ?Promise<void>,
pull?: (controller: ReadableStreamController) => ?Promise<void>,
cancel?: (reason: string) => ?Promise<void>,
}
declare class TransformStream {
readable: ReadableStream;
writable: WritableStream;
}
readable: ReadableStream,
writable: WritableStream,
};
interface PipeThroughTransformStream {
readable: ReadableStream;
writable: WritableStream;
readable: ReadableStream,
writable: WritableStream,
}
type PipeToOptions = {
@@ -77,60 +77,60 @@ type PipeToOptions = {
...
};
type QueuingStrategy = {
highWaterMark?: number,
size?: (chunk: ?any) => number,
type QueuingStrategy = {
highWaterMark: number,
size(chunk: ?any): number,
...
};
declare class ReadableStream {
constructor(
underlyingSource: ?UnderlyingSource,
queuingStrategy: ?QueuingStrategy
): void;
queuingStrategy: ?QueuingStrategy,
): void,
locked: boolean;
locked: boolean,
cancel(reason: mixed): Promise<void>;
getReader(): ReadableStreamReader;
pipeThrough(transform: PipeThroughTransformStream, options: ?any): void;
pipeTo(dest: WritableStream, options: ?PipeToOptions): Promise<void>;
tee(): [ReadableStream, ReadableStream];
}
cancel(reason: string): void,
getReader(): ReadableStreamReader,
pipeThrough(transform: PipeThroughTransformStream, options: ?any): void,
pipeTo(dest: WritableStream, options: ?PipeToOptions): Promise<void>,
tee(): [ReadableStream, ReadableStream],
};
declare interface WritableStreamController {
error(error: Error): void;
error(error: Error): void,
}
declare interface UnderlyingSink {
autoAllocateChunkSize?: number;
type?: string;
autoAllocateChunkSize?: number,
type?: string,
abort?: (reason: mixed) => ?Promise<void>;
close?: (controller: WritableStreamController) => ?Promise<void>;
start?: (controller: WritableStreamController) => ?Promise<void>;
write?: (chunk: any, controller: WritableStreamController) => ?Promise<void>;
abort?: (reason: string) => ?Promise<void>,
close?: (controller: WritableStreamController) => ?Promise<void>,
start?: (controller: WritableStreamController) => ?Promise<void>,
write?: (chunk: any, controller: WritableStreamController) => ?Promise<void>,
}
declare interface WritableStreamWriter {
closed: Promise<any>;
desiredSize?: number;
ready: Promise<any>;
closed: Promise<any>,
desiredSize?: number,
ready: Promise<any>,
abort(reason: string): ?Promise<any>;
close(): Promise<any>;
releaseLock(): void;
write(chunk: any): Promise<any>;
abort(reason: string): ?Promise<any>,
close(): Promise<any>,
releaseLock(): void,
write(chunk: any): Promise<any>,
}
declare class WritableStream {
constructor(
underlyingSink: ?UnderlyingSink,
queuingStrategy: QueuingStrategy
): void;
queuingStrategy: QueuingStrategy,
): void,
locked: boolean;
locked: boolean,
abort(reason: string): void;
getWriter(): WritableStreamWriter;
abort(reason: string): void,
getWriter(): WritableStreamWriter,
}

View File

@@ -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 = {|
@@ -67,33 +67,28 @@ type DocumentTimelineOptions = {|
|};
type EffectTiming = {|
direction?: PlaybackDirection,
easing?: string,
fill?: FillMode,
iterations?: number,
iterationStart?: number,
delay?: number,
duration?: number | string,
endDelay?: number,
direction: PlaybackDirection,
easing: string,
fill: FillMode,
iterations: number,
iterationStart: number,
|};
type GetAnimationsOptions = {|
pseudoElement?: string | null,
subtree?: boolean,
pseudoElement: string | null,
subtree: boolean,
|};
type KeyframeAnimationOptions = {|
...KeyframeEffectOptions,
id?: string,
timeline?: AnimationTimeline | null,
rangeStart?: string,
rangeEnd?: string,
id: string,
timeline: AnimationTimeline | null,
|};
type KeyframeEffectOptions = {|
...EffectTiming,
composite?: CompositeOperation,
pseudoElement?: string | null,
composite: CompositeOperation,
pseudoElement: string | null,
|};
type Keyframe = {
@@ -182,7 +177,6 @@ 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;

View File

@@ -1,7 +1,7 @@
// flow-typed signature: 132e48034ef4756600e1d98681a166b5
// flow-typed version: c6154227d1/error-stack-parser_v2.x.x/flow_>=v0.104.x
declare module 'error-stack-parser' {
declare module "error-stack-parser" {
declare interface StackFrame {
constructor(object: StackFrame): StackFrame;

View File

@@ -5,8 +5,8 @@ declare module 'minimist' {
declare type minimistOptions = {
string?: string | Array<string>,
boolean?: boolean | string | Array<string>,
alias?: {[arg: string]: string | Array<string>, ...},
default?: {[arg: string]: any, ...},
alias?: { [arg: string]: string | Array<string>, ... },
default?: { [arg: string]: any, ... },
stopEarly?: boolean,
// TODO: Strings as keys don't work...
// '--'? boolean,
@@ -20,8 +20,5 @@ declare module 'minimist' {
...
};
declare module.exports: (
argv: Array<string>,
opts?: minimistOptions
) => minimistOutput;
declare module.exports: (argv: Array<string>, opts?: minimistOptions) => minimistOutput;
}

View File

@@ -75,8 +75,8 @@
"eslint-plugin-react-internal": "link:./scripts/eslint-rules",
"fbjs-scripts": "^3.0.1",
"filesize": "^6.0.1",
"flow-bin": "^0.288.0",
"flow-remove-types": "^2.288.0",
"flow-bin": "^0.292.0",
"flow-remove-types": "^2.292.0",
"flow-typed": "^4.1.1",
"glob": "^7.1.6",
"glob-stream": "^6.1.0",

View File

@@ -12,6 +12,7 @@ import {TextDecoder} from 'util';
export type StringDecoder = TextDecoder;
export function createStringDecoder(): StringDecoder {
// $FlowFixMe[incompatible-type] flow-typed has incorrect constructor signature
return new TextDecoder();
}

View File

@@ -1225,6 +1225,8 @@ function serializeReadableStream(
erroredTask(request, streamTask, reason);
enqueueFlush(request);
// $FlowFixMe[incompatible-type] flow-typed has wrong cancel() signature
// $FlowFixMe[incompatible-use] cancel() returns Promise<void>
reader.cancel(reason).then(error, error);
}
function abortStream() {
@@ -1243,6 +1245,8 @@ function serializeReadableStream(
erroredTask(request, streamTask, reason);
enqueueFlush(request);
}
// $FlowFixMe[incompatible-type] flow-typed has wrong cancel() signature
// $FlowFixMe[incompatible-use] cancel() returns Promise<void>
reader.cancel(reason).then(error, error);
}
@@ -3235,6 +3239,8 @@ function serializeDebugBlob(request: Request, blob: Blob): string {
const digest = '';
emitErrorChunk(request, id, digest, reason, true, null);
enqueueFlush(request);
// $FlowFixMe[incompatible-type] flow-typed has wrong cancel() signature
// $FlowFixMe[incompatible-use] cancel() returns Promise<void>
reader.cancel(reason).then(noop, noop);
}
// $FlowFixMe[incompatible-call]
@@ -3287,6 +3293,8 @@ function serializeBlob(request: Request, blob: Blob): string {
request.cacheController.signal.removeEventListener('abort', abortBlob);
erroredTask(request, newTask, reason);
enqueueFlush(request);
// $FlowFixMe[incompatible-type] flow-typed has wrong cancel() signature
// $FlowFixMe[incompatible-use] cancel() returns Promise<void>
reader.cancel(reason).then(error, error);
}
function abortBlob() {
@@ -3305,6 +3313,8 @@ function serializeBlob(request: Request, blob: Blob): string {
erroredTask(request, newTask, reason);
enqueueFlush(request);
}
// $FlowFixMe[incompatible-type] flow-typed has wrong cancel() signature
// $FlowFixMe[incompatible-use] cancel() returns Promise<void>
reader.cancel(reason).then(error, error);
}

View File

@@ -76,7 +76,9 @@ function writeStringChunk(destination: Destination, stringChunk: string) {
if (writtenBytes > 0) {
target = ((currentView: any): Uint8Array).subarray(writtenBytes);
}
const {read, written} = textEncoder.encodeInto(stringChunk, target);
const {read, written} =
// $FlowFixMe[prop-missing] flow-typed missing encodeInto method
textEncoder.encodeInto(stringChunk, target);
writtenBytes += written;
if (read < stringChunk.length) {
@@ -85,6 +87,7 @@ function writeStringChunk(destination: Destination, stringChunk: string) {
(currentView: any).subarray(0, writtenBytes),
);
currentView = new Uint8Array(VIEW_SIZE);
// $FlowFixMe[prop-missing] flow-typed missing encodeInto method
writtenBytes = textEncoder.encodeInto(
stringChunk.slice(read),
(currentView: any),

View File

@@ -649,3 +649,160 @@ declare module 'rbush' {
declare class CSS {
static escape(str: string): string;
}
// Override flow-typed definitions that have regressions in newer versions
// TextDecoder: options should be optional (overrides both bom.js and node.js)
// $FlowFixMe[libdef-override]
declare class TextDecoder {
constructor(
encoding?: string,
options?: {fatal?: boolean, ignoreBOM?: boolean, ...},
): void;
+encoding: string;
+fatal: boolean;
+ignoreBOM: boolean;
decode(
input?: ArrayBuffer | $ArrayBufferView,
options?: {+stream?: boolean, ...},
): string;
}
// TextEncoder: add encodeInto method
// $FlowFixMe[libdef-override]
declare class TextEncoder {
constructor(encoding?: string): void;
+encoding: string;
encode(input?: string): Uint8Array;
encodeInto(
source: string,
destination: Uint8Array,
): {read: number, written: number};
}
// ReadableStreamDefaultReader: cancel returns Promise<void> and takes mixed
// $FlowFixMe[libdef-override]
declare class ReadableStreamDefaultReader<R = any> {
constructor(stream: ReadableStream<R>): void;
+closed: Promise<void>;
cancel(reason?: mixed): Promise<void>;
read(): Promise<{done: false, value: R} | {done: true, value?: void}>;
releaseLock(): void;
}
// KeyframeAnimationOptions: add duration property
// $FlowFixMe[libdef-override]
type KeyframeAnimationOptions = {
id?: string,
delay?: number,
direction?: 'normal' | 'reverse' | 'alternate' | 'alternate-reverse',
duration?: number | string,
easing?: string,
endDelay?: number,
fill?: 'none' | 'forwards' | 'backwards' | 'both' | 'auto',
iterationStart?: number,
iterations?: number,
composite?: 'replace' | 'add' | 'accumulate',
iterationComposite?: 'replace' | 'accumulate',
pseudoElement?: string,
timeline?: AnimationTimeline,
...
};
// GetAnimationsOptions: pseudoElement should be optional
// $FlowFixMe[libdef-override]
type GetAnimationsOptions = {
subtree?: boolean,
pseudoElement?: string,
...
};
// KeyframeEffect: add pseudoElement and getTiming
// $FlowFixMe[libdef-override]
declare class KeyframeEffect {
constructor(
target: Element | null,
keyframes: Keyframe[] | PropertyIndexedKeyframes | null,
options?: number | KeyframeEffectOptions,
): void;
target: Element | null;
pseudoElement: string | null;
iterationComposite: 'replace' | 'accumulate';
composite: 'replace' | 'add' | 'accumulate';
getKeyframes(): Keyframe[];
setKeyframes(keyframes: Keyframe[] | PropertyIndexedKeyframes | null): void;
getTiming(): EffectTiming;
+activeDuration: number;
+currentIteration: number | null;
+duration: number;
+endTime: number;
+localTime: number | null;
+progress: number | null;
+startTime: number | null;
}
// QueuingStrategy: size should be optional
// $FlowFixMe[libdef-override]
type QueuingStrategy = {
highWaterMark?: number,
size?: (chunk: any) => number,
...
};
// Override error-stack-parser StackFrame to be importable as a type
// $FlowFixMe[libdef-override]
declare module 'error-stack-parser' {
declare export interface StackFrame {
isConstructor?: boolean;
getIsConstructor(): boolean;
setIsConstructor(): void;
isEval?: boolean;
getIsEval(): boolean;
setIsEval(): void;
isNative?: boolean;
getIsNative(): boolean;
setIsNative(): void;
isTopLevel?: boolean;
getIsTopLevel(): boolean;
setIsTopLevel(): void;
columnNumber?: number;
getColumnNumber(): number;
setColumnNumber(): void;
lineNumber?: number;
getLineNumber(): number;
setLineNumber(): void;
fileName?: string;
getFileName(): string;
setFileName(): void;
functionName?: string;
getFunctionName(): string;
setFunctionName(): void;
source?: string;
getSource(): string;
setSource(): void;
args?: any[];
getArgs(): any[];
setArgs(): void;
evalOrigin?: StackFrame;
getEvalOrigin(): StackFrame;
setEvalOrigin(): void;
toString(): string;
}
declare class ErrorStackParser {
parse(error: Error): Array<StackFrame>;
}
declare module.exports: ErrorStackParser;
}

View File

@@ -9222,12 +9222,12 @@ flatted@^3.2.9:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a"
integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==
flow-bin@^0.288.0:
version "0.288.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.288.0.tgz#8b4d54e4909b01a921e0f4f912d187ba2e1b225f"
integrity sha512-b038n/Se62KUplY3W2kIK87SHqlt+rRoAjr+WveRXDMZM0A4GviQYLpsuqsfAwc1Rlh4t+sqEtKBuwAzc2CEaA==
flow-bin@^0.292.0:
version "0.292.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.292.0.tgz#2077d7925d54709f0aef087df4d40cf1086ea2c7"
integrity sha512-PjI1om0xMo2zXE0cRH3/Fa44mJu/g6x9mgShaEW1LHJBLxa5ofw/+bz3LNWthZWh6G1+zxYWxOTNM+2rTEQ9eg==
flow-remove-types@^2.288.0:
flow-remove-types@^2.292.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==