diff --git a/flow-typed/environments/bom.js b/flow-typed/environments/bom.js index 06412856009..2c7c3cb01b3 100644 --- a/flow-typed/environments/bom.js +++ b/flow-typed/environments/bom.js @@ -15,15 +15,11 @@ declare class Screen { +width: number; +height: number; +orientation?: { - lock(): Promise, - unlock(): void, - angle: number, - onchange: () => mixed, - type: - | 'portrait-primary' - | 'portrait-secondary' - | 'landscape-primary' - | 'landscape-secondary', + lock(): Promise; + unlock(): void; + angle: number; + onchange: () => mixed; + type: 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary'; ... }; // deprecated @@ -38,19 +34,8 @@ declare var screen: Screen; declare interface Crypto { // Not using $TypedArray as that would include Float32Array and Float64Array which are not accepted getRandomValues: < - T: - | Int8Array - | Uint8Array - | Uint8ClampedArray - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | BigInt64Array - | BigUint64Array, - >( - typedArray: T - ) => T; + T: Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | BigInt64Array | BigUint64Array + >(typedArray: T) => T; randomUUID: () => string; } declare var crypto: Crypto; @@ -61,12 +46,12 @@ type GamepadButton = { pressed: boolean, value: number, ... -}; +} type GamepadHapticActuator = { type: 'vibration', pulse(value: number, duration: number): Promise, ... -}; +} type GamepadPose = { angularAcceleration: null | Float32Array, angularVelocity: null | Float32Array, @@ -77,7 +62,7 @@ type GamepadPose = { orientation: null | Float32Array, position: null | Float32Array, ... -}; +} type Gamepad = { axes: number[], buttons: GamepadButton[], @@ -91,7 +76,7 @@ type Gamepad = { pose?: null | GamepadPose, timestamp: number, ... -}; +} // deprecated type BatteryManager = { @@ -99,12 +84,12 @@ type BatteryManager = { +chargingTime: number, +dischargingTime: number, +level: number, - onchargingchange: ?(event: any) => mixed, - onchargingtimechange: ?(event: any) => mixed, - ondischargingtimechange: ?(event: any) => mixed, - onlevelchange: ?(event: any) => mixed, + onchargingchange: ?((event: any) => mixed), + onchargingtimechange: ?((event: any) => mixed), + ondischargingtimechange: ?((event: any) => mixed), + onlevelchange: ?((event: any) => mixed), ... -}; +} // https://wicg.github.io/web-share type ShareData = { @@ -112,66 +97,69 @@ type ShareData = { text?: string, url?: string, ... -}; +} type PermissionName = - | 'geolocation' - | 'notifications' - | 'push' - | 'midi' - | 'camera' - | 'microphone' - | 'speaker' - | 'usb' - | 'device-info' - | 'background-sync' - | 'bluetooth' - | 'persistent-storage' - | 'ambient-light-sensor' - | 'accelerometer' - | 'gyroscope' - | 'magnetometer' - | 'clipboard-read' - | 'clipboard-write'; - -type PermissionState = 'granted' | 'denied' | 'prompt'; + | "geolocation" + | "notifications" + | "push" + | "midi" + | "camera" + | "microphone" + | "speaker" + | "usb" + | "device-info" + | "background-sync" + | "bluetooth" + | "persistent-storage" + | "ambient-light-sensor" + | "accelerometer" + | "gyroscope" + | "magnetometer" + | "clipboard-read" + | "clipboard-write"; + +type PermissionState = + | "granted" + | "denied" + | "prompt"; type PermissionDescriptor = {| - name: PermissionName, -|}; + name: PermissionName; +|} type DevicePermissionDescriptor = {| - deviceId?: string, - name: 'camera' | 'microphone' | 'speaker', -|}; + deviceId?: string; + name: "camera" | "microphone" | "speaker"; +|} type MidiPermissionDescriptor = {| - name: 'midi', - sysex?: boolean, -|}; + name: "midi"; + sysex?: boolean; +|} type PushPermissionDescriptor = {| - name: 'push', - userVisibleOnly?: boolean, -|}; + name: "push"; + userVisibleOnly?: boolean; +|} type ClipboardPermissionDescriptor = {| - name: 'clipboard-read' | 'clipboard-write', - allowWithoutGesture: boolean, -|}; + name: "clipboard-read" | "clipboard-write"; + allowWithoutGesture: boolean; +|} type USBPermissionDescriptor = {| - name: 'usb', - filters: Array, - exclusionFilters: Array, -|}; + name: "usb"; + filters: Array; + exclusionFilters: Array; +|} type FileSystemHandlePermissionDescriptor = {| - mode: 'read' | 'readwrite', -|}; + mode: "read" | "readwrite"; +|} declare class PermissionStatus extends EventTarget { - onchange: ?(event: any) => mixed; + onchange: ?((event: any) => mixed); +state: PermissionState; } @@ -192,14 +180,14 @@ type MIDIPortDeviceState = 'connected' | 'disconnected'; type MIDIPortConnectionState = 'open' | 'closed' | 'pending'; type MIDIOptions = {| - sysex: boolean, - software: boolean, -|}; + sysex: boolean; + software: boolean; +|} type MIDIMessageEvent$Init = Event$Init & { - data: Uint8Array, + data: Uint8Array; ... -}; +} declare class MIDIMessageEvent extends Event { constructor(type: string, eventInitDict: MIDIMessageEvent$Init): void; @@ -207,9 +195,9 @@ declare class MIDIMessageEvent extends Event { } type MIDIConnectionEvent$Init = Event$Init & { - port: MIDIPort, + port: MIDIPort; ... -}; +} declare class MIDIConnectionEvent extends Event { constructor(type: string, eventInitDict: MIDIConnectionEvent$Init): void; @@ -224,13 +212,13 @@ declare class MIDIPort extends EventTarget { +version?: string; +state: MIDIPortDeviceState; +connection: MIDIPortConnectionState; - onstatechange: ?(ev: MIDIConnectionEvent) => mixed; + onstatechange: ?((ev: MIDIConnectionEvent) => mixed); open(): Promise; close(): Promise; } declare class MIDIInput extends MIDIPort { - onmidimessage: ?(ev: MIDIMessageEvent) => mixed; + onmidimessage: ?((ev: MIDIMessageEvent) => mixed); } declare class MIDIOutput extends MIDIPort { @@ -246,48 +234,48 @@ declare class MIDIAccess extends EventTarget { +inputs: MIDIInputMap; +outputs: MIDIOutputMap; +sysexEnabled: boolean; - onstatechange: ?(ev: MIDIConnectionEvent) => mixed; + onstatechange: ?((ev: MIDIConnectionEvent) => mixed); } declare class NavigatorID { - appName: 'Netscape'; - appCodeName: 'Mozilla'; - product: 'Gecko'; - appVersion: string; - platform: string; - userAgent: string; + appName: 'Netscape'; + appCodeName: 'Mozilla'; + product: 'Gecko'; + appVersion: string; + platform: string; + userAgent: string; } declare class NavigatorLanguage { - +language: string; - +languages: $ReadOnlyArray; + +language: string; + +languages: $ReadOnlyArray; } declare class NavigatorContentUtils { - registerContentHandler(mimeType: string, uri: string, title: string): void; - registerProtocolHandler(protocol: string, uri: string, title: string): void; + registerContentHandler(mimeType: string, uri: string, title: string): void; + registerProtocolHandler(protocol: string, uri: string, title: string): void; } declare class NavigatorCookies { - +cookieEnabled: boolean; + +cookieEnabled: boolean; } declare class NavigatorPlugins { - +plugins: PluginArray; - +mimeTypes: MimeTypeArray; - javaEnabled(): boolean; + +plugins: PluginArray; + +mimeTypes: MimeTypeArray; + javaEnabled(): boolean; } declare class NavigatorOnLine { - +onLine: boolean; + +onLine: boolean; } declare class NavigatorConcurrentHardware { - +hardwareConcurrency: number; + +hardwareConcurrency: number; } declare class NavigatorStorage { - storage?: StorageManager; + storage?: StorageManager } declare class StorageManager { @@ -297,21 +285,12 @@ declare class StorageManager { getDirectory: () => Promise; } -type StorageManagerRegisteredEndpoint = - | 'caches' - | 'indexedDB' - | 'localStorage' - | 'serviceWorkerRegistrations' - | 'sessionStorage'; +type StorageManagerRegisteredEndpoint = 'caches' | 'indexedDB' | 'localStorage' | 'serviceWorkerRegistrations' | 'sessionStorage'; type StorageManagerUsageDetails = {[StorageManagerRegisteredEndpoint]: number}; declare class StorageEstimate { - constructor( - usage: number, - quota: number, - usageDetails?: StorageManagerUsageDetails - ): void; + constructor(usage: number, quota: number, usageDetails?: StorageManagerUsageDetails): void; +usage: number; +quota: number; @@ -319,110 +298,105 @@ declare class StorageEstimate { +usageDetails?: StorageManagerUsageDetails; } -declare class Navigator - mixins - NavigatorID, - NavigatorLanguage, - NavigatorOnLine, - NavigatorContentUtils, - NavigatorCookies, - NavigatorPlugins, - NavigatorConcurrentHardware, - NavigatorStorage -{ - productSub: '20030107' | '20100101'; - vendor: '' | 'Google Inc.' | 'Apple Computer, Inc'; - vendorSub: ''; - - activeVRDisplays?: VRDisplay[]; - appCodeName: 'Mozilla'; - buildID: string; - doNotTrack: string | null; - geolocation: Geolocation; - mediaDevices?: MediaDevices; - usb?: USB; - maxTouchPoints: number; - permissions: Permissions; - serviceWorker?: ServiceWorkerContainer; - getGamepads?: () => Array; - webkitGetGamepads?: Function; - mozGetGamepads?: Function; - mozGamepads?: any; - gamepads?: any; - webkitGamepads?: any; - getVRDisplays?: () => Promise; - registerContentHandler(mimeType: string, uri: string, title: string): void; - registerProtocolHandler(protocol: string, uri: string, title: string): void; - requestMIDIAccess?: (options?: MIDIOptions) => Promise; - requestMediaKeySystemAccess?: ( - keySystem: string, - supportedConfigurations: any[] - ) => Promise; - sendBeacon?: (url: string, data?: BodyInit) => boolean; - vibrate?: (pattern: number | number[]) => boolean; - mozVibrate?: (pattern: number | number[]) => boolean; - webkitVibrate?: (pattern: number | number[]) => boolean; - canShare?: (shareData?: ShareData) => boolean; - share?: (shareData: ShareData) => Promise; - clipboard: Clipboard; - credentials?: CredMgmtCredentialsContainer; - globalPrivacyControl?: boolean; - - // deprecated - getBattery?: () => Promise; - mozGetBattery?: () => Promise; - - // deprecated - getUserMedia?: Function; - webkitGetUserMedia?: Function; - mozGetUserMedia?: Function; - msGetUserMedia?: Function; - - // Gecko - taintEnabled?: () => false; - oscpu: string; +declare class Navigator mixins + NavigatorID, + NavigatorLanguage, + NavigatorOnLine, + NavigatorContentUtils, + NavigatorCookies, + NavigatorPlugins, + NavigatorConcurrentHardware, + NavigatorStorage { + productSub: '20030107' | '20100101'; + vendor: '' | 'Google Inc.' | 'Apple Computer, Inc'; + vendorSub: ''; + + activeVRDisplays?: VRDisplay[]; + appCodeName: 'Mozilla'; + buildID: string; + doNotTrack: string | null; + geolocation: Geolocation; + mediaDevices?: MediaDevices; + usb?: USB; + maxTouchPoints: number; + permissions: Permissions; + serviceWorker?: ServiceWorkerContainer; + getGamepads?: () => Array; + webkitGetGamepads?: Function; + mozGetGamepads?: Function; + mozGamepads?: any; + gamepads?: any; + webkitGamepads?: any; + getVRDisplays?: () => Promise; + registerContentHandler(mimeType: string, uri: string, title: string): void; + registerProtocolHandler(protocol: string, uri: string, title: string): void; + requestMIDIAccess?: (options?: MIDIOptions) => Promise; + requestMediaKeySystemAccess?: (keySystem: string, supportedConfigurations: any[]) => Promise; + sendBeacon?: (url: string, data?: BodyInit) => boolean; + vibrate?: (pattern: number | number[]) => boolean; + mozVibrate?: (pattern: number | number[]) => boolean; + webkitVibrate?: (pattern: number | number[]) => boolean; + canShare?: (shareData?: ShareData) => boolean; + share?: (shareData: ShareData) => Promise; + clipboard: Clipboard; + credentials?: CredMgmtCredentialsContainer; + globalPrivacyControl?: boolean; + + // deprecated + getBattery?: () => Promise; + mozGetBattery?: () => Promise; + + // deprecated + getUserMedia?: Function; + webkitGetUserMedia?: Function; + mozGetUserMedia?: Function; + msGetUserMedia?: Function; + + // Gecko + taintEnabled?: () => false; + oscpu: string; } declare class Clipboard extends EventTarget { - read(): Promise; - readText(): Promise; - write(data: $ReadOnlyArray): Promise; - writeText(data: string): Promise; + read(): Promise; + readText(): Promise; + write(data: $ReadOnlyArray): Promise; + writeText(data: string): Promise; } declare var navigator: Navigator; declare class MimeType { - type: string; - description: string; - suffixes: string; - enabledPlugin: Plugin; + type: string; + description: string; + suffixes: string; + enabledPlugin: Plugin; } declare class MimeTypeArray { - length: number; - item(index: number): MimeType; - namedItem(name: string): MimeType; - [key: number | string]: MimeType; + length: number; + item(index: number): MimeType; + namedItem(name: string): MimeType; + [key: number | string]: MimeType; } declare class Plugin { - description: string; - filename: string; - name: string; - version?: string; // Gecko only - length: number; - item(index: number): MimeType; - namedItem(name: string): MimeType; - [key: number | string]: MimeType; + description: string; + filename: string; + name: string; + version?: string; // Gecko only + length: number; + item(index: number): MimeType; + namedItem(name: string): MimeType; + [key: number | string]: MimeType; } declare class PluginArray { - length: number; - item(index: number): Plugin; - namedItem(name: string): Plugin; - refresh(): void; - [key: number | string]: Plugin; + length: number; + item(index: number): Plugin; + namedItem(name: string): Plugin; + refresh(): void; + [key: number | string]: Plugin; } // https://www.w3.org/TR/hr-time-2/#dom-domhighrestimestamp @@ -431,37 +405,37 @@ declare type DOMHighResTimeStamp = number; // https://www.w3.org/TR/navigation-timing-2/ declare class PerformanceTiming { - connectEnd: number; - connectStart: number; - domainLookupEnd: number; - domainLookupStart: number; - domComplete: number; - domContentLoadedEventEnd: number; - domContentLoadedEventStart: number; - domInteractive: number; - domLoading: number; - fetchStart: number; - loadEventEnd: number; - loadEventStart: number; - navigationStart: number; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; - secureConnectionStart: number; - unloadEventEnd: number; - unloadEventStart: number; + connectEnd: number; + connectStart: number; + domainLookupEnd: number; + domainLookupStart: number; + domComplete: number; + domContentLoadedEventEnd: number; + domContentLoadedEventStart: number; + domInteractive: number; + domLoading: number; + fetchStart: number; + loadEventEnd: number; + loadEventStart: number; + navigationStart: number; + redirectEnd: number; + redirectStart: number; + requestStart: number; + responseEnd: number; + responseStart: number; + secureConnectionStart: number; + unloadEventEnd: number; + unloadEventStart: number; } declare class PerformanceNavigation { - TYPE_NAVIGATE: 0; - TYPE_RELOAD: 1; - TYPE_BACK_FORWARD: 2; - TYPE_RESERVED: 255; + TYPE_NAVIGATE: 0; + TYPE_RELOAD: 1; + TYPE_BACK_FORWARD: 2; + TYPE_RESERVED: 255; - type: 0 | 1 | 2 | 255; - redirectCount: number; + type: 0 | 1 | 2 | 255; + redirectCount: number; } type PerformanceEntryFilterOptions = { @@ -469,15 +443,15 @@ type PerformanceEntryFilterOptions = { entryType: string, initiatorType: string, ... -}; +} // https://www.w3.org/TR/performance-timeline-2/ declare class PerformanceEntry { - name: string; - entryType: string; - startTime: DOMHighResTimeStamp; - duration: DOMHighResTimeStamp; - toJSON(): string; + name: string; + entryType: string; + startTime: DOMHighResTimeStamp; + duration: DOMHighResTimeStamp; + toJSON(): string; } // https://w3c.github.io/server-timing/#the-performanceservertiming-interface @@ -491,24 +465,24 @@ declare class PerformanceServerTiming { // https://www.w3.org/TR/resource-timing-2/#sec-performanceresourcetiming // https://w3c.github.io/server-timing/#extension-to-the-performanceresourcetiming-interface declare class PerformanceResourceTiming extends PerformanceEntry { - initiatorType: string; - nextHopProtocol: string; - workerStart: number; - redirectStart: number; - redirectEnd: number; - fetchStart: number; - domainLookupStart: number; - domainLookupEnd: number; - connectStart: number; - connectEnd: number; - secureConnectionStart: number; - requestStart: number; - responseStart: number; - responseEnd: number; - transferSize: string; - encodedBodySize: number; - decodedBodySize: number; - serverTiming: Array; + initiatorType: string; + nextHopProtocol: string; + workerStart: number; + redirectStart: number; + redirectEnd: number; + fetchStart: number; + domainLookupStart: number; + domainLookupEnd: number; + connectStart: number; + connectEnd: number; + secureConnectionStart: number; + requestStart: number; + responseStart: number; + responseEnd: number; + transferSize: string; + encodedBodySize: number; + decodedBodySize: number; + serverTiming: Array; } // https://w3c.github.io/event-timing/#sec-performance-event-timing @@ -535,16 +509,16 @@ declare class PerformanceLongTaskTiming extends PerformanceEntry { // https://www.w3.org/TR/navigation-timing-2/ declare class PerformanceNavigationTiming extends PerformanceResourceTiming { - unloadEventStart: number; - unloadEventEnd: number; - domInteractive: number; - domContentLoadedEventStart: number; - domContentLoadedEventEnd: number; - domComplete: number; - loadEventStart: number; - loadEventEnd: number; - type: 'navigate' | 'reload' | 'back_forward' | 'prerender'; - redirectCount: number; + unloadEventStart: number; + unloadEventEnd: number; + domInteractive: number; + domContentLoadedEventStart: number; + domContentLoadedEventEnd: number; + domComplete: number; + loadEventStart: number; + loadEventEnd: number; + type: 'navigate' | 'reload' | 'back_forward' | 'prerender'; + redirectCount: number; } // https://www.w3.org/TR/user-timing/#extensions-performance-interface @@ -560,6 +534,7 @@ declare type PerformanceMeasureOptions = {| duration?: number, |}; + type EventCountsForEachCallbackType = | (() => void) | ((value: number) => void) @@ -579,28 +554,24 @@ declare interface EventCounts { } declare class Performance { - eventCounts: EventCounts; - - // deprecated - navigation: PerformanceNavigation; - timing: PerformanceTiming; - - onresourcetimingbufferfull: (ev: any) => mixed; - clearMarks(name?: string): void; - clearMeasures(name?: string): void; - clearResourceTimings(): void; - getEntries(options?: PerformanceEntryFilterOptions): Array; - getEntriesByName(name: string, type?: string): Array; - getEntriesByType(type: string): Array; - mark(name: string, options?: PerformanceMarkOptions): void; - measure( - name: string, - startMarkOrOptions?: string | PerformanceMeasureOptions, - endMark?: string - ): void; - now(): DOMHighResTimeStamp; - setResourceTimingBufferSize(maxSize: number): void; - toJSON(): string; + eventCounts: EventCounts; + + // deprecated + navigation: PerformanceNavigation; + timing: PerformanceTiming; + + onresourcetimingbufferfull: (ev: any) => mixed; + clearMarks(name?: string): void; + clearMeasures(name?: string): void; + clearResourceTimings(): void; + getEntries(options?: PerformanceEntryFilterOptions): Array; + getEntriesByName(name: string, type?: string): Array; + getEntriesByType(type: string): Array; + mark(name: string, options?: PerformanceMarkOptions): void; + measure(name: string, startMarkOrOptions?: string | PerformanceMeasureOptions, endMark?: string): void; + now(): DOMHighResTimeStamp; + setResourceTimingBufferSize(maxSize: number): void; + toJSON(): string; } declare var performance: Performance; @@ -614,19 +585,14 @@ declare interface PerformanceObserverEntryList { } type PerformanceObserverInit = { - entryTypes?: string[], - type?: string, - buffered?: boolean, + entryTypes?: string[]; + type?: string; + buffered?: boolean; ... -}; +} declare class PerformanceObserver { - constructor( - callback: ( - entries: PerformanceObserverEntryList, - observer: PerformanceObserver - ) => mixed - ): void; + constructor(callback: (entries: PerformanceObserverEntryList, observer: PerformanceObserver) => mixed): void; observe(options: ?PerformanceObserverInit): void; disconnect(): void; @@ -636,33 +602,33 @@ declare class PerformanceObserver { } declare class History { - length: number; - scrollRestoration: 'auto' | 'manual'; - state: any; - back(): void; - forward(): void; - go(delta?: number): void; - pushState(statedata: any, title: string, url?: string): void; - replaceState(statedata: any, title: string, url?: string): void; + length: number; + scrollRestoration: 'auto' | 'manual'; + state: any; + back(): void; + forward(): void; + go(delta?: number): void; + pushState(statedata: any, title: string, url?: string): void; + replaceState(statedata: any, title: string, url?: string): void; } declare var history: History; declare class Location { - ancestorOrigins: string[]; - hash: string; - host: string; - hostname: string; - href: string; - origin: string; - pathname: string; - port: string; - protocol: string; - search: string; - assign(url: string): void; - reload(flag?: boolean): void; - replace(url: string): void; - toString(): string; + ancestorOrigins: string[]; + hash: string; + host: string; + hostname: string; + href: string; + origin: string; + pathname: string; + port: string; + protocol: string; + search: string; + assign(url: string): void; + reload(flag?: boolean): void; + replace(url: string): void; + toString(): string; } declare var location: Location; @@ -670,31 +636,31 @@ declare var location: Location; /////////////////////////////////////////////////////////////////////////////// declare class DOMParser { - parseFromString(source: string | TrustedHTML, mimeType: string): Document; + parseFromString(source: string | TrustedHTML, mimeType: string): Document; } -type FormDataEntryValue = string | File; +type FormDataEntryValue = string | File declare class FormData { - constructor(form?: HTMLFormElement, submitter?: HTMLElement | null): void; + constructor(form?: HTMLFormElement, submitter?: HTMLElement | null): void; - has(name: string): boolean; - get(name: string): ?FormDataEntryValue; - getAll(name: string): Array; + has(name: string): boolean; + get(name: string): ?FormDataEntryValue; + getAll(name: string): Array; - set(name: string, value: string): void; - set(name: string, value: Blob, filename?: string): void; - set(name: string, value: File, filename?: string): void; + set(name: string, value: string): void; + set(name: string, value: Blob, filename?: string): void; + set(name: string, value: File, filename?: string): void; - append(name: string, value: string): void; - append(name: string, value: Blob, filename?: string): void; - append(name: string, value: File, filename?: string): void; + append(name: string, value: string): void; + append(name: string, value: Blob, filename?: string): void; + append(name: string, value: File, filename?: string): void; - delete(name: string): void; + delete(name: string): void; - keys(): Iterator; - values(): Iterator; - entries(): Iterator<[string, FormDataEntryValue]>; + keys(): Iterator; + values(): Iterator; + entries(): Iterator<[string, FormDataEntryValue]>; } declare type IntersectionObserverEntry = { @@ -709,8 +675,8 @@ declare type IntersectionObserverEntry = { }; declare type IntersectionObserverCallback = ( - entries: Array, - observer: IntersectionObserver + entries: Array, + observer: IntersectionObserver, ) => mixed; declare type IntersectionObserverOptions = { @@ -721,18 +687,18 @@ declare type IntersectionObserverOptions = { }; declare class IntersectionObserver { - constructor( - callback: IntersectionObserverCallback, - options?: IntersectionObserverOptions - ): void; - root: Element | null; - rootMargin: string; - scrollMargin: string; - thresholds: number[]; - observe(target: Element): void; - unobserve(target: Element): void; - takeRecords(): Array; - disconnect(): void; + constructor( + callback: IntersectionObserverCallback, + options?: IntersectionObserverOptions + ): void, + root: Element | null; + rootMargin: string; + scrollMargin: string; + thresholds: number[]; + observe(target: Element): void, + unobserve(target: Element): void, + takeRecords(): Array, + disconnect(): void, } declare interface ResizeObserverSize { @@ -778,13 +744,10 @@ declare interface ResizeObserverEntry { * pixels, before applying any CSS transforms on the element or its ancestors. * This size must contain integer values. */ -type ResizeObserverBoxOptions = - | 'border-box' - | 'content-box' - | 'device-pixel-content-box'; +type ResizeObserverBoxOptions = "border-box" | "content-box" | "device-pixel-content-box"; declare type ResizeObserverOptions = { - box?: ResizeObserverBoxOptions, + box?: ResizeObserverBoxOptions; ... }; @@ -792,12 +755,7 @@ declare type ResizeObserverOptions = { * The ResizeObserver interface is used to observe changes to Element's size. */ declare class ResizeObserver { - constructor( - callback: ( - entries: ResizeObserverEntry[], - observer: ResizeObserver - ) => mixed - ): void; + constructor(callback: (entries: ResizeObserverEntry[], observer: ResizeObserver) => mixed): void; /** * Adds target to the list of observed elements. */ @@ -810,36 +768,36 @@ declare class ResizeObserver { } declare class CloseEvent extends Event { - code: number; - reason: string; - wasClean: boolean; + code: number; + reason: string; + wasClean: boolean; } declare class WebSocket extends EventTarget { - static CONNECTING: 0; - static OPEN: 1; - static CLOSING: 2; - static CLOSED: 3; - constructor(url: string, protocols?: string | Array): void; - protocol: string; - readyState: number; - bufferedAmount: number; - extensions: string; - onopen: (ev: any) => mixed; - onmessage: (ev: MessageEvent) => mixed; - onclose: (ev: CloseEvent) => mixed; - onerror: (ev: any) => mixed; - binaryType: 'blob' | 'arraybuffer'; - url: string; - close(code?: number, reason?: string): void; - send(data: string): void; - send(data: Blob): void; - send(data: ArrayBuffer): void; - send(data: $ArrayBufferView): void; - CONNECTING: 0; - OPEN: 1; - CLOSING: 2; - CLOSED: 3; + static CONNECTING: 0; + static OPEN: 1; + static CLOSING: 2; + static CLOSED: 3; + constructor(url: string, protocols?: string | Array): void; + protocol: string; + readyState: number; + bufferedAmount: number; + extensions: string; + onopen: (ev: any) => mixed; + onmessage: (ev: MessageEvent) => mixed; + onclose: (ev: CloseEvent) => mixed; + onerror: (ev: any) => mixed; + binaryType: 'blob' | 'arraybuffer'; + url: string; + close(code?: number, reason?: string): void; + send(data: string): void; + send(data: Blob): void; + send(data: ArrayBuffer): void; + send(data: $ArrayBufferView): void; + CONNECTING: 0; + OPEN: 1; + CLOSING: 2; + CLOSED: 3; } type WorkerOptions = { @@ -847,194 +805,181 @@ type WorkerOptions = { credentials?: CredentialsType, name?: string, ... -}; +} declare class Worker extends EventTarget { - constructor( - stringUrl: string | TrustedScriptURL, - workerOptions?: WorkerOptions - ): void; - onerror: null | ((ev: any) => mixed); - onmessage: null | ((ev: MessageEvent) => mixed); - onmessageerror: null | ((ev: MessageEvent) => mixed); - postMessage(message: any, ports?: any): void; - terminate(): void; + constructor(stringUrl: string | TrustedScriptURL, workerOptions?: WorkerOptions): void; + onerror: null | (ev: any) => mixed; + onmessage: null | (ev: MessageEvent) => mixed; + onmessageerror: null | (ev: MessageEvent) => mixed; + postMessage(message: any, ports?: any): void; + terminate(): void; } declare class SharedWorker extends EventTarget { - constructor(stringUrl: string | TrustedScriptURL, name?: string): void; - constructor( - stringUrl: string | TrustedScriptURL, - workerOptions?: WorkerOptions - ): void; - port: MessagePort; - onerror: (ev: any) => mixed; + constructor(stringUrl: string | TrustedScriptURL, name?: string): void; + constructor(stringUrl: string | TrustedScriptURL, workerOptions?: WorkerOptions): void; + port: MessagePort; + onerror: (ev: any) => mixed; } declare function importScripts(...urls: Array): void; declare class WorkerGlobalScope extends EventTarget { - self: this; - location: WorkerLocation; - navigator: WorkerNavigator; - close(): void; - importScripts(...urls: Array): void; - onerror: (ev: any) => mixed; - onlanguagechange: (ev: any) => mixed; - onoffline: (ev: any) => mixed; - ononline: (ev: any) => mixed; - onrejectionhandled: (ev: PromiseRejectionEvent) => mixed; - onunhandledrejection: (ev: PromiseRejectionEvent) => mixed; + self: this; + location: WorkerLocation; + navigator: WorkerNavigator; + close(): void; + importScripts(...urls: Array): void; + onerror: (ev: any) => mixed; + onlanguagechange: (ev: any) => mixed; + onoffline: (ev: any) => mixed; + ononline: (ev: any) => mixed; + onrejectionhandled: (ev: PromiseRejectionEvent) => mixed; + onunhandledrejection: (ev: PromiseRejectionEvent) => mixed; } declare class DedicatedWorkerGlobalScope extends WorkerGlobalScope { - onmessage: (ev: MessageEvent) => mixed; - onmessageerror: (ev: MessageEvent) => mixed; - postMessage(message: any, transfer?: Iterable): void; + onmessage: (ev: MessageEvent) => mixed; + onmessageerror: (ev: MessageEvent) => mixed; + postMessage(message: any, transfer?: Iterable): void; } declare class SharedWorkerGlobalScope extends WorkerGlobalScope { - name: string; - onconnect: (ev: MessageEvent) => mixed; + name: string; + onconnect: (ev: MessageEvent) => mixed; } declare class WorkerLocation { - origin: string; - protocol: string; - host: string; - hostname: string; - port: string; - pathname: string; - search: string; - hash: string; -} - -declare class WorkerNavigator - mixins - NavigatorID, - NavigatorLanguage, - NavigatorOnLine, - NavigatorConcurrentHardware, - NavigatorStorage -{ - permissions: Permissions; -} + origin: string; + protocol: string; + host: string; + hostname: string; + port: string; + pathname: string; + search: string; + hash: string; +} + +declare class WorkerNavigator mixins + NavigatorID, + NavigatorLanguage, + NavigatorOnLine, + NavigatorConcurrentHardware, + NavigatorStorage { + permissions: Permissions; + } + // deprecated declare class XDomainRequest { - timeout: number; - onerror: () => mixed; - onload: () => mixed; - onprogress: () => mixed; - ontimeout: () => mixed; - +responseText: string; - +contentType: string; - open(method: 'GET' | 'POST', url: string): void; - abort(): void; - send(data?: string): void; + timeout: number; + onerror: () => mixed; + onload: () => mixed; + onprogress: () => mixed; + ontimeout: () => mixed; + +responseText: string; + +contentType: string; + open(method: "GET" | "POST", url: string): void; + abort(): void; + send(data?: string): void; - statics: {create(): XDomainRequest, ...}; + statics: { create(): XDomainRequest, ... } } declare class XMLHttpRequest extends EventTarget { - static LOADING: number; - static DONE: number; - static UNSENT: number; - static OPENED: number; - static HEADERS_RECEIVED: number; - responseBody: any; - status: number; - readyState: number; - responseText: string; - responseXML: any; - responseURL: string; - ontimeout: ProgressEventHandler; - statusText: string; - onreadystatechange: (ev: any) => mixed; - timeout: number; - onload: ProgressEventHandler; - response: any; - withCredentials: boolean; - onprogress: ProgressEventHandler; - onabort: ProgressEventHandler; - responseType: string; - onloadend: ProgressEventHandler; - upload: XMLHttpRequestEventTarget; - onerror: ProgressEventHandler; - onloadstart: ProgressEventHandler; - msCaching: string; - open( - method: string, - url: string, - async?: boolean, - user?: string, - password?: string - ): void; - send(data?: any): void; - abort(): void; - getAllResponseHeaders(): string; - setRequestHeader(header: string, value: string): void; - getResponseHeader(header: string): string; - msCachingEnabled(): boolean; - overrideMimeType(mime: string): void; - LOADING: number; - DONE: number; - UNSENT: number; - OPENED: number; - HEADERS_RECEIVED: number; - - statics: {create(): XMLHttpRequest, ...}; + static LOADING: number; + static DONE: number; + static UNSENT: number; + static OPENED: number; + static HEADERS_RECEIVED: number; + responseBody: any; + status: number; + readyState: number; + responseText: string; + responseXML: any; + responseURL: string; + ontimeout: ProgressEventHandler; + statusText: string; + onreadystatechange: (ev: any) => mixed; + timeout: number; + onload: ProgressEventHandler; + response: any; + withCredentials: boolean; + onprogress: ProgressEventHandler; + onabort: ProgressEventHandler; + responseType: string; + onloadend: ProgressEventHandler; + upload: XMLHttpRequestEventTarget; + onerror: ProgressEventHandler; + onloadstart: ProgressEventHandler; + msCaching: string; + open(method: string, url: string, async?: boolean, user?: string, password?: string): void; + send(data?: any): void; + abort(): void; + getAllResponseHeaders(): string; + setRequestHeader(header: string, value: string): void; + getResponseHeader(header: string): string; + msCachingEnabled(): boolean; + overrideMimeType(mime: string): void; + LOADING: number; + DONE: number; + UNSENT: number; + OPENED: number; + HEADERS_RECEIVED: number; + + statics: { create(): XMLHttpRequest, ... } } declare class XMLHttpRequestEventTarget extends EventTarget { - onprogress: ProgressEventHandler; - onerror: ProgressEventHandler; - onload: ProgressEventHandler; - ontimeout: ProgressEventHandler; - onabort: ProgressEventHandler; - onloadstart: ProgressEventHandler; - onloadend: ProgressEventHandler; + onprogress: ProgressEventHandler; + onerror: ProgressEventHandler; + onload: ProgressEventHandler; + ontimeout: ProgressEventHandler; + onabort: ProgressEventHandler; + onloadstart: ProgressEventHandler; + onloadend: ProgressEventHandler; } declare class XMLSerializer { - serializeToString(target: Node): string; + serializeToString(target: Node): string; } declare class Geolocation { - getCurrentPosition( - success: (position: Position) => mixed, - error?: (error: PositionError) => mixed, - options?: PositionOptions - ): void; - watchPosition( - success: (position: Position) => mixed, - error?: (error: PositionError) => mixed, - options?: PositionOptions - ): number; - clearWatch(id: number): void; + getCurrentPosition( + success: (position: Position) => mixed, + error?: (error: PositionError) => mixed, + options?: PositionOptions + ): void; + watchPosition( + success: (position: Position) => mixed, + error?: (error: PositionError) => mixed, + options?: PositionOptions + ): number; + clearWatch(id: number): void; } declare class Position { - coords: Coordinates; - timestamp: number; + coords: Coordinates; + timestamp: number; } declare class Coordinates { - latitude: number; - longitude: number; - altitude?: number; - accuracy: number; - altitudeAccuracy?: number; - heading?: number; - speed?: number; + latitude: number; + longitude: number; + altitude?: number; + accuracy: number; + altitudeAccuracy?: number; + heading?: number; + speed?: number; } declare class PositionError { - code: number; - message: string; - PERMISSION_DENIED: 1; - POSITION_UNAVAILABLE: 2; - TIMEOUT: 3; + code: number; + message: string; + PERMISSION_DENIED: 1; + POSITION_UNAVAILABLE: 2; + TIMEOUT: 3; } type PositionOptions = { @@ -1042,17 +987,17 @@ type PositionOptions = { timeout?: number, maximumAge?: number, ... -}; +} type AudioContextState = 'suspended' | 'running' | 'closed'; // deprecated type AudioProcessingEvent$Init = Event$Init & { - playbackTime: number, - inputBuffer: AudioBuffer, - outputBuffer: AudioBuffer, + playbackTime: number; + inputBuffer: AudioBuffer; + outputBuffer: AudioBuffer; ... -}; +} // deprecated declare class AudioProcessingEvent extends Event { @@ -1064,15 +1009,12 @@ declare class AudioProcessingEvent extends Event { } type OfflineAudioCompletionEvent$Init = Event$Init & { - renderedBuffer: AudioBuffer, + renderedBuffer: AudioBuffer; ... -}; +} declare class OfflineAudioCompletionEvent extends Event { - constructor( - type: string, - eventInitDict: OfflineAudioCompletionEvent$Init - ): void; + constructor(type: string, eventInitDict: OfflineAudioCompletionEvent$Init): void; +renderedBuffer: AudioBuffer; } @@ -1084,24 +1026,14 @@ declare class BaseAudioContext extends EventTarget { sampleRate: number; state: AudioContextState; onstatechange: (ev: any) => mixed; - createBuffer( - numOfChannels: number, - length: number, - sampleRate: number - ): AudioBuffer; + createBuffer(numOfChannels: number, length: number, sampleRate: number): AudioBuffer; createBufferSource(myMediaElement?: HTMLMediaElement): AudioBufferSourceNode; - createMediaElementSource( - myMediaElement: HTMLMediaElement - ): MediaElementAudioSourceNode; + createMediaElementSource(myMediaElement: HTMLMediaElement): MediaElementAudioSourceNode; createMediaStreamSource(stream: MediaStream): MediaStreamAudioSourceNode; createMediaStreamDestination(): MediaStreamAudioDestinationNode; // deprecated - createScriptProcessor( - bufferSize: number, - numberOfInputChannels: number, - numberOfOutputChannels: number - ): ScriptProcessorNode; + createScriptProcessor(bufferSize: number, numberOfInputChannels: number, numberOfOutputChannels: number): ScriptProcessorNode; createAnalyser(): AnalyserNode; createBiquadFilter(): BiquadFilterNode; @@ -1112,25 +1044,14 @@ declare class BaseAudioContext extends EventTarget { createDelay(maxDelayTime?: number): DelayNode; createDynamicsCompressor(): DynamicsCompressorNode; createGain(): GainNode; - createIIRFilter( - feedforward: Float32Array, - feedback: Float32Array - ): IIRFilterNode; + createIIRFilter (feedforward: Float32Array, feedback: Float32Array): IIRFilterNode; createOscillator(): OscillatorNode; createPanner(): PannerNode; createStereoPanner(): StereoPannerNode; - createPeriodicWave( - real: Float32Array, - img: Float32Array, - options?: {disableNormalization: boolean, ...} - ): PeriodicWave; + createPeriodicWave(real: Float32Array, img: Float32Array, options?: { disableNormalization: boolean, ... }): PeriodicWave; createStereoPanner(): StereoPannerNode; createWaveShaper(): WaveShaperNode; - decodeAudioData( - arrayBuffer: ArrayBuffer, - decodeSuccessCallback: (decodedData: AudioBuffer) => mixed, - decodeErrorCallback: (err: DOMError) => mixed - ): void; + decodeAudioData(arrayBuffer: ArrayBuffer, decodeSuccessCallback: (decodedData: AudioBuffer) => mixed, decodeErrorCallback: (err: DOMError) => mixed): void; decodeAudioData(arrayBuffer: ArrayBuffer): Promise; } @@ -1140,25 +1061,16 @@ declare class AudioTimestamp { } declare class AudioContext extends BaseAudioContext { - constructor(options?: {| - latencyHint?: 'balanced' | 'interactive' | 'playback' | number, - sampleRate?: number, - |}): AudioContext; + constructor(options?: {| latencyHint?: 'balanced' | 'interactive' | 'playback' | number, sampleRate?: number |}): AudioContext; baseLatency: number; outputLatency: number; getOutputTimestamp(): AudioTimestamp; resume(): Promise; suspend(): Promise; close(): Promise; - createMediaElementSource( - myMediaElement: HTMLMediaElement - ): MediaElementAudioSourceNode; - createMediaStreamSource( - myMediaStream: MediaStream - ): MediaStreamAudioSourceNode; - createMediaStreamTrackSource( - myMediaStreamTrack: MediaStreamTrack - ): MediaStreamTrackAudioSourceNode; + createMediaElementSource(myMediaElement: HTMLMediaElement): MediaElementAudioSourceNode; + createMediaStreamSource(myMediaStream: MediaStream): MediaStreamAudioSourceNode; + createMediaStreamTrackSource(myMediaStreamTrack: MediaStreamTrack): MediaStreamTrackAudioSourceNode; createMediaStreamDestination(): MediaStreamAudioDestinationNode; } @@ -1187,16 +1099,8 @@ declare class AudioParam extends AudioNode { setValueAtTime(value: number, startTime: number): this; linearRampToValueAtTime(value: number, endTime: number): this; exponentialRampToValueAtTime(value: number, endTime: number): this; - setTargetAtTime( - target: number, - startTime: number, - timeConstant: number - ): this; - setValueCurveAtTime( - values: Float32Array, - startTime: number, - duration: number - ): this; + setTargetAtTime(target: number, startTime: number, timeConstant: number): this; + setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): this; cancelScheduledValues(startTime: number): this; } @@ -1215,14 +1119,7 @@ declare class AudioListener extends AudioNode { upY: AudioParam; upZ: AudioParam; setPosition(x: number, y: number, c: number): void; - setOrientation( - x: number, - y: number, - z: number, - xUp: number, - yUp: number, - zUp: number - ): void; + setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void; } declare class AudioBuffer { @@ -1231,16 +1128,8 @@ declare class AudioBuffer { duration: number; numberOfChannels: number; getChannelData(channel: number): Float32Array; - copyFromChannel( - destination: Float32Array, - channelNumber: number, - startInChannel?: number - ): void; - copyToChannel( - source: Float32Array, - channelNumber: number, - startInChannel?: number - ): void; + copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; + copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; } declare class AudioBufferSourceNode extends AudioNode { @@ -1261,140 +1150,138 @@ declare class CanvasCaptureMediaStream extends MediaStream { } type DoubleRange = { - max?: number, - min?: number, + max?: number; + min?: number; ... -}; +} type LongRange = { - max?: number, - min?: number, + max?: number; + min?: number; ... -}; +} type ConstrainBooleanParameters = { - exact?: boolean, - ideal?: boolean, + exact?: boolean; + ideal?: boolean; ... -}; +} type ConstrainDOMStringParameters = { - exact?: string | string[], - ideal?: string | string[], + exact?: string | string[]; + ideal?: string | string[]; ... -}; +} type ConstrainDoubleRange = { - ...DoubleRange, - exact?: number, - ideal?: number, + ...DoubleRange; + exact?: number; + ideal?: number; ... -}; +} type ConstrainLongRange = { - ...LongRange, - exact?: number, - ideal?: number, + ...LongRange; + exact?: number; + ideal?: number; ... -}; +} type MediaTrackSupportedConstraints = {| - width: boolean, - height: boolean, - aspectRatio: boolean, - frameRate: boolean, - facingMode: boolean, - resizeMode: boolean, - volume: boolean, - sampleRate: boolean, - sampleSize: boolean, - echoCancellation: boolean, - autoGainControl: boolean, - noiseSuppression: boolean, - latency: boolean, - channelCount: boolean, - deviceId: boolean, - groupId: boolean, -|}; + width: boolean; + height: boolean; + aspectRatio: boolean; + frameRate: boolean; + facingMode: boolean; + resizeMode: boolean; + volume: boolean; + sampleRate: boolean; + sampleSize: boolean; + echoCancellation: boolean; + autoGainControl: boolean; + noiseSuppression: boolean; + latency: boolean; + channelCount: boolean; + deviceId: boolean; + groupId: boolean; +|} type MediaTrackConstraintSet = { - width?: number | ConstrainLongRange, - height?: number | ConstrainLongRange, - aspectRatio?: number | ConstrainDoubleRange, - frameRate?: number | ConstrainDoubleRange, - facingMode?: string | string[] | ConstrainDOMStringParameters, - resizeMode?: string | string[] | ConstrainDOMStringParameters, - volume?: number | ConstrainDoubleRange, - sampleRate?: number | ConstrainLongRange, - sampleSize?: number | ConstrainLongRange, - echoCancellation?: boolean | ConstrainBooleanParameters, - autoGainControl?: boolean | ConstrainBooleanParameters, - noiseSuppression?: boolean | ConstrainBooleanParameters, - latency?: number | ConstrainDoubleRange, - channelCount?: number | ConstrainLongRange, - deviceId?: string | string[] | ConstrainDOMStringParameters, - groupId?: string | string[] | ConstrainDOMStringParameters, + width?: number | ConstrainLongRange; + height?: number | ConstrainLongRange; + aspectRatio?: number | ConstrainDoubleRange; + frameRate?: number | ConstrainDoubleRange; + facingMode?: string | string[] | ConstrainDOMStringParameters; + resizeMode?: string | string[] | ConstrainDOMStringParameters; + volume?: number | ConstrainDoubleRange; + sampleRate?: number | ConstrainLongRange; + sampleSize?: number | ConstrainLongRange; + echoCancellation?: boolean | ConstrainBooleanParameters; + autoGainControl?: boolean | ConstrainBooleanParameters; + noiseSuppression?: boolean | ConstrainBooleanParameters; + latency?: number | ConstrainDoubleRange; + channelCount?: number | ConstrainLongRange; + deviceId?: string | string[] | ConstrainDOMStringParameters; + groupId?: string | string[] | ConstrainDOMStringParameters; ... -}; +} type MediaTrackConstraints = { - ...MediaTrackConstraintSet, - advanced?: Array, + ...MediaTrackConstraintSet; + advanced?: Array; ... -}; +} type DisplayMediaStreamConstraints = { - video?: boolean | MediaTrackConstraints, - audio?: boolean | MediaTrackConstraints, + video?: boolean | MediaTrackConstraints; + audio?: boolean | MediaTrackConstraints; ... -}; +} type MediaStreamConstraints = { - audio?: boolean | MediaTrackConstraints, - video?: boolean | MediaTrackConstraints, - peerIdentity?: string, + audio?: boolean | MediaTrackConstraints; + video?: boolean | MediaTrackConstraints; + peerIdentity?: string; ... -}; +} type MediaTrackSettings = { - aspectRatio?: number, - deviceId?: string, - displaySurface?: 'application' | 'browser' | 'monitor' | 'window', - echoCancellation?: boolean, - facingMode?: string, - frameRate?: number, - groupId?: string, - height?: number, - logicalSurface?: boolean, - sampleRate?: number, - sampleSize?: number, - volume?: number, - width?: number, + aspectRatio?: number; + deviceId?: string; + displaySurface?: 'application' | 'browser' | 'monitor' | 'window'; + echoCancellation?: boolean; + facingMode?: string; + frameRate?: number; + groupId?: string; + height?: number; + logicalSurface?: boolean; + sampleRate?: number; + sampleSize?: number; + volume?: number; + width?: number; ... -}; +} type MediaTrackCapabilities = { - aspectRatio?: number | DoubleRange, - deviceId?: string, - echoCancellation?: boolean[], - facingMode?: string, - frameRate?: number | DoubleRange, - groupId?: string, - height?: number | LongRange, - sampleRate?: number | LongRange, - sampleSize?: number | LongRange, - volume?: number | DoubleRange, - width?: number | LongRange, + aspectRatio?: number | DoubleRange; + deviceId?: string; + echoCancellation?: boolean[]; + facingMode?: string; + frameRate?: number | DoubleRange; + groupId?: string; + height?: number | LongRange; + sampleRate?: number | LongRange; + sampleSize?: number | LongRange; + volume?: number | DoubleRange; + width?: number | LongRange; ... -}; +} declare class MediaDevices extends EventTarget { ondevicechange: (ev: any) => mixed; enumerateDevices: () => Promise>; getSupportedConstraints: () => MediaTrackSupportedConstraints; - getDisplayMedia: ( - constraints?: DisplayMediaStreamConstraints - ) => Promise; + getDisplayMedia: (constraints?: DisplayMediaStreamConstraints) => Promise; getUserMedia: (constraints: MediaStreamConstraints) => Promise; } @@ -1412,7 +1299,7 @@ type MediaRecorderOptions = { bitsPerSecond?: number, audioBitrateMode?: 'cbr' | 'vbr', ... -}; +} declare class MediaRecorder extends EventTarget { constructor(stream: MediaStream, options?: MediaRecorderOptions): void; @@ -1516,26 +1403,14 @@ declare class BiquadFilterNode extends AudioNode { detune: AudioParam; Q: AudioParam; gain: AudioParam; - type: - | 'lowpass' - | 'highpass' - | 'bandpass' - | 'lowshelf' - | 'highshelf' - | 'peaking' - | 'notch' - | 'allpass'; - getFrequencyResponse( - frequencyHz: Float32Array, - magResponse: Float32Array, - phaseResponse: Float32Array - ): void; + type: 'lowpass'|'highpass'|'bandpass'|'lowshelf'|'highshelf'|'peaking'|'notch'|'allpass'; + getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; } declare class ChannelMergerNode extends AudioNode {} declare class ChannelSplitterNode extends AudioNode {} -type ConstantSourceOptions = {offset?: number, ...}; +type ConstantSourceOptions = { offset?: number, ... } declare class ConstantSourceNode extends AudioNode { constructor(context: BaseAudioContext, options?: ConstantSourceOptions): void; offset: AudioParam; @@ -1567,11 +1442,7 @@ declare class GainNode extends AudioNode { } declare class IIRFilterNode extends AudioNode { - getFrequencyResponse( - frequencyHz: Float32Array, - magResponse: Float32Array, - phaseResponse: Float32Array - ): void; + getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; } declare class OscillatorNode extends AudioNode { @@ -1589,8 +1460,8 @@ declare class StereoPannerNode extends AudioNode { } declare class PannerNode extends AudioNode { - panningModel: 'equalpower' | 'HRTF'; - distanceModel: 'linear' | 'inverse' | 'exponential'; + panningModel: 'equalpower'|'HRTF'; + distanceModel: 'linear'|'inverse'|'exponential'; refDistance: number; maxDistance: number; rolloffFactor: number; @@ -1604,111 +1475,63 @@ declare class PannerNode extends AudioNode { declare class PeriodicWave extends AudioNode {} declare class WaveShaperNode extends AudioNode { curve: Float32Array; - oversample: 'none' | '2x' | '4x'; + oversample: 'none'|'2x'|'4x'; } + // this part of spec is not finished yet, apparently // https://stackoverflow.com/questions/35296664/can-fetch-get-object-as-headers -type HeadersInit = - | Headers - | Array<[string, string]> - | {[key: string]: string, ...}; +type HeadersInit = Headers | Array<[string, string]> | { [key: string]: string, ... }; + // TODO Heades and URLSearchParams are almost the same thing. // Could it somehow be abstracted away? declare class Headers { - @@iterator(): Iterator<[string, string]>; - constructor(init?: HeadersInit): void; - append(name: string, value: string): void; - delete(name: string): void; - entries(): Iterator<[string, string]>; - forEach( - callback: ( - this: This, - value: string, - name: string, - headers: Headers - ) => mixed, - thisArg: This - ): void; - get(name: string): null | string; - has(name: string): boolean; - keys(): Iterator; - set(name: string, value: string): void; - values(): Iterator; + @@iterator(): Iterator<[string, string]>; + constructor(init?: HeadersInit): void; + append(name: string, value: string): void; + delete(name: string): void; + entries(): Iterator<[string, string]>; + forEach(callback: (this : This, value: string, name: string, headers: Headers) => mixed, thisArg: This): void; + get(name: string): null | string; + has(name: string): boolean; + keys(): Iterator; + set(name: string, value: string): void; + values(): Iterator; } declare class URLSearchParams { - @@iterator(): Iterator<[string, string]>; - - size: number; - - constructor( - init?: - | string - | URLSearchParams - | Array<[string, string]> - | {[string]: string, ...} - ): void; - append(name: string, value: string): void; - delete(name: string, value?: string): void; - entries(): Iterator<[string, string]>; - forEach( - callback: ( - this: This, - value: string, - name: string, - params: URLSearchParams - ) => mixed, - thisArg: This - ): void; - get(name: string): null | string; - getAll(name: string): Array; - has(name: string, value?: string): boolean; - keys(): Iterator; - set(name: string, value: string): void; - sort(): void; - values(): Iterator; - toString(): string; -} - -type CacheType = - | 'default' - | 'no-store' - | 'reload' - | 'no-cache' - | 'force-cache' - | 'only-if-cached'; + @@iterator(): Iterator<[string, string]>; + + size: number; + + constructor(init?: string | URLSearchParams | Array<[string, string]> | { [string]: string, ... } ): void; + append(name: string, value: string): void; + delete(name: string, value?: string): void; + entries(): Iterator<[string, string]>; + forEach(callback: (this : This, value: string, name: string, params: URLSearchParams) => mixed, thisArg: This): void; + get(name: string): null | string; + getAll(name: string): Array; + has(name: string, value?: string): boolean; + keys(): Iterator; + set(name: string, value: string): void; + sort(): void; + values(): Iterator; + toString(): string; +} + +type CacheType = 'default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached'; type CredentialsType = 'omit' | 'same-origin' | 'include'; type ModeType = 'cors' | 'no-cors' | 'same-origin' | 'navigate'; type RedirectType = 'follow' | 'error' | 'manual'; type ReferrerPolicyType = - | '' - | 'no-referrer' - | 'no-referrer-when-downgrade' - | 'same-origin' - | 'origin' - | 'strict-origin' - | 'origin-when-cross-origin' - | 'strict-origin-when-cross-origin' - | 'unsafe-url'; - -type ResponseType = - | 'basic' - | 'cors' - | 'default' - | 'error' - | 'opaque' - | 'opaqueredirect'; - -type BodyInit = - | string - | URLSearchParams - | FormData - | Blob - | ArrayBuffer - | $ArrayBufferView - | ReadableStream; + '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'same-origin' | + 'origin' | 'strict-origin' | 'origin-when-cross-origin' | + 'strict-origin-when-cross-origin' | 'unsafe-url'; + +type ResponseType = 'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect' ; + +type BodyInit = string | URLSearchParams | FormData | Blob | ArrayBuffer | $ArrayBufferView | ReadableStream; type RequestInfo = Request | URL | string; @@ -1727,84 +1550,76 @@ type RequestOptions = { signal?: ?AbortSignal, window?: any, ... -}; +} type ResponseOptions = { status?: number, statusText?: string, headers?: HeadersInit, ... -}; +} declare class Response { - constructor(input?: ?BodyInit, init?: ResponseOptions): void; - clone(): Response; - static error(): Response; - static redirect(url: string, status?: number): Response; - - redirected: boolean; - type: ResponseType; - url: string; - ok: boolean; - status: number; - statusText: string; - headers: Headers; - trailer: Promise; - - // Body methods and attributes - bodyUsed: boolean; - body: ?ReadableStream; - - arrayBuffer(): Promise; - blob(): Promise; - formData(): Promise; - json(): Promise; - text(): Promise; + constructor(input?: ?BodyInit, init?: ResponseOptions): void; + clone(): Response; + static error(): Response; + static redirect(url: string, status?: number): Response; + + redirected: boolean; + type: ResponseType; + url: string; + ok: boolean; + status: number; + statusText: string; + headers: Headers; + trailer: Promise; + + // Body methods and attributes + bodyUsed: boolean; + body: ?ReadableStream, + + arrayBuffer(): Promise; + blob(): Promise; + formData(): Promise; + json(): Promise; + text(): Promise; } declare class Request { - constructor(input: RequestInfo, init?: RequestOptions): void; - clone(): Request; - - url: string; - - cache: CacheType; - credentials: CredentialsType; - headers: Headers; - integrity: string; - method: string; - mode: ModeType; - redirect: RedirectType; - referrer: string; - referrerPolicy: ReferrerPolicyType; - +signal: AbortSignal; - - // Body methods and attributes - bodyUsed: boolean; - - arrayBuffer(): Promise; - blob(): Promise; - formData(): Promise; - json(): Promise; - text(): Promise; -} - -declare function fetch( - input: RequestInfo, - init?: RequestOptions -): Promise; - -type TextEncoder$availableEncodings = - | 'utf-8' - | 'utf8' - | 'unicode-1-1-utf-8' - | 'utf-16be' - | 'utf-16' - | 'utf-16le'; + constructor(input: RequestInfo, init?: RequestOptions): void; + clone(): Request; + + url: string; + + cache: CacheType; + credentials: CredentialsType; + headers: Headers; + integrity: string; + method: string; + mode: ModeType; + redirect: RedirectType; + referrer: string; + referrerPolicy: ReferrerPolicyType; + +signal: AbortSignal; + + // Body methods and attributes + bodyUsed: boolean; + + arrayBuffer(): Promise; + blob(): Promise; + formData(): Promise; + json(): Promise; + text(): Promise; +} + +declare function fetch(input: RequestInfo, init?: RequestOptions): Promise; + + +type TextEncoder$availableEncodings = 'utf-8' | 'utf8' | 'unicode-1-1-utf-8' | 'utf-16be' | 'utf-16' | 'utf-16le'; declare class TextEncoder { constructor(encoding?: TextEncoder$availableEncodings): void; - encode(buffer: string, options?: {stream: boolean, ...}): Uint8Array; + encode(buffer: string, options?: { stream: boolean, ... }): Uint8Array; encoding: TextEncoder$availableEncodings; } @@ -2025,25 +1840,17 @@ type TextDecoder$availableEncodings = | 'x-user-defined' | 'x-x-big5'; + declare class TextDecoder { - constructor( - encoding?: TextDecoder$availableEncodings, - options?: {fatal: boolean, ...} - ): void; + constructor(encoding?: TextDecoder$availableEncodings, options?: { fatal: boolean, ... }): void; encoding: TextDecoder$availableEncodings; fatal: boolean; ignoreBOM: boolean; - decode( - buffer?: ArrayBuffer | $ArrayBufferView, - options?: {stream: boolean, ...} - ): string; + decode(buffer?: ArrayBuffer | $ArrayBufferView, options?: { stream: boolean, ... }): string; } declare class TextDecoderStream { - constructor( - encoding?: TextDecoder$availableEncodings, - options?: {fatal?: boolean, ignoreBOM?: boolean, ...} - ): void; + constructor(encoding?: TextDecoder$availableEncodings, options?: { fatal?: boolean, ignoreBOM?: boolean, ... }): void; encoding: TextDecoder$availableEncodings; fatal: boolean; ignoreBOM: boolean; @@ -2056,8 +1863,8 @@ declare class MessagePort extends EventTarget { start(): void; close(): void; - onmessage: null | ((ev: MessageEvent) => mixed); - onmessageerror: null | ((ev: MessageEvent) => mixed); + onmessage: null | (ev: MessageEvent) => mixed; + onmessageerror: null | (ev: MessageEvent) => mixed; } declare class MessageChannel { @@ -2136,11 +1943,7 @@ type VRStageParameters = { ... }; -type VRDisplayEventReason = - | 'mounted' - | 'navigation' - | 'requested' - | 'unmounted'; +type VRDisplayEventReason = 'mounted' | 'navigation' | 'requested' | 'unmounted'; type VRDisplayEventInit = { display: VRDisplay, @@ -2159,7 +1962,7 @@ declare class MediaQueryListEvent { media: string; } -declare type MediaQueryListListener = (MediaQueryListEvent) => void; +declare type MediaQueryListListener = MediaQueryListEvent => void; declare class MediaQueryList extends EventTarget { matches: boolean; @@ -2176,9 +1979,9 @@ declare type CredMgmtCredentialRequestOptions = { mediation?: 'silent' | 'optional' | 'required', signal?: AbortSignal, ... -}; +} -declare type CredMgmtCredentialCreationOptions = {signal: AbortSignal, ...}; +declare type CredMgmtCredentialCreationOptions = { signal: AbortSignal, ... } declare interface CredMgmtCredential { id: string; @@ -2193,31 +1996,31 @@ declare interface CredMgmtCredentialsContainer { get(option?: CredMgmtCredentialRequestOptions): Promise; store(credential: CredMgmtCredential): Promise; create( - creationOption?: CredMgmtCredentialCreationOptions + creationOption?: CredMgmtCredentialCreationOptions, ): Promise; preventSilentAccess(): Promise; } type SpeechSynthesisErrorCode = - | 'canceled' - | 'interrupted' - | 'audio-busy' - | 'audio-hardware' - | 'network' - | 'synthesis-unavailable' - | 'synthesis-failed' - | 'language-unavailable' - | 'voice-unavailable' - | 'text-too-long' - | 'invalid-argument' - | 'not-allowed'; + | "canceled" + | "interrupted" + | "audio-busy" + | "audio-hardware" + | "network" + | "synthesis-unavailable" + | "synthesis-failed" + | "language-unavailable" + | "voice-unavailable" + | "text-too-long" + | "invalid-argument" + | "not-allowed"; declare class SpeechSynthesis extends EventTarget { +pending: boolean; +speaking: boolean; +paused: boolean; - onvoiceschanged: ?(ev: Event) => mixed; + onvoiceschanged: ?((ev: Event) => mixed); speak(utterance: SpeechSynthesisUtterance): void; cancel(): void; @@ -2238,23 +2041,23 @@ declare class SpeechSynthesisUtterance extends EventTarget { rate: number; pitch: number; - onstart: ?(ev: SpeechSynthesisEvent) => mixed; - onend: ?(ev: SpeechSynthesisEvent) => mixed; - onerror: ?(ev: SpeechSynthesisErrorEvent) => mixed; - onpause: ?(ev: SpeechSynthesisEvent) => mixed; - onresume: ?(ev: SpeechSynthesisEvent) => mixed; - onmark: ?(ev: SpeechSynthesisEvent) => mixed; - onboundary: ?(ev: SpeechSynthesisEvent) => mixed; + onstart: ?((ev: SpeechSynthesisEvent) => mixed); + onend: ?((ev: SpeechSynthesisEvent) => mixed); + onerror: ?((ev: SpeechSynthesisErrorEvent) => mixed); + onpause: ?((ev: SpeechSynthesisEvent) => mixed); + onresume: ?((ev: SpeechSynthesisEvent) => mixed); + onmark: ?((ev: SpeechSynthesisEvent) => mixed); + onboundary: ?((ev: SpeechSynthesisEvent) => mixed); } type SpeechSynthesisEvent$Init = Event$Init & { - utterance: SpeechSynthesisUtterance, - charIndex?: number, - charLength?: number, - elapsedTime?: number, - name?: string, + utterance: SpeechSynthesisUtterance; + charIndex?: number; + charLength?: number; + elapsedTime?: number; + name?: string; ... -}; +} declare class SpeechSynthesisEvent extends Event { constructor(type: string, eventInitDict?: SpeechSynthesisEvent$Init): void; @@ -2267,15 +2070,12 @@ declare class SpeechSynthesisEvent extends Event { } type SpeechSynthesisErrorEvent$Init = SpeechSynthesisEvent$Init & { - error: SpeechSynthesisErrorCode, + error: SpeechSynthesisErrorCode; ... -}; +} declare class SpeechSynthesisErrorEvent extends SpeechSynthesisEvent { - constructor( - type: string, - eventInitDict?: SpeechSynthesisErrorEvent$Init - ): void; + constructor(type: string, eventInitDict?: SpeechSynthesisErrorEvent$Init): void; +error: SpeechSynthesisErrorCode; } @@ -2288,13 +2088,13 @@ declare class SpeechSynthesisVoice { } type SpeechRecognitionErrorCode = - | 'no-speech' - | 'aborted' - | 'audio-capture' - | 'not-allowed' - | 'service-not-allowed' - | 'bad-grammar' - | 'language-not-supported'; + | "no-speech" + | "aborted" + | "audio-capture" + | "not-allowed" + | "service-not-allowed" + | "bad-grammar" + | "language-not-supported"; declare class SpeechGrammar { constructor(): void; @@ -2330,12 +2130,12 @@ declare class SpeechRecognitionResultList { } type SpeechRecognitionEvent$Init = Event$Init & { - emma: any, - interpretation: any, - resultIndex: number, - results: SpeechRecognitionResultList, + emma: any; + interpretation: any; + resultIndex: number; + results: SpeechRecognitionResultList; ... -}; +} declare class SpeechRecognitionEvent extends Event { constructor(type: string, eventInitDict?: SpeechRecognitionEvent$Init): void; @@ -2347,15 +2147,12 @@ declare class SpeechRecognitionEvent extends Event { } type SpeechRecognitionErrorEvent$Init = SpeechRecognitionEvent$Init & { - error: SpeechRecognitionErrorCode, + error: SpeechRecognitionErrorCode; ... -}; +} declare class SpeechRecognitionErrorEvent extends SpeechRecognitionEvent { - constructor( - type: string, - eventInitDict?: SpeechRecognitionErrorEvent$Init - ): void; + constructor(type: string, eventInitDict?: SpeechRecognitionErrorEvent$Init): void; +error: SpeechRecognitionErrorCode; +message: string; } @@ -2370,16 +2167,16 @@ declare class SpeechRecognition extends EventTarget { +maxAlternatives: number; +serviceURI: string; - onaudiostart: ?(ev: Event) => mixed; - onaudioend: ?(ev: Event) => mixed; - onend: ?(ev: Event) => mixed; - onerror: ?(ev: Event) => mixed; - onnomatch: ?(ev: Event) => mixed; - onsoundstart: ?(ev: Event) => mixed; - onsoundend: ?(ev: Event) => mixed; - onspeechstart: ?(ev: Event) => mixed; - onspeechend: ?(ev: Event) => mixed; - onstart: ?(ev: Event) => mixed; + onaudiostart: ?((ev: Event) => mixed); + onaudioend: ?((ev: Event) => mixed); + onend: ?((ev: Event) => mixed); + onerror: ?((ev: Event) => mixed); + onnomatch: ?((ev: Event) => mixed); + onsoundstart: ?((ev: Event) => mixed); + onsoundend: ?((ev: Event) => mixed); + onspeechstart: ?((ev: Event) => mixed); + onspeechend: ?((ev: Event) => mixed); + onstart: ?((ev: Event) => mixed); abort(): void; start(): void; @@ -2412,10 +2209,10 @@ declare class TrustedTypePolicy { } declare type TrustedTypePolicyOptions = {| - createHTML?: (string, ...args: Array) => string, - createScript?: (string, ...args: Array) => string, - createScriptURL?: (string, ...args: Array) => string, -|}; + createHTML?: (string, ...args: Array) => string; + createScript?: (string, ...args: Array) => string; + createScriptURL?: (string, ...args: Array) => string; +|} // window.trustedTypes?: TrustedTypePolicyFactory declare class TrustedTypePolicyFactory { @@ -2425,21 +2222,9 @@ declare class TrustedTypePolicyFactory { +isHTML: (value: mixed) => value is TrustedHTML; +isScript: (value: mixed) => value is TrustedScript; +isScriptURL: (value: mixed) => value is TrustedScriptURL; - createPolicy( - policyName: string, - policyOptions?: TrustedTypePolicyOptions - ): TrustedTypePolicy; - getAttributeType( - tagName: string, - attribute?: string, - elementNS?: string, - attrNS?: string - ): null | string; - getPropertyType( - tagName: string, - property: string, - elementNS?: string - ): null | string; + createPolicy(policyName: string, policyOptions?: TrustedTypePolicyOptions): TrustedTypePolicy; + getAttributeType(tagName: string, attribute?: string, elementNS?: string, attrNS?: string): null | string; + getPropertyType(tagName: string, property: string, elementNS?: string): null | string; } // https://wicg.github.io/webusb/ @@ -2465,40 +2250,18 @@ declare class USBDevice { claimInterface(interfaceNumber: number): Promise; clearHalt(direction: 'in' | 'out', endpointNumber: number): Promise; close(): Promise; - controlTransferIn( - setup: SetUpOptions, - length: number - ): Promise; - controlTransferOut( - setup: SetUpOptions, - data: ArrayBuffer - ): Promise; + controlTransferIn(setup: SetUpOptions, length: number): Promise; + controlTransferOut(setup: SetUpOptions, data: ArrayBuffer): Promise; forget(): Promise; - isochronousTransferIn( - endpointNumber: number, - packetLengths: Array - ): Promise; - isochronousTransferOut( - endpointNumber: number, - data: ArrayBuffer, - packetLengths: Array - ): Promise; + isochronousTransferIn(endpointNumber: number, packetLengths: Array): Promise; + isochronousTransferOut(endpointNumber: number, data: ArrayBuffer, packetLengths: Array): Promise; open(): Promise; releaseInterface(interfaceNumber: number): Promise; reset(): Promise; - selectAlternateInterface( - interfaceNumber: number, - alternateSetting: number - ): Promise; + selectAlternateInterface(interfaceNumber: number, alternateSetting: number): Promise; selectConfiguration(configurationValue: number): Promise; - transferIn( - endpointNumber: number, - length: number - ): Promise; - transferOut( - endpointNumber: number, - data: ArrayBuffer - ): Promise; + transferIn(endpointNumber: number, length: number): Promise; + transferOut(endpointNumber: number, data: ArrayBuffer): Promise; } declare class USB extends EventTarget { @@ -2507,24 +2270,25 @@ declare class USB extends EventTarget { } declare type USBDeviceFilter = {| - vendorId?: number, - productId?: number, - classCode?: number, - subclassCode?: number, - protocolCode?: number, - serialNumber?: string, + vendorId?: number; + productId?: number; + classCode?: number; + subclassCode?: number; + protocolCode?: number; + serialNumber?: string; |}; declare type USBDeviceRequestOptions = {| - filters: Array, - exclusionFilters?: Array, -|}; + filters: Array; + exclusionFilters?: Array; +|} declare class USBConfiguration { constructor(): void; configurationName: ?string; configurationValue: number; interfaces: $ReadOnlyArray; + } declare class USBInterface { @@ -2542,14 +2306,14 @@ declare class USBAlternateInterface { interfaceSubclass: number; interfaceProtocol: number; interfaceName: ?string; - endpoints: Array; + endpoints : Array; } declare class USBEndpoint { constructor(): void; endpointNumber: number; direction: 'in' | 'out'; - type: 'bulk' | 'interrupt' | 'isochronous'; + type:'bulk' | 'interrupt' | 'isochronous'; packetSize: number; } @@ -2562,7 +2326,7 @@ declare class USBOutTransferResult { declare class USBInTransferResult { constructor(): void; data: DataView; - status: 'ok' | 'stall' | 'babble'; + status: 'ok' |'stall' | 'babble'; } declare class USBIsochronousInTransferResult { @@ -2574,12 +2338,12 @@ declare class USBIsochronousInTransferResult { declare class USBIsochronousInTransferPacket { constructor(): void; data: DataView; - status: 'ok' | 'stall' | 'babble'; + status: 'ok' |'stall' | 'babble'; } declare class USBIsochronousOutTransferResult { constructor(): void; - packets: Array; + packets: Array } declare class USBIsochronousOutTransferPacket { @@ -2589,15 +2353,15 @@ declare class USBIsochronousOutTransferPacket { } type SetUpOptions = { - requestType: string, - recipient: string, - request: number, - value: number, - index: number, + requestType: string; + recipient: string; + request: number; + value: number; + index: number; ... -}; +} -declare type FileSystemHandleKind = 'file' | 'directory'; +declare type FileSystemHandleKind = "file" | "directory"; // https://wicg.github.io/file-system-access/#api-filesystemhandle declare class FileSystemHandle { @@ -2615,7 +2379,7 @@ declare class FileSystemHandle { // https://fs.spec.whatwg.org/#api-filesystemfilehandle declare class FileSystemFileHandle extends FileSystemHandle { - +kind: 'file'; + +kind: "file"; constructor(name: string): void; @@ -2628,19 +2392,19 @@ declare class FileSystemFileHandle extends FileSystemHandle { // https://fs.spec.whatwg.org/#api-filesystemdirectoryhandle declare class FileSystemDirectoryHandle extends FileSystemHandle { - +kind: 'directory'; + +kind: "directory"; constructor(name: string): void; getDirectoryHandle( name: string, - options?: {|create?: boolean|} + options?: {| create?: boolean |} ): Promise; getFileHandle( name: string, - options?: {|create?: boolean|} + options?: {| create?: boolean |} ): Promise; - removeEntry(name: string, options?: {|recursive?: boolean|}): Promise; + removeEntry(name: string, options?: {| recursive?: boolean |}): Promise; resolve(possibleDescendant: FileSystemHandle): Promise | null>; // Async iterator functions @@ -2655,9 +2419,9 @@ declare class FileSystemSyncAccessHandle { close(): void; flush(): void; getSize(): number; - read(buffer: ArrayBuffer, options?: {|at: number|}): number; + read(buffer: ArrayBuffer, options?: {| at: number |}): number; truncate(newSize: number): void; - write(buffer: ArrayBuffer, options?: {|at: number|}): number; + write(buffer: ArrayBuffer, options?: {| at: number |}): number; } // https://streams.spec.whatwg.org/#default-writer-class @@ -2697,17 +2461,17 @@ declare type FileSystemWriteableFileStreamDataTypes = declare type FileSystemWriteableFileStreamData = | FileSystemWriteableFileStreamDataTypes | {| - type: 'write', + type: "write", position?: number, data: FileSystemWriteableFileStreamDataTypes, |} | {| - type: 'seek', + type: "seek", position: number, data: FileSystemWriteableFileStreamDataTypes, |} | {| - type: 'size', + type: "size", size: number, |}; diff --git a/flow-typed/environments/dom.js b/flow-typed/environments/dom.js index 8e3e7570731..2cf160428e9 100644 --- a/flow-typed/environments/dom.js +++ b/flow-typed/environments/dom.js @@ -1,25 +1,22 @@ -// flow-typed signature: 2872ddd56ba4b4bfefacac38ebdc6087 -// flow-typed version: 3e51657e95/dom/flow_>=v0.261.x +// flow-typed signature: c126209a0e678d121655f21a36219841 +// flow-typed version: f998bd7c46/dom/flow_>=v0.261.x /* Files */ declare class Blob { - constructor( - blobParts?: Array, - options?: { - type?: string, - endings?: string, - ... - } - ): void; + constructor(blobParts?: Array, options?: { + type?: string, + endings?: string, + ... + }): void; isClosed: boolean; size: number; type: string; close(): void; slice(start?: number, end?: number, contentType?: string): Blob; arrayBuffer(): Promise; - text(): Promise; - stream(): ReadableStream; + text(): Promise, + stream(): ReadableStream, } declare class FileReader extends EventTarget { @@ -30,12 +27,12 @@ declare class FileReader extends EventTarget { +readyState: 0 | 1 | 2; +result: null | string | ArrayBuffer; abort(): void; - onabort: null | ((ev: ProgressEvent) => any); - onerror: null | ((ev: ProgressEvent) => any); - onload: null | ((ev: ProgressEvent) => any); - onloadend: null | ((ev: ProgressEvent) => any); - onloadstart: null | ((ev: ProgressEvent) => any); - onprogress: null | ((ev: ProgressEvent) => any); + onabort: null | (ev: ProgressEvent) => any; + onerror: null | (ev: ProgressEvent) => any; + onload: null | (ev: ProgressEvent) => any; + onloadend: null | (ev: ProgressEvent) => any; + onloadstart: null | (ev: ProgressEvent) => any; + onprogress: null | (ev: ProgressEvent) => any; readAsArrayBuffer(blob: Blob): void; readAsBinaryString(blob: Blob): void; readAsDataURL(blob: Blob): void; @@ -43,15 +40,15 @@ declare class FileReader extends EventTarget { } declare type FilePropertyBag = { - type?: string, - lastModified?: number, - ... + type?: string, + lastModified?: number, + ... }; declare class File extends Blob { constructor( fileBits: $ReadOnlyArray, filename: string, - options?: FilePropertyBag + options?: FilePropertyBag, ): void; lastModified: number; name: string; @@ -82,473 +79,166 @@ declare interface ShadowRoot extends DocumentFragment { adoptedStyleSheets: Array; } -declare type ShadowRootMode = 'open' | 'closed'; +declare type ShadowRootMode = 'open'|'closed'; declare type ShadowRootInit = { - delegatesFocus?: boolean, - mode: ShadowRootMode, - ... -}; + delegatesFocus?: boolean, + mode: ShadowRootMode, + ... +} declare type ScrollToOptions = { - top?: number, - left?: number, - behavior?: 'auto' | 'smooth', + top?: number; + left?: number; + behavior?: 'auto' | 'smooth'; ... -}; +} -type EventHandler = (event: Event) => mixed; -type EventListener = {handleEvent: EventHandler, ...} | EventHandler; -type MouseEventHandler = (event: MouseEvent) => mixed; -type MouseEventListener = - | {handleEvent: MouseEventHandler, ...} - | MouseEventHandler; -type FocusEventHandler = (event: FocusEvent) => mixed; -type FocusEventListener = - | {handleEvent: FocusEventHandler, ...} - | FocusEventHandler; -type KeyboardEventHandler = (event: KeyboardEvent) => mixed; -type KeyboardEventListener = - | {handleEvent: KeyboardEventHandler, ...} - | KeyboardEventHandler; -type InputEventHandler = (event: InputEvent) => mixed; -type InputEventListener = - | {handleEvent: InputEventHandler, ...} - | InputEventHandler; -type TouchEventHandler = (event: TouchEvent) => mixed; -type TouchEventListener = - | {handleEvent: TouchEventHandler, ...} - | TouchEventHandler; -type WheelEventHandler = (event: WheelEvent) => mixed; -type WheelEventListener = - | {handleEvent: WheelEventHandler, ...} - | WheelEventHandler; -type AbortProgressEventHandler = (event: ProgressEvent) => mixed; -type AbortProgressEventListener = - | {handleEvent: AbortProgressEventHandler, ...} - | AbortProgressEventHandler; -type ProgressEventHandler = (event: ProgressEvent) => mixed; -type ProgressEventListener = - | {handleEvent: ProgressEventHandler, ...} - | ProgressEventHandler; -type DragEventHandler = (event: DragEvent) => mixed; -type DragEventListener = - | {handleEvent: DragEventHandler, ...} - | DragEventHandler; -type PointerEventHandler = (event: PointerEvent) => mixed; -type PointerEventListener = - | {handleEvent: PointerEventHandler, ...} - | PointerEventHandler; -type AnimationEventHandler = (event: AnimationEvent) => mixed; -type AnimationEventListener = - | {handleEvent: AnimationEventHandler, ...} - | AnimationEventHandler; -type ClipboardEventHandler = (event: ClipboardEvent) => mixed; -type ClipboardEventListener = - | {handleEvent: ClipboardEventHandler, ...} - | ClipboardEventHandler; -type TransitionEventHandler = (event: TransitionEvent) => mixed; -type TransitionEventListener = - | {handleEvent: TransitionEventHandler, ...} - | TransitionEventHandler; -type MessageEventHandler = (event: MessageEvent) => mixed; -type MessageEventListener = - | {handleEvent: MessageEventHandler, ...} - | MessageEventHandler; -type BeforeUnloadEventHandler = (event: BeforeUnloadEvent) => mixed; -type BeforeUnloadEventListener = - | {handleEvent: BeforeUnloadEventHandler, ...} - | BeforeUnloadEventHandler; -type StorageEventHandler = (event: StorageEvent) => mixed; -type StorageEventListener = - | {handleEvent: StorageEventHandler, ...} - | StorageEventHandler; -type SecurityPolicyViolationEventHandler = ( - event: SecurityPolicyViolationEvent -) => mixed; -type SecurityPolicyViolationEventListener = - | {handleEvent: SecurityPolicyViolationEventHandler, ...} - | SecurityPolicyViolationEventHandler; -type USBConnectionEventHandler = (event: USBConnectionEvent) => mixed; -type USBConnectionEventListener = - | {handleEvent: USBConnectionEventHandler, ...} - | USBConnectionEventHandler; +type EventHandler = (event: Event) => mixed +type EventListener = { handleEvent: EventHandler, ... } | EventHandler +type MouseEventHandler = (event: MouseEvent) => mixed +type MouseEventListener = { handleEvent: MouseEventHandler, ... } | MouseEventHandler +type FocusEventHandler = (event: FocusEvent) => mixed +type FocusEventListener = { handleEvent: FocusEventHandler, ... } | FocusEventHandler +type KeyboardEventHandler = (event: KeyboardEvent) => mixed +type KeyboardEventListener = { handleEvent: KeyboardEventHandler, ... } | KeyboardEventHandler +type InputEventHandler = (event: InputEvent) => mixed +type InputEventListener = { handleEvent: InputEventHandler, ... } | InputEventHandler +type TouchEventHandler = (event: TouchEvent) => mixed +type TouchEventListener = { handleEvent: TouchEventHandler, ... } | TouchEventHandler +type WheelEventHandler = (event: WheelEvent) => mixed +type WheelEventListener = { handleEvent: WheelEventHandler, ... } | WheelEventHandler +type AbortProgressEventHandler = (event: ProgressEvent) => mixed +type AbortProgressEventListener = { handleEvent: AbortProgressEventHandler, ... } | AbortProgressEventHandler +type ProgressEventHandler = (event: ProgressEvent) => mixed +type ProgressEventListener = { handleEvent: ProgressEventHandler, ... } | ProgressEventHandler +type DragEventHandler = (event: DragEvent) => mixed +type DragEventListener = { handleEvent: DragEventHandler, ... } | DragEventHandler +type PointerEventHandler = (event: PointerEvent) => mixed +type PointerEventListener = { handleEvent: PointerEventHandler, ... } | PointerEventHandler +type AnimationEventHandler = (event: AnimationEvent) => mixed +type AnimationEventListener = { handleEvent: AnimationEventHandler, ... } | AnimationEventHandler +type ClipboardEventHandler = (event: ClipboardEvent) => mixed +type ClipboardEventListener = { handleEvent: ClipboardEventHandler, ... } | ClipboardEventHandler +type TransitionEventHandler = (event: TransitionEvent) => mixed +type TransitionEventListener = { handleEvent: TransitionEventHandler, ... } | TransitionEventHandler +type MessageEventHandler = (event: MessageEvent) => mixed +type MessageEventListener = { handleEvent: MessageEventHandler, ... } | MessageEventHandler +type BeforeUnloadEventHandler = (event: BeforeUnloadEvent) => mixed +type BeforeUnloadEventListener = { handleEvent: BeforeUnloadEventHandler, ... } | BeforeUnloadEventHandler +type StorageEventHandler = (event: StorageEvent) => mixed +type StorageEventListener = { handleEvent: StorageEventHandler, ... } | StorageEventHandler +type SecurityPolicyViolationEventHandler = (event: SecurityPolicyViolationEvent) => mixed +type SecurityPolicyViolationEventListener = { handleEvent: SecurityPolicyViolationEventHandler, ... } | SecurityPolicyViolationEventHandler +type USBConnectionEventHandler = (event: USBConnectionEvent) => mixed +type USBConnectionEventListener = { handleEvent: USBConnectionEventHandler, ... } | USBConnectionEventHandler type MediaKeySessionType = 'temporary' | 'persistent-license'; -type MediaKeyStatus = - | 'usable' - | 'expired' - | 'released' - | 'output-restricted' - | 'output-downscaled' - | 'status-pending' - | 'internal-error'; -type MouseEventTypes = - | 'contextmenu' - | 'mousedown' - | 'mouseenter' - | 'mouseleave' - | 'mousemove' - | 'mouseout' - | 'mouseover' - | 'mouseup' - | 'click' - | 'dblclick'; +type MediaKeyStatus = 'usable' | 'expired' | 'released' | 'output-restricted' | 'output-downscaled' | 'status-pending' | 'internal-error'; +type MouseEventTypes = 'contextmenu' | 'mousedown' | 'mouseenter' | 'mouseleave' | 'mousemove' | 'mouseout' | 'mouseover' | 'mouseup' | 'click' | 'dblclick'; type FocusEventTypes = 'blur' | 'focus' | 'focusin' | 'focusout'; type KeyboardEventTypes = 'keydown' | 'keyup' | 'keypress'; -type InputEventTypes = 'input' | 'beforeinput'; +type InputEventTypes = 'input' | 'beforeinput' type TouchEventTypes = 'touchstart' | 'touchmove' | 'touchend' | 'touchcancel'; type WheelEventTypes = 'wheel'; type AbortProgressEventTypes = 'abort'; -type ProgressEventTypes = - | 'abort' - | 'error' - | 'load' - | 'loadend' - | 'loadstart' - | 'progress' - | 'timeout'; -type DragEventTypes = - | 'drag' - | 'dragend' - | 'dragenter' - | 'dragexit' - | 'dragleave' - | 'dragover' - | 'dragstart' - | 'drop'; -type PointerEventTypes = - | 'pointerover' - | 'pointerenter' - | 'pointerdown' - | 'pointermove' - | 'pointerup' - | 'pointercancel' - | 'pointerout' - | 'pointerleave' - | 'gotpointercapture' - | 'lostpointercapture'; -type AnimationEventTypes = - | 'animationstart' - | 'animationend' - | 'animationiteration'; +type ProgressEventTypes = 'abort' | 'error' | 'load' | 'loadend' | 'loadstart' | 'progress' | 'timeout'; +type DragEventTypes = 'drag' | 'dragend' | 'dragenter' | 'dragexit' | 'dragleave' | 'dragover' | 'dragstart' | 'drop'; +type PointerEventTypes = 'pointerover' | 'pointerenter' | 'pointerdown' | 'pointermove' | 'pointerup' | 'pointercancel' | 'pointerout' | 'pointerleave' | 'gotpointercapture' | 'lostpointercapture'; +type AnimationEventTypes = 'animationstart' | 'animationend' | 'animationiteration'; type ClipboardEventTypes = 'clipboardchange' | 'cut' | 'copy' | 'paste'; -type TransitionEventTypes = - | 'transitionrun' - | 'transitionstart' - | 'transitionend' - | 'transitioncancel'; +type TransitionEventTypes = 'transitionrun' | 'transitionstart' | 'transitionend' | 'transitioncancel'; type MessageEventTypes = string; type BeforeUnloadEventTypes = 'beforeunload'; type StorageEventTypes = 'storage'; type SecurityPolicyViolationEventTypes = 'securitypolicyviolation'; type USBConnectionEventTypes = 'connect' | 'disconnect'; type ToggleEventTypes = 'beforetoggle' | 'toggle'; -type EventListenerOptionsOrUseCapture = - | boolean - | { - capture?: boolean, - once?: boolean, - passive?: boolean, - signal?: AbortSignal, - ... - }; +type EventListenerOptionsOrUseCapture = boolean | { + capture?: boolean, + once?: boolean, + passive?: boolean, + signal?: AbortSignal, + ... +}; declare class EventTarget { - addEventListener( - type: MouseEventTypes, - listener: MouseEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - addEventListener( - type: FocusEventTypes, - listener: FocusEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - addEventListener( - type: KeyboardEventTypes, - listener: KeyboardEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - addEventListener( - type: InputEventTypes, - listener: InputEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - addEventListener( - type: TouchEventTypes, - listener: TouchEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - addEventListener( - type: WheelEventTypes, - listener: WheelEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - addEventListener( - type: AbortProgressEventTypes, - listener: AbortProgressEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - addEventListener( - type: ProgressEventTypes, - listener: ProgressEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - addEventListener( - type: DragEventTypes, - listener: DragEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - addEventListener( - type: PointerEventTypes, - listener: PointerEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - addEventListener( - type: AnimationEventTypes, - listener: AnimationEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - addEventListener( - type: ClipboardEventTypes, - listener: ClipboardEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - addEventListener( - type: TransitionEventTypes, - listener: TransitionEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - addEventListener( - type: MessageEventTypes, - listener: MessageEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - addEventListener( - type: BeforeUnloadEventTypes, - listener: BeforeUnloadEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - addEventListener( - type: StorageEventTypes, - listener: StorageEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - addEventListener( - type: SecurityPolicyViolationEventTypes, - listener: SecurityPolicyViolationEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - addEventListener( - type: USBConnectionEventTypes, - listener: USBConnectionEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - addEventListener( - type: string, - listener: EventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - - removeEventListener( - type: MouseEventTypes, - listener: MouseEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - removeEventListener( - type: FocusEventTypes, - listener: FocusEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - removeEventListener( - type: KeyboardEventTypes, - listener: KeyboardEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - removeEventListener( - type: InputEventTypes, - listener: InputEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - removeEventListener( - type: TouchEventTypes, - listener: TouchEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - removeEventListener( - type: WheelEventTypes, - listener: WheelEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - removeEventListener( - type: AbortProgressEventTypes, - listener: AbortProgressEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - removeEventListener( - type: ProgressEventTypes, - listener: ProgressEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - removeEventListener( - type: DragEventTypes, - listener: DragEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - removeEventListener( - type: PointerEventTypes, - listener: PointerEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - removeEventListener( - type: AnimationEventTypes, - listener: AnimationEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - removeEventListener( - type: ClipboardEventTypes, - listener: ClipboardEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - removeEventListener( - type: TransitionEventTypes, - listener: TransitionEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - removeEventListener( - type: MessageEventTypes, - listener: MessageEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - removeEventListener( - type: BeforeUnloadEventTypes, - listener: BeforeUnloadEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - removeEventListener( - type: StorageEventTypes, - listener: StorageEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - removeEventListener( - type: SecurityPolicyViolationEventTypes, - listener: SecurityPolicyViolationEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - removeEventListener( - type: USBConnectionEventTypes, - listener: USBConnectionEventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; - removeEventListener( - type: string, - listener: EventListener, - optionsOrUseCapture?: EventListenerOptionsOrUseCapture - ): void; + addEventListener(type: MouseEventTypes, listener: MouseEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + addEventListener(type: FocusEventTypes, listener: FocusEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + addEventListener(type: KeyboardEventTypes, listener: KeyboardEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + addEventListener(type: InputEventTypes, listener: InputEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + addEventListener(type: TouchEventTypes, listener: TouchEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + addEventListener(type: WheelEventTypes, listener: WheelEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + addEventListener(type: AbortProgressEventTypes, listener: AbortProgressEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + addEventListener(type: ProgressEventTypes, listener: ProgressEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + addEventListener(type: DragEventTypes, listener: DragEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + addEventListener(type: PointerEventTypes, listener: PointerEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + addEventListener(type: AnimationEventTypes, listener: AnimationEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + addEventListener(type: ClipboardEventTypes, listener: ClipboardEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + addEventListener(type: TransitionEventTypes, listener: TransitionEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + addEventListener(type: MessageEventTypes, listener: MessageEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + addEventListener(type: BeforeUnloadEventTypes, listener: BeforeUnloadEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + addEventListener(type: StorageEventTypes, listener: StorageEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + addEventListener(type: SecurityPolicyViolationEventTypes, listener: SecurityPolicyViolationEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + addEventListener(type: USBConnectionEventTypes, listener: USBConnectionEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + addEventListener(type: string, listener: EventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + + removeEventListener(type: MouseEventTypes, listener: MouseEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + removeEventListener(type: FocusEventTypes, listener: FocusEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + removeEventListener(type: KeyboardEventTypes, listener: KeyboardEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + removeEventListener(type: InputEventTypes, listener: InputEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + removeEventListener(type: TouchEventTypes, listener: TouchEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + removeEventListener(type: WheelEventTypes, listener: WheelEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + removeEventListener(type: AbortProgressEventTypes, listener: AbortProgressEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + removeEventListener(type: ProgressEventTypes, listener: ProgressEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + removeEventListener(type: DragEventTypes, listener: DragEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + removeEventListener(type: PointerEventTypes, listener: PointerEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + removeEventListener(type: AnimationEventTypes, listener: AnimationEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + removeEventListener(type: ClipboardEventTypes, listener: ClipboardEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + removeEventListener(type: TransitionEventTypes, listener: TransitionEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + removeEventListener(type: MessageEventTypes, listener: MessageEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + removeEventListener(type: BeforeUnloadEventTypes, listener: BeforeUnloadEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + removeEventListener(type: StorageEventTypes, listener: StorageEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + removeEventListener(type: SecurityPolicyViolationEventTypes, listener: SecurityPolicyViolationEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + removeEventListener(type: USBConnectionEventTypes, listener: USBConnectionEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; + removeEventListener(type: string, listener: EventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void; attachEvent?: (type: MouseEventTypes, listener: MouseEventListener) => void; attachEvent?: (type: FocusEventTypes, listener: FocusEventListener) => void; - attachEvent?: ( - type: KeyboardEventTypes, - listener: KeyboardEventListener - ) => void; + attachEvent?: (type: KeyboardEventTypes, listener: KeyboardEventListener) => void; attachEvent?: (type: InputEventTypes, listener: InputEventListener) => void; attachEvent?: (type: TouchEventTypes, listener: TouchEventListener) => void; attachEvent?: (type: WheelEventTypes, listener: WheelEventListener) => void; - attachEvent?: ( - type: AbortProgressEventTypes, - listener: AbortProgressEventListener - ) => void; - attachEvent?: ( - type: ProgressEventTypes, - listener: ProgressEventListener - ) => void; + attachEvent?: (type: AbortProgressEventTypes, listener: AbortProgressEventListener) => void; + attachEvent?: (type: ProgressEventTypes, listener: ProgressEventListener) => void; attachEvent?: (type: DragEventTypes, listener: DragEventListener) => void; - attachEvent?: ( - type: PointerEventTypes, - listener: PointerEventListener - ) => void; - attachEvent?: ( - type: AnimationEventTypes, - listener: AnimationEventListener - ) => void; - attachEvent?: ( - type: ClipboardEventTypes, - listener: ClipboardEventListener - ) => void; - attachEvent?: ( - type: TransitionEventTypes, - listener: TransitionEventListener - ) => void; - attachEvent?: ( - type: MessageEventTypes, - listener: MessageEventListener - ) => void; - attachEvent?: ( - type: BeforeUnloadEventTypes, - listener: BeforeUnloadEventListener - ) => void; - attachEvent?: ( - type: StorageEventTypes, - listener: StorageEventListener - ) => void; - attachEvent?: ( - type: USBConnectionEventTypes, - listener: USBConnectionEventListener - ) => void; + attachEvent?: (type: PointerEventTypes, listener: PointerEventListener) => void; + attachEvent?: (type: AnimationEventTypes, listener: AnimationEventListener) => void; + attachEvent?: (type: ClipboardEventTypes, listener: ClipboardEventListener) => void; + attachEvent?: (type: TransitionEventTypes, listener: TransitionEventListener) => void; + attachEvent?: (type: MessageEventTypes, listener: MessageEventListener) => void; + attachEvent?: (type: BeforeUnloadEventTypes, listener: BeforeUnloadEventListener) => void; + attachEvent?: (type: StorageEventTypes, listener: StorageEventListener) => void; + attachEvent?: (type: USBConnectionEventTypes, listener: USBConnectionEventListener) => void; attachEvent?: (type: string, listener: EventListener) => void; detachEvent?: (type: MouseEventTypes, listener: MouseEventListener) => void; detachEvent?: (type: FocusEventTypes, listener: FocusEventListener) => void; - detachEvent?: ( - type: KeyboardEventTypes, - listener: KeyboardEventListener - ) => void; + detachEvent?: (type: KeyboardEventTypes, listener: KeyboardEventListener) => void; detachEvent?: (type: InputEventTypes, listener: InputEventListener) => void; detachEvent?: (type: TouchEventTypes, listener: TouchEventListener) => void; detachEvent?: (type: WheelEventTypes, listener: WheelEventListener) => void; - detachEvent?: ( - type: AbortProgressEventTypes, - listener: AbortProgressEventListener - ) => void; - detachEvent?: ( - type: ProgressEventTypes, - listener: ProgressEventListener - ) => void; + detachEvent?: (type: AbortProgressEventTypes, listener: AbortProgressEventListener) => void; + detachEvent?: (type: ProgressEventTypes, listener: ProgressEventListener) => void; detachEvent?: (type: DragEventTypes, listener: DragEventListener) => void; - detachEvent?: ( - type: PointerEventTypes, - listener: PointerEventListener - ) => void; - detachEvent?: ( - type: AnimationEventTypes, - listener: AnimationEventListener - ) => void; - detachEvent?: ( - type: ClipboardEventTypes, - listener: ClipboardEventListener - ) => void; - detachEvent?: ( - type: TransitionEventTypes, - listener: TransitionEventListener - ) => void; - detachEvent?: ( - type: MessageEventTypes, - listener: MessageEventListener - ) => void; - detachEvent?: ( - type: BeforeUnloadEventTypes, - listener: BeforeUnloadEventListener - ) => void; - detachEvent?: ( - type: StorageEventTypes, - listener: StorageEventListener - ) => void; - detachEvent?: ( - type: USBConnectionEventTypes, - listener: USBConnectionEventListener - ) => void; + detachEvent?: (type: PointerEventTypes, listener: PointerEventListener) => void; + detachEvent?: (type: AnimationEventTypes, listener: AnimationEventListener) => void; + detachEvent?: (type: ClipboardEventTypes, listener: ClipboardEventListener) => void; + detachEvent?: (type: TransitionEventTypes, listener: TransitionEventListener) => void; + detachEvent?: (type: MessageEventTypes, listener: MessageEventListener) => void; + detachEvent?: (type: BeforeUnloadEventTypes, listener: BeforeUnloadEventListener) => void; + detachEvent?: (type: StorageEventTypes, listener: StorageEventListener) => void; + detachEvent?: (type: USBConnectionEventTypes, listener: USBConnectionEventListener) => void; detachEvent?: (type: string, listener: EventListener) => void; dispatchEvent(evt: Event): boolean; @@ -556,11 +246,7 @@ declare class EventTarget { // Deprecated cancelBubble: boolean; - initEvent( - eventTypeArg: string, - canBubbleArg: boolean, - cancelableArg: boolean - ): void; + initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; } // https://dom.spec.whatwg.org/#dictdef-eventinit @@ -571,7 +257,7 @@ type Event$Init = { /** Non-standard. See `composed` instead. */ scoped?: boolean, ... -}; +} // https://dom.spec.whatwg.org/#interface-event declare class Event { @@ -671,10 +357,14 @@ declare class Event { /** * @deprecated */ - initEvent(type: string, bubbles: boolean, cancelable: boolean): void; + initEvent( + type: string, + bubbles: boolean, + cancelable: boolean + ): void; } -type CustomEvent$Init = {...Event$Init, detail?: any, ...}; +type CustomEvent$Init = { ...Event$Init, detail?: any, ... } declare class CustomEvent extends Event { constructor(type: string, eventInitDict?: CustomEvent$Init): void; @@ -689,7 +379,7 @@ declare class CustomEvent extends Event { ): CustomEvent; } -type UIEvent$Init = {...Event$Init, detail?: number, view?: any, ...}; +type UIEvent$Init = { ...Event$Init, detail?: number, view?: any, ... } declare class UIEvent extends Event { constructor(typeArg: string, uiEventInit?: UIEvent$Init): void; @@ -699,29 +389,29 @@ declare class UIEvent extends Event { declare class CompositionEvent extends UIEvent { data: string | null; - locale: string; + locale: string, } type MouseEvent$MouseEventInit = { - screenX?: number, - screenY?: number, - clientX?: number, - clientY?: number, - ctrlKey?: boolean, - shiftKey?: boolean, - altKey?: boolean, - metaKey?: boolean, - button?: number, - buttons?: number, - region?: string | null, - relatedTarget?: EventTarget | null, - ... + screenX?: number, + screenY?: number, + clientX?: number, + clientY?: number, + ctrlKey?: boolean, + shiftKey?: boolean, + altKey?: boolean, + metaKey?: boolean, + button?: number, + buttons?: number, + region?: string | null, + relatedTarget?: EventTarget | null, + ... }; declare class MouseEvent extends UIEvent { constructor( typeArg: string, - mouseEventInit?: MouseEvent$MouseEventInit + mouseEventInit?: MouseEvent$MouseEventInit, ): void; altKey: boolean; button: number; @@ -754,10 +444,10 @@ type WheelEvent$Init = { ...MouseEvent$MouseEventInit, deltaX?: number, deltaY?: number, - deltaZ?: number, + deltaZ?: number; deltaMode?: 0x00 | 0x01 | 0x02, ... -}; +} declare class WheelEvent extends MouseEvent { static +DOM_DELTA_PIXEL: 0x00; @@ -776,23 +466,23 @@ declare class DragEvent extends MouseEvent { } type PointerEvent$PointerEventInit = MouseEvent$MouseEventInit & { - pointerId?: number, - width?: number, - height?: number, - pressure?: number, - tangentialPressure?: number, - tiltX?: number, - tiltY?: number, - twist?: number, - pointerType?: string, - isPrimary?: boolean, - ... + pointerId?: number, + width?: number, + height?: number, + pressure?: number, + tangentialPressure?: number, + tiltX?: number, + tiltY?: number, + twist?: number, + pointerType?: string, + isPrimary?: boolean, + ... }; declare class PointerEvent extends MouseEvent { constructor( typeArg: string, - pointerEventInit?: PointerEvent$PointerEventInit + pointerEventInit?: PointerEvent$PointerEventInit, ): void; pointerId: number; width: number; @@ -831,7 +521,7 @@ type PageTransitionEventInit = { ...Event$Init, persisted: boolean, ... -}; +} // https://html.spec.whatwg.org/multipage/browsing-the-web.html#the-pagetransitionevent-interface declare class PageTransitionEvent extends Event { @@ -932,7 +622,7 @@ type KeyboardEvent$Init = { /** Initializes the `which` attribute */ which?: number, ... -}; +} // https://w3c.github.io/uievents/#idl-keyboardevent declare class KeyboardEvent extends UIEvent { @@ -1014,7 +704,7 @@ type InputEvent$Init = { isComposing?: boolean, ranges?: Array, // TODO: StaticRange ... -}; +} declare class InputEvent extends UIEvent { constructor(typeArg: string, inputEventInit: InputEvent$Init): void; @@ -1043,14 +733,14 @@ declare class AnimationEvent extends Event { // https://www.w3.org/TR/touch-events/#idl-def-Touch declare class Touch { - clientX: number; - clientY: number; - identifier: number; - pageX: number; - pageY: number; - screenX: number; - screenY: number; - target: EventTarget; + clientX: number, + clientY: number, + identifier: number, + pageX: number, + pageY: number, + screenX: number, + screenY: number, + target: EventTarget, } // https://www.w3.org/TR/touch-events/#idl-def-TouchList @@ -1058,40 +748,37 @@ declare class Touch { // return type just been Touch? declare class TouchList { @@iterator(): Iterator; - length: number; - item(index: number): null | Touch; - [index: number]: Touch; + length: number, + item(index: number): null | Touch, + [index: number]: Touch, } // https://www.w3.org/TR/touch-events/#touchevent-interface declare class TouchEvent extends UIEvent { - altKey: boolean; - changedTouches: TouchList; - ctrlKey: boolean; - metaKey: boolean; - shiftKey: boolean; - targetTouches: TouchList; - touches: TouchList; + altKey: boolean, + changedTouches: TouchList, + ctrlKey: boolean, + metaKey: boolean, + shiftKey: boolean, + targetTouches: TouchList, + touches: TouchList, } // https://www.w3.org/TR/clipboard-apis/#typedefdef-clipboarditemdata // Raw string | Blob are allowed per https://webidl.spec.whatwg.org/#es-promise type ClipboardItemData = string | Blob | Promise; -type PresentationStyle = 'attachment' | 'inline' | 'unspecified'; +type PresentationStyle = "attachment" | "inline" | "unspecified"; type ClipboardItemOptions = { - presentationStyle?: PresentationStyle, + presentationStyle?: PresentationStyle; ... -}; +} declare class ClipboardItem { +types: $ReadOnlyArray; getType(type: string): Promise; - constructor( - items: {[type: string]: ClipboardItemData}, - options?: ClipboardItemOptions - ): void; + constructor(items: {[type: string]: ClipboardItemData}, options?: ClipboardItemOptions): void; } // https://w3c.github.io/clipboard-apis/ as of 15 May 2018 @@ -1116,10 +803,7 @@ type TransitionEvent$Init = { }; declare class TransitionEvent extends Event { - constructor( - type: TransitionEventTypes, - eventInit?: TransitionEvent$Init - ): void; + constructor(type: TransitionEventTypes, eventInit?: TransitionEvent$Init): void; +propertyName: string; // readonly +elapsedTime: number; // readonly @@ -1135,32 +819,54 @@ declare class SecurityPolicyViolationEvent extends Event { +originalPolicy: string; +sourceFile: string; +sample: string; - +disposition: 'enforce' | 'report'; + +disposition: "enforce" | "report"; +statusCode: number; +lineNumber: number; +columnNumber: number; +}; + +// https://developer.mozilla.org/en-US/docs/Web/API/Scheduler +declare class TaskSignal extends AbortSignal { + +priority: number; +} + +type SchedulerPostTaskOptions = { + priority?: "user-blocking" | "user-visible" | "background", + signal?: TaskSignal | AbortSignal, + delay?: number, +}; + +declare class Scheduler { + postTask( + callback: () => T, + options?: SchedulerPostTaskOptions, + ): Promise; + yield(): Promise; } +// https://developer.mozilla.org/en-US/docs/Web/API/Window/structuredClone +declare function structuredClone(value: T, options?: {| transfer: any[] |}): T; + // https://developer.mozilla.org/en-US/docs/Web/API/USBConnectionEvent declare class USBConnectionEvent extends Event { - device: USBDevice; + device: USBDevice, } // TODO: *Event declare class AbortController { - constructor(): void; - +signal: AbortSignal; - abort(reason?: any): void; + constructor(): void; + +signal: AbortSignal; + abort(reason?: any): void; } declare class AbortSignal extends EventTarget { - +aborted: boolean; - +reason: any; - abort(reason?: any): AbortSignal; - onabort: (event: Event) => mixed; - throwIfAborted(): void; - timeout(time: number): AbortSignal; + +aborted: boolean; + +reason: any; + abort(reason?: any): AbortSignal; + onabort: (event: Event) => mixed; + throwIfAborted(): void; + timeout(time: number): AbortSignal; } declare class Node extends EventTarget { @@ -1183,7 +889,7 @@ declare class Node extends EventTarget { cloneNode(deep?: boolean): this; compareDocumentPosition(other: Node): number; contains(other: ?Node): boolean; - getRootNode(options?: {composed: boolean, ...}): Node; + getRootNode(options?: { composed: boolean, ... }): Node; hasChildNodes(): boolean; insertBefore(newChild: T, refChild?: ?Node): T; isDefaultNamespace(namespaceURI: string): boolean; @@ -1225,10 +931,7 @@ declare class NodeList { item(index: number): T; [index: number]: T; - forEach( - callbackfn: (this: This, value: T, index: number, list: NodeList) => any, - thisArg: This - ): void; + forEach(callbackfn: (this : This, value: T, index: number, list: NodeList) => any, thisArg: This): void; entries(): Iterator<[number, T]>; keys(): Iterator; values(): Iterator; @@ -1269,40 +972,41 @@ declare class HTMLCollection<+Elem: Element> { // from https://www.w3.org/TR/custom-elements/#extensions-to-document-interface-to-register // See also https://github.com/w3c/webcomponents/ type ElementRegistrationOptions = { - +prototype?: { - // from https://www.w3.org/TR/custom-elements/#types-of-callbacks - // See also https://github.com/w3c/webcomponents/ - +createdCallback?: () => mixed, - +attachedCallback?: () => mixed, - +detachedCallback?: () => mixed, - +attributeChangedCallback?: (( - // attribute is set - attributeLocalName: string, - oldAttributeValue: null, - newAttributeValue: string, - attributeNamespace: string - ) => mixed) & - // attribute is changed - (( - attributeLocalName: string, - oldAttributeValue: string, - newAttributeValue: string, - attributeNamespace: string - ) => mixed) & - // attribute is removed - (( - attributeLocalName: string, - oldAttributeValue: string, - newAttributeValue: null, - attributeNamespace: string - ) => mixed), - ... - }, - +extends?: string, - ... -}; - -type ElementCreationOptions = {is: string, ...}; + +prototype?: { + // from https://www.w3.org/TR/custom-elements/#types-of-callbacks + // See also https://github.com/w3c/webcomponents/ + +createdCallback?: () => mixed, + +attachedCallback?: () => mixed, + +detachedCallback?: () => mixed, + +attributeChangedCallback?: + // attribute is set + (( + attributeLocalName: string, + oldAttributeValue: null, + newAttributeValue: string, + attributeNamespace: string + ) => mixed) & + // attribute is changed + (( + attributeLocalName: string, + oldAttributeValue: string, + newAttributeValue: string, + attributeNamespace: string + ) => mixed) & + // attribute is removed + (( + attributeLocalName: string, + oldAttributeValue: string, + newAttributeValue: null, + attributeNamespace: string + ) => mixed), + ... + }, + +extends?: string, + ... +} + +type ElementCreationOptions = { is: string, ...} declare class MutationRecord { type: 'attributes' | 'characterData' | 'childList'; @@ -1317,9 +1021,9 @@ declare class MutationRecord { } type MutationObserverInitRequired = - | {childList: true, ...} - | {attributes: true, ...} - | {characterData: true, ...}; + | { childList: true, ... } + | { attributes: true, ... } + | { characterData: true, ... } declare type MutationObserverInit = MutationObserverInitRequired & { subtree?: boolean, @@ -1327,12 +1031,10 @@ declare type MutationObserverInit = MutationObserverInitRequired & { characterDataOldValue?: boolean, attributeFilter?: Array, ... -}; +} declare class MutationObserver { - constructor( - callback: (arr: Array, observer: MutationObserver) => mixed - ): void; + constructor(callback: (arr: Array, observer: MutationObserver) => mixed): void; observe(target: Node, options: MutationObserverInit): void; takeRecords(): Array; disconnect(): void; @@ -1360,20 +1062,9 @@ declare class Document extends Node { createCDATASection(data: string): Text; createComment(data: string): Comment; createDocumentFragment(): DocumentFragment; - createElement>( - localName: TName, - options?: string | ElementCreationOptions - ): HTMLElementTagNameMap[TName]; - createElementNS>( - namespaceURI: 'http://www.w3.org/1999/xhtml', - qualifiedName: TName, - options?: string | ElementCreationOptions - ): HTMLElementTagNameMap[TName]; - createElementNS( - namespaceURI: string | null, - qualifiedName: string, - options?: string | ElementCreationOptions - ): Element; + createElement>(localName: TName, options?: string | ElementCreationOptions): HTMLElementTagNameMap[TName]; + createElementNS>(namespaceURI: 'http://www.w3.org/1999/xhtml', qualifiedName: TName, options?: string | ElementCreationOptions): HTMLElementTagNameMap[TName]; + createElementNS(namespaceURI: string | null, qualifiedName: string, options?: string | ElementCreationOptions): Element; createTextNode(data: string): Text; currentScript: HTMLScriptElement | null; dir: 'rtl' | 'ltr'; @@ -1383,7 +1074,7 @@ declare class Document extends Node { +documentURI: string; domain: string | null; embeds: HTMLCollection; - exitFullscreen(): Promise; + exitFullscreen(): Promise, queryCommandSupported(cmdID: string): boolean; execCommand(cmdID: string, showUI?: boolean, value?: any): boolean; forms: HTMLCollection; @@ -1391,17 +1082,9 @@ declare class Document extends Node { fullscreenEnabled: boolean; getElementsByClassName(classNames: string): HTMLCollection; getElementsByName(elementName: string): HTMLCollection; - getElementsByTagName>( - qualifiedName: TName - ): HTMLCollection; - getElementsByTagNameNS>( - namespaceURI: 'http://www.w3.org/1999/xhtml', - qualifiedName: TName - ): HTMLCollection; - getElementsByTagNameNS( - namespaceURI: string | null, - qualifiedName: string - ): HTMLCollection; + getElementsByTagName>(qualifiedName: TName): HTMLCollection; + getElementsByTagNameNS>(namespaceURI: 'http://www.w3.org/1999/xhtml', qualifiedName: TName): HTMLCollection; + getElementsByTagNameNS(namespaceURI: string | null, qualifiedName: string): HTMLCollection; head: HTMLHeadElement | null; images: HTMLCollection; +implementation: DOMImplementation; @@ -1457,12 +1140,8 @@ declare class Document extends Node { append(...nodes: Array): void; prepend(...nodes: Array): void; - querySelector>( - selector: TSelector - ): HTMLElementTagNameMap[TSelector] | null; - querySelectorAll>( - selector: TSelector - ): NodeList; + querySelector>(selector: TSelector): HTMLElementTagNameMap[TSelector] | null; + querySelectorAll>(selector: TSelector): NodeList; // Interface DocumentTraversal // http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/traversal.html#Traversal-Document @@ -1478,476 +1157,104 @@ declare class Document extends Node { // NodeFilter.SHOW_ATTRIBUTE === 1), RootNodeT must be Attr, and when // RootNodeT is Attr, bitmasks other than NodeFilter.SHOW_ATTRIBUTE are // meaningless. - createNodeIterator( - root: RootNodeT, - whatToShow: 2, - filter?: NodeFilterInterface - ): NodeIterator; - createTreeWalker( - root: RootNodeT, - whatToShow: 2, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; + createNodeIterator(root: RootNodeT, whatToShow: 2, filter?: NodeFilterInterface): NodeIterator; + createTreeWalker(root: RootNodeT, whatToShow: 2, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; // NodeFilter.SHOW_PROCESSING_INSTRUCTION is not implemented because Flow // does not currently define a ProcessingInstruction class. // When (whatToShow & NodeFilter.SHOW_DOCUMENT === 1 || whatToShow & // NodeFilter.SHOW_DOCUMENT_TYPE === 1), RootNodeT must be Document. - createNodeIterator( - root: RootNodeT, - whatToShow: 256, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 257, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 260, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 261, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 384, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 385, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 388, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 389, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 512, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 513, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 516, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 517, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 640, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 641, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 644, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 645, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 768, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 769, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 772, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 773, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 896, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 897, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 900, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 901, - filter?: NodeFilterInterface - ): NodeIterator< - RootNodeT, - DocumentType | Document | Element | Text | Comment, - >; - createTreeWalker( - root: RootNodeT, - whatToShow: 256, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 257, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 260, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 261, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 384, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 385, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 388, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 389, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 512, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 513, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 516, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 517, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 640, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 641, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 644, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 645, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 768, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 769, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 772, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 773, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 896, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 897, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 900, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 901, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; + createNodeIterator(root: RootNodeT, whatToShow: 256, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 257, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 260, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 261, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 384, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 385, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 388, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 389, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 512, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 513, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 516, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 517, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 640, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 641, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 644, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 645, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 768, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 769, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 772, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 773, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 896, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 897, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 900, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 901, filter?: NodeFilterInterface): NodeIterator; + createTreeWalker(root: RootNodeT, whatToShow: 256, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 257, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 260, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 261, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 384, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 385, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 388, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 389, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 512, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 513, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 516, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 517, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 640, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 641, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 644, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 645, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 768, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 769, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 772, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 773, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 896, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 897, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 900, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 901, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; // When (whatToShow & NodeFilter.SHOW_DOCUMENT_FRAGMENT === 1), RootNodeT // must be a DocumentFragment. - createNodeIterator( - root: RootNodeT, - whatToShow: 1024, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 1025, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 1028, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 1029, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 1152, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 1153, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 1156, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 1157, - filter?: NodeFilterInterface - ): NodeIterator; - createTreeWalker( - root: RootNodeT, - whatToShow: 1024, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 1025, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 1028, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 1029, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 1152, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 1153, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 1156, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 1157, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; + createNodeIterator(root: RootNodeT, whatToShow: 1024, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 1025, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 1028, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 1029, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 1152, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 1153, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 1156, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 1157, filter?: NodeFilterInterface): NodeIterator; + createTreeWalker(root: RootNodeT, whatToShow: 1024, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 1025, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 1028, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 1029, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 1152, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 1153, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 1156, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 1157, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; // In the general case, RootNodeT may be any Node and whatToShow may be // NodeFilter.SHOW_ALL or any combination of NodeFilter.SHOW_ELEMENT, // NodeFilter.SHOW_TEXT and/or NodeFilter.SHOW_COMMENT - createNodeIterator( - root: RootNodeT, - whatToShow: 1, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 4, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 5, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 128, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 129, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 132, - filter?: NodeFilterInterface - ): NodeIterator; - createNodeIterator( - root: RootNodeT, - whatToShow: 133, - filter?: NodeFilterInterface - ): NodeIterator; - createTreeWalker( - root: RootNodeT, - whatToShow: 1, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 4, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 5, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 128, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 129, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 132, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; - createTreeWalker( - root: RootNodeT, - whatToShow: 133, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; + createNodeIterator(root: RootNodeT, whatToShow: 1, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 4, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 5, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 128, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 129, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 132, filter?: NodeFilterInterface): NodeIterator; + createNodeIterator(root: RootNodeT, whatToShow: 133, filter?: NodeFilterInterface): NodeIterator; + createTreeWalker(root: RootNodeT, whatToShow: 1, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 4, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 5, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 128, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 129, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 132, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; + createTreeWalker(root: RootNodeT, whatToShow: 133, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; // Catch all for when we don't know the value of `whatToShow` // And for when whatToShow is not provided, it is assumed to be SHOW_ALL - createNodeIterator( - root: RootNodeT, - whatToShow?: number, - filter?: NodeFilterInterface - ): NodeIterator; - createTreeWalker( - root: RootNodeT, - whatToShow?: number, - filter?: NodeFilterInterface, - entityReferenceExpansion?: boolean - ): TreeWalker; + createNodeIterator(root: RootNodeT, whatToShow?: number, filter?: NodeFilterInterface): NodeIterator; + createTreeWalker(root: RootNodeT, whatToShow?: number, filter?: NodeFilterInterface, entityReferenceExpansion?: boolean): TreeWalker; // From NonElementParentNode Mixin. getElementById(elementId: string): HTMLElement | null; @@ -1994,17 +1301,11 @@ declare class Selection { empty(): void; selectAllChildren(parentNode: Node): void; setPosition(aNode: Node | null, offset?: number): void; - setBaseAndExtent( - anchorNode: Node, - anchorOffset: number, - focusNode: Node, - focusOffset: number - ): void; + setBaseAndExtent(anchorNode: Node, anchorOffset: number, focusNode: Node, focusOffset: number): void; toString(): string; } -declare class Range { - // extension +declare class Range { // extension startOffset: number; collapsed: boolean; endOffset: number; @@ -2052,16 +1353,14 @@ declare class DOMTokenList { toggle(token: string, force?: boolean): boolean; replace(oldToken: string, newToken: string): boolean; - forEach( - callbackfn: (value: string, index: number, list: DOMTokenList) => any, - thisArg?: any - ): void; + forEach(callbackfn: (value: string, index: number, list: DOMTokenList) => any, thisArg?: any): void; entries(): Iterator<[number, string]>; keys(): Iterator; values(): Iterator; [index: number]: string; } + declare class Element extends Node mixins mixin$Animatable { assignedSlot: ?HTMLSlotElement; attachShadow(shadowRootInitDict: ShadowRootInit): ShadowRoot; @@ -2101,61 +1400,34 @@ declare class Element extends Node mixins mixin$Animatable { getAttributeNames(): Array; getAttributeNS(namespaceURI: string | null, localName: string): string | null; getAttributeNode(name: string): Attr | null; - getAttributeNodeNS( - namespaceURI: string | null, - localName: string - ): Attr | null; + getAttributeNodeNS(namespaceURI: string | null, localName: string): Attr | null; getBoundingClientRect(): DOMRect; getClientRects(): DOMRectList; getElementsByClassName(names: string): HTMLCollection; - getElementsByTagName>( - qualifiedName: TName - ): HTMLCollection; - getElementsByTagNameNS>( - namespaceURI: 'http://www.w3.org/1999/xhtml', - qualifiedName: TName - ): HTMLCollection; - getElementsByTagNameNS( - namespaceURI: string | null, - qualifiedName: string - ): HTMLCollection; + getElementsByTagName>(qualifiedName: TName): HTMLCollection; + getElementsByTagNameNS>(namespaceURI: 'http://www.w3.org/1999/xhtml', qualifiedName: TName): HTMLCollection; + getElementsByTagNameNS(namespaceURI: string | null, qualifiedName: string): HTMLCollection; hasAttribute(name: string): boolean; hasAttributeNS(namespaceURI: string | null, localName: string): boolean; hasAttributes(): boolean; hasPointerCapture(pointerId: number): boolean; - insertAdjacentElement( - position: 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend', - element: Element - ): void; - insertAdjacentHTML( - position: 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend', - html: string | TrustedHTML - ): void; - insertAdjacentText( - position: 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend', - text: string - ): void; + insertAdjacentElement(position: 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend', element: Element): void; + insertAdjacentHTML(position: 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend', html: string | TrustedHTML): void; + insertAdjacentText(position: 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend', text: string): void; matches(selector: string): boolean; releasePointerCapture(pointerId: number): void; removeAttribute(name?: string): void; removeAttributeNode(attributeNode: Attr): Attr; removeAttributeNS(namespaceURI: string | null, localName: string): void; - requestFullscreen(options?: { - navigationUI: 'auto' | 'show' | 'hide', - ... - }): Promise; + requestFullscreen(options?: { navigationUI: 'auto' | 'show' | 'hide', ... }): Promise; requestPointerLock(): void; - scrollIntoView( - arg?: - | boolean - | { - behavior?: 'auto' | 'instant' | 'smooth', - block?: 'start' | 'center' | 'end' | 'nearest', - inline?: 'start' | 'center' | 'end' | 'nearest', - ... - } - ): void; + scrollIntoView(arg?: (boolean | { + behavior?: ('auto' | 'instant' | 'smooth'), + block?: ('start' | 'center' | 'end' | 'nearest'), + inline?: ('start' | 'center' | 'end' | 'nearest'), + ... + })): void; scroll(x: number, y: number): void; scroll(options: ScrollToOptions): void; scrollTo(x: number, y: number): void; @@ -2164,11 +1436,7 @@ declare class Element extends Node mixins mixin$Animatable { scrollBy(options: ScrollToOptions): void; setAttribute(name?: string, value?: string): void; toggleAttribute(name?: string, force?: boolean): void; - setAttributeNS( - namespaceURI: string | null, - qualifiedName: string, - value: string - ): void; + setAttributeNS(namespaceURI: string | null, qualifiedName: string, value: string): void; setAttributeNode(newAttr: Attr): Attr | null; setAttributeNodeNS(newAttr: Attr): Attr | null; setPointerCapture(pointerId: number): void; @@ -2183,12 +1451,8 @@ declare class Element extends Node mixins mixin$Animatable { append(...nodes: Array): void; prepend(...nodes: Array): void; - querySelector>( - selector: TSelector - ): HTMLElementTagNameMap[TSelector] | null; - querySelectorAll>( - selector: TSelector - ): NodeList; + querySelector>(selector: TSelector): HTMLElementTagNameMap[TSelector] | null; + querySelectorAll>(selector: TSelector): NodeList; // from ChildNode interface after(...nodes: Array): void; @@ -2198,15 +1462,15 @@ declare class Element extends Node mixins mixin$Animatable { } declare class HitRegionOptions { - path?: Path2D; - fillRule?: CanvasFillRule; - id?: string; + path?: Path2D, + fillRule?: CanvasFillRule, + id?: string, parentID?: string; cursor?: string; control?: Element; label: ?string; role: ?string; -} +}; declare class SVGMatrix { getComponent(index: number): number; @@ -2215,657 +1479,667 @@ declare class SVGMatrix { mTranslate(x: number, y: number): SVGMatrix; mScale(scaleFactor: number): SVGMatrix; mRotate(angle: number): SVGMatrix; -} +}; // WebGL idl: https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl type WebGLContextAttributes = { - alpha: boolean, - depth: boolean, - stencil: boolean, - antialias: boolean, - premultipliedAlpha: boolean, - preserveDrawingBuffer: boolean, - preferLowPowerToHighPerformance: boolean, - failIfMajorPerformanceCaveat: boolean, - ... + alpha: boolean, + depth: boolean, + stencil: boolean, + antialias: boolean, + premultipliedAlpha: boolean, + preserveDrawingBuffer: boolean, + preferLowPowerToHighPerformance: boolean, + failIfMajorPerformanceCaveat: boolean, + ... }; -interface WebGLObject {} +interface WebGLObject { +}; -interface WebGLBuffer extends WebGLObject {} +interface WebGLBuffer extends WebGLObject { +}; -interface WebGLFramebuffer extends WebGLObject {} +interface WebGLFramebuffer extends WebGLObject { +}; -interface WebGLProgram extends WebGLObject {} +interface WebGLProgram extends WebGLObject { +}; -interface WebGLRenderbuffer extends WebGLObject {} +interface WebGLRenderbuffer extends WebGLObject { +}; -interface WebGLShader extends WebGLObject {} +interface WebGLShader extends WebGLObject { +}; -interface WebGLTexture extends WebGLObject {} +interface WebGLTexture extends WebGLObject { +}; -interface WebGLUniformLocation {} +interface WebGLUniformLocation { +}; interface WebGLActiveInfo { - size: number; - type: number; - name: string; -} + size: number; + type: number; + name: string; +}; interface WebGLShaderPrecisionFormat { rangeMin: number; rangeMax: number; precision: number; -} +}; type BufferDataSource = ArrayBuffer | $ArrayBufferView; type TexImageSource = - | ImageBitmap - | ImageData - | HTMLImageElement - | HTMLCanvasElement - | HTMLVideoElement; + ImageBitmap | + ImageData | + HTMLImageElement | + HTMLCanvasElement | + HTMLVideoElement; -type VertexAttribFVSource = Float32Array | Array; +type VertexAttribFVSource = + Float32Array | + Array; /* flow */ declare class WebGLRenderingContext { - static DEPTH_BUFFER_BIT: 0x00000100; - DEPTH_BUFFER_BIT: 0x00000100; - static STENCIL_BUFFER_BIT: 0x00000400; - STENCIL_BUFFER_BIT: 0x00000400; - static COLOR_BUFFER_BIT: 0x00004000; - COLOR_BUFFER_BIT: 0x00004000; - static POINTS: 0x0000; - POINTS: 0x0000; - static LINES: 0x0001; - LINES: 0x0001; - static LINE_LOOP: 0x0002; - LINE_LOOP: 0x0002; - static LINE_STRIP: 0x0003; - LINE_STRIP: 0x0003; - static TRIANGLES: 0x0004; - TRIANGLES: 0x0004; - static TRIANGLE_STRIP: 0x0005; - TRIANGLE_STRIP: 0x0005; - static TRIANGLE_FAN: 0x0006; - TRIANGLE_FAN: 0x0006; - static ZERO: 0; - ZERO: 0; - static ONE: 1; - ONE: 1; - static SRC_COLOR: 0x0300; - SRC_COLOR: 0x0300; - static ONE_MINUS_SRC_COLOR: 0x0301; - ONE_MINUS_SRC_COLOR: 0x0301; - static SRC_ALPHA: 0x0302; - SRC_ALPHA: 0x0302; - static ONE_MINUS_SRC_ALPHA: 0x0303; - ONE_MINUS_SRC_ALPHA: 0x0303; - static DST_ALPHA: 0x0304; - DST_ALPHA: 0x0304; - static ONE_MINUS_DST_ALPHA: 0x0305; - ONE_MINUS_DST_ALPHA: 0x0305; - static DST_COLOR: 0x0306; - DST_COLOR: 0x0306; - static ONE_MINUS_DST_COLOR: 0x0307; - ONE_MINUS_DST_COLOR: 0x0307; - static SRC_ALPHA_SATURATE: 0x0308; - SRC_ALPHA_SATURATE: 0x0308; - static FUNC_ADD: 0x8006; - FUNC_ADD: 0x8006; - static BLEND_EQUATION: 0x8009; - BLEND_EQUATION: 0x8009; - static BLEND_EQUATION_RGB: 0x8009; - BLEND_EQUATION_RGB: 0x8009; - static BLEND_EQUATION_ALPHA: 0x883d; - BLEND_EQUATION_ALPHA: 0x883d; - static FUNC_SUBTRACT: 0x800a; - FUNC_SUBTRACT: 0x800a; - static FUNC_REVERSE_SUBTRACT: 0x800b; - FUNC_REVERSE_SUBTRACT: 0x800b; - static BLEND_DST_RGB: 0x80c8; - BLEND_DST_RGB: 0x80c8; - static BLEND_SRC_RGB: 0x80c9; - BLEND_SRC_RGB: 0x80c9; - static BLEND_DST_ALPHA: 0x80ca; - BLEND_DST_ALPHA: 0x80ca; - static BLEND_SRC_ALPHA: 0x80cb; - BLEND_SRC_ALPHA: 0x80cb; - static CONSTANT_COLOR: 0x8001; - CONSTANT_COLOR: 0x8001; - static ONE_MINUS_CONSTANT_COLOR: 0x8002; - ONE_MINUS_CONSTANT_COLOR: 0x8002; - static CONSTANT_ALPHA: 0x8003; - CONSTANT_ALPHA: 0x8003; - static ONE_MINUS_CONSTANT_ALPHA: 0x8004; - ONE_MINUS_CONSTANT_ALPHA: 0x8004; - static BLEND_COLOR: 0x8005; - BLEND_COLOR: 0x8005; - static ARRAY_BUFFER: 0x8892; - ARRAY_BUFFER: 0x8892; - static ELEMENT_ARRAY_BUFFER: 0x8893; - ELEMENT_ARRAY_BUFFER: 0x8893; - static ARRAY_BUFFER_BINDING: 0x8894; - ARRAY_BUFFER_BINDING: 0x8894; - static ELEMENT_ARRAY_BUFFER_BINDING: 0x8895; - ELEMENT_ARRAY_BUFFER_BINDING: 0x8895; - static STREAM_DRAW: 0x88e0; - STREAM_DRAW: 0x88e0; - static STATIC_DRAW: 0x88e4; - STATIC_DRAW: 0x88e4; - static DYNAMIC_DRAW: 0x88e8; - DYNAMIC_DRAW: 0x88e8; - static BUFFER_SIZE: 0x8764; - BUFFER_SIZE: 0x8764; - static BUFFER_USAGE: 0x8765; - BUFFER_USAGE: 0x8765; - static CURRENT_VERTEX_ATTRIB: 0x8626; - CURRENT_VERTEX_ATTRIB: 0x8626; - static FRONT: 0x0404; - FRONT: 0x0404; - static BACK: 0x0405; - BACK: 0x0405; - static FRONT_AND_BACK: 0x0408; - FRONT_AND_BACK: 0x0408; - static CULL_FACE: 0x0b44; - CULL_FACE: 0x0b44; - static BLEND: 0x0be2; - BLEND: 0x0be2; - static DITHER: 0x0bd0; - DITHER: 0x0bd0; - static STENCIL_TEST: 0x0b90; - STENCIL_TEST: 0x0b90; - static DEPTH_TEST: 0x0b71; - DEPTH_TEST: 0x0b71; - static SCISSOR_TEST: 0x0c11; - SCISSOR_TEST: 0x0c11; - static POLYGON_OFFSET_FILL: 0x8037; - POLYGON_OFFSET_FILL: 0x8037; - static SAMPLE_ALPHA_TO_COVERAGE: 0x809e; - SAMPLE_ALPHA_TO_COVERAGE: 0x809e; - static SAMPLE_COVERAGE: 0x80a0; - SAMPLE_COVERAGE: 0x80a0; - static NO_ERROR: 0; - NO_ERROR: 0; - static INVALID_ENUM: 0x0500; - INVALID_ENUM: 0x0500; - static INVALID_VALUE: 0x0501; - INVALID_VALUE: 0x0501; - static INVALID_OPERATION: 0x0502; - INVALID_OPERATION: 0x0502; - static OUT_OF_MEMORY: 0x0505; - OUT_OF_MEMORY: 0x0505; - static CW: 0x0900; - CW: 0x0900; - static CCW: 0x0901; - CCW: 0x0901; - static LINE_WIDTH: 0x0b21; - LINE_WIDTH: 0x0b21; - static ALIASED_POINT_SIZE_RANGE: 0x846d; - ALIASED_POINT_SIZE_RANGE: 0x846d; - static ALIASED_LINE_WIDTH_RANGE: 0x846e; - ALIASED_LINE_WIDTH_RANGE: 0x846e; - static CULL_FACE_MODE: 0x0b45; - CULL_FACE_MODE: 0x0b45; - static FRONT_FACE: 0x0b46; - FRONT_FACE: 0x0b46; - static DEPTH_RANGE: 0x0b70; - DEPTH_RANGE: 0x0b70; - static DEPTH_WRITEMASK: 0x0b72; - DEPTH_WRITEMASK: 0x0b72; - static DEPTH_CLEAR_VALUE: 0x0b73; - DEPTH_CLEAR_VALUE: 0x0b73; - static DEPTH_FUNC: 0x0b74; - DEPTH_FUNC: 0x0b74; - static STENCIL_CLEAR_VALUE: 0x0b91; - STENCIL_CLEAR_VALUE: 0x0b91; - static STENCIL_FUNC: 0x0b92; - STENCIL_FUNC: 0x0b92; - static STENCIL_FAIL: 0x0b94; - STENCIL_FAIL: 0x0b94; - static STENCIL_PASS_DEPTH_FAIL: 0x0b95; - STENCIL_PASS_DEPTH_FAIL: 0x0b95; - static STENCIL_PASS_DEPTH_PASS: 0x0b96; - STENCIL_PASS_DEPTH_PASS: 0x0b96; - static STENCIL_REF: 0x0b97; - STENCIL_REF: 0x0b97; - static STENCIL_VALUE_MASK: 0x0b93; - STENCIL_VALUE_MASK: 0x0b93; - static STENCIL_WRITEMASK: 0x0b98; - STENCIL_WRITEMASK: 0x0b98; - static STENCIL_BACK_FUNC: 0x8800; - STENCIL_BACK_FUNC: 0x8800; - static STENCIL_BACK_FAIL: 0x8801; - STENCIL_BACK_FAIL: 0x8801; - static STENCIL_BACK_PASS_DEPTH_FAIL: 0x8802; - STENCIL_BACK_PASS_DEPTH_FAIL: 0x8802; - static STENCIL_BACK_PASS_DEPTH_PASS: 0x8803; - STENCIL_BACK_PASS_DEPTH_PASS: 0x8803; - static STENCIL_BACK_REF: 0x8ca3; - STENCIL_BACK_REF: 0x8ca3; - static STENCIL_BACK_VALUE_MASK: 0x8ca4; - STENCIL_BACK_VALUE_MASK: 0x8ca4; - static STENCIL_BACK_WRITEMASK: 0x8ca5; - STENCIL_BACK_WRITEMASK: 0x8ca5; - static VIEWPORT: 0x0ba2; - VIEWPORT: 0x0ba2; - static SCISSOR_BOX: 0x0c10; - SCISSOR_BOX: 0x0c10; - static COLOR_CLEAR_VALUE: 0x0c22; - COLOR_CLEAR_VALUE: 0x0c22; - static COLOR_WRITEMASK: 0x0c23; - COLOR_WRITEMASK: 0x0c23; - static UNPACK_ALIGNMENT: 0x0cf5; - UNPACK_ALIGNMENT: 0x0cf5; - static PACK_ALIGNMENT: 0x0d05; - PACK_ALIGNMENT: 0x0d05; - static MAX_TEXTURE_SIZE: 0x0d33; - MAX_TEXTURE_SIZE: 0x0d33; - static MAX_VIEWPORT_DIMS: 0x0d3a; - MAX_VIEWPORT_DIMS: 0x0d3a; - static SUBPIXEL_BITS: 0x0d50; - SUBPIXEL_BITS: 0x0d50; - static RED_BITS: 0x0d52; - RED_BITS: 0x0d52; - static GREEN_BITS: 0x0d53; - GREEN_BITS: 0x0d53; - static BLUE_BITS: 0x0d54; - BLUE_BITS: 0x0d54; - static ALPHA_BITS: 0x0d55; - ALPHA_BITS: 0x0d55; - static DEPTH_BITS: 0x0d56; - DEPTH_BITS: 0x0d56; - static STENCIL_BITS: 0x0d57; - STENCIL_BITS: 0x0d57; - static POLYGON_OFFSET_UNITS: 0x2a00; - POLYGON_OFFSET_UNITS: 0x2a00; - static POLYGON_OFFSET_FACTOR: 0x8038; - POLYGON_OFFSET_FACTOR: 0x8038; - static TEXTURE_BINDING_2D: 0x8069; - TEXTURE_BINDING_2D: 0x8069; - static SAMPLE_BUFFERS: 0x80a8; - SAMPLE_BUFFERS: 0x80a8; - static SAMPLES: 0x80a9; - SAMPLES: 0x80a9; - static SAMPLE_COVERAGE_VALUE: 0x80aa; - SAMPLE_COVERAGE_VALUE: 0x80aa; - static SAMPLE_COVERAGE_INVERT: 0x80ab; - SAMPLE_COVERAGE_INVERT: 0x80ab; - static COMPRESSED_TEXTURE_FORMATS: 0x86a3; - COMPRESSED_TEXTURE_FORMATS: 0x86a3; - static DONT_CARE: 0x1100; - DONT_CARE: 0x1100; - static FASTEST: 0x1101; - FASTEST: 0x1101; - static NICEST: 0x1102; - NICEST: 0x1102; - static GENERATE_MIPMAP_HINT: 0x8192; - GENERATE_MIPMAP_HINT: 0x8192; - static BYTE: 0x1400; - BYTE: 0x1400; - static UNSIGNED_BYTE: 0x1401; - UNSIGNED_BYTE: 0x1401; - static SHORT: 0x1402; - SHORT: 0x1402; - static UNSIGNED_SHORT: 0x1403; - UNSIGNED_SHORT: 0x1403; - static INT: 0x1404; - INT: 0x1404; - static UNSIGNED_INT: 0x1405; - UNSIGNED_INT: 0x1405; - static FLOAT: 0x1406; - FLOAT: 0x1406; - static DEPTH_COMPONENT: 0x1902; - DEPTH_COMPONENT: 0x1902; - static ALPHA: 0x1906; - ALPHA: 0x1906; - static RGB: 0x1907; - RGB: 0x1907; - static RGBA: 0x1908; - RGBA: 0x1908; - static LUMINANCE: 0x1909; - LUMINANCE: 0x1909; - static LUMINANCE_ALPHA: 0x190a; - LUMINANCE_ALPHA: 0x190a; - static UNSIGNED_SHORT_4_4_4_4: 0x8033; - UNSIGNED_SHORT_4_4_4_4: 0x8033; - static UNSIGNED_SHORT_5_5_5_1: 0x8034; - UNSIGNED_SHORT_5_5_5_1: 0x8034; - static UNSIGNED_SHORT_5_6_5: 0x8363; - UNSIGNED_SHORT_5_6_5: 0x8363; - static FRAGMENT_SHADER: 0x8b30; - FRAGMENT_SHADER: 0x8b30; - static VERTEX_SHADER: 0x8b31; - VERTEX_SHADER: 0x8b31; - static MAX_VERTEX_ATTRIBS: 0x8869; - MAX_VERTEX_ATTRIBS: 0x8869; - static MAX_VERTEX_UNIFORM_VECTORS: 0x8dfb; - MAX_VERTEX_UNIFORM_VECTORS: 0x8dfb; - static MAX_VARYING_VECTORS: 0x8dfc; - MAX_VARYING_VECTORS: 0x8dfc; - static MAX_COMBINED_TEXTURE_IMAGE_UNITS: 0x8b4d; - MAX_COMBINED_TEXTURE_IMAGE_UNITS: 0x8b4d; - static MAX_VERTEX_TEXTURE_IMAGE_UNITS: 0x8b4c; - MAX_VERTEX_TEXTURE_IMAGE_UNITS: 0x8b4c; - static MAX_TEXTURE_IMAGE_UNITS: 0x8872; - MAX_TEXTURE_IMAGE_UNITS: 0x8872; - static MAX_FRAGMENT_UNIFORM_VECTORS: 0x8dfd; - MAX_FRAGMENT_UNIFORM_VECTORS: 0x8dfd; - static SHADER_TYPE: 0x8b4f; - SHADER_TYPE: 0x8b4f; - static DELETE_STATUS: 0x8b80; - DELETE_STATUS: 0x8b80; - static LINK_STATUS: 0x8b82; - LINK_STATUS: 0x8b82; - static VALIDATE_STATUS: 0x8b83; - VALIDATE_STATUS: 0x8b83; - static ATTACHED_SHADERS: 0x8b85; - ATTACHED_SHADERS: 0x8b85; - static ACTIVE_UNIFORMS: 0x8b86; - ACTIVE_UNIFORMS: 0x8b86; - static ACTIVE_ATTRIBUTES: 0x8b89; - ACTIVE_ATTRIBUTES: 0x8b89; - static SHADING_LANGUAGE_VERSION: 0x8b8c; - SHADING_LANGUAGE_VERSION: 0x8b8c; - static CURRENT_PROGRAM: 0x8b8d; - CURRENT_PROGRAM: 0x8b8d; - static NEVER: 0x0200; - NEVER: 0x0200; - static LESS: 0x0201; - LESS: 0x0201; - static EQUAL: 0x0202; - EQUAL: 0x0202; - static LEQUAL: 0x0203; - LEQUAL: 0x0203; - static GREATER: 0x0204; - GREATER: 0x0204; - static NOTEQUAL: 0x0205; - NOTEQUAL: 0x0205; - static GEQUAL: 0x0206; - GEQUAL: 0x0206; - static ALWAYS: 0x0207; - ALWAYS: 0x0207; - static KEEP: 0x1e00; - KEEP: 0x1e00; - static REPLACE: 0x1e01; - REPLACE: 0x1e01; - static INCR: 0x1e02; - INCR: 0x1e02; - static DECR: 0x1e03; - DECR: 0x1e03; - static INVERT: 0x150a; - INVERT: 0x150a; - static INCR_WRAP: 0x8507; - INCR_WRAP: 0x8507; - static DECR_WRAP: 0x8508; - DECR_WRAP: 0x8508; - static VENDOR: 0x1f00; - VENDOR: 0x1f00; - static RENDERER: 0x1f01; - RENDERER: 0x1f01; - static VERSION: 0x1f02; - VERSION: 0x1f02; - static NEAREST: 0x2600; - NEAREST: 0x2600; - static LINEAR: 0x2601; - LINEAR: 0x2601; - static NEAREST_MIPMAP_NEAREST: 0x2700; - NEAREST_MIPMAP_NEAREST: 0x2700; - static LINEAR_MIPMAP_NEAREST: 0x2701; - LINEAR_MIPMAP_NEAREST: 0x2701; - static NEAREST_MIPMAP_LINEAR: 0x2702; - NEAREST_MIPMAP_LINEAR: 0x2702; - static LINEAR_MIPMAP_LINEAR: 0x2703; - LINEAR_MIPMAP_LINEAR: 0x2703; - static TEXTURE_MAG_FILTER: 0x2800; - TEXTURE_MAG_FILTER: 0x2800; - static TEXTURE_MIN_FILTER: 0x2801; - TEXTURE_MIN_FILTER: 0x2801; - static TEXTURE_WRAP_S: 0x2802; - TEXTURE_WRAP_S: 0x2802; - static TEXTURE_WRAP_T: 0x2803; - TEXTURE_WRAP_T: 0x2803; - static TEXTURE_2D: 0x0de1; - TEXTURE_2D: 0x0de1; - static TEXTURE: 0x1702; - TEXTURE: 0x1702; - static TEXTURE_CUBE_MAP: 0x8513; - TEXTURE_CUBE_MAP: 0x8513; - static TEXTURE_BINDING_CUBE_MAP: 0x8514; - TEXTURE_BINDING_CUBE_MAP: 0x8514; - static TEXTURE_CUBE_MAP_POSITIVE_X: 0x8515; - TEXTURE_CUBE_MAP_POSITIVE_X: 0x8515; - static TEXTURE_CUBE_MAP_NEGATIVE_X: 0x8516; - TEXTURE_CUBE_MAP_NEGATIVE_X: 0x8516; - static TEXTURE_CUBE_MAP_POSITIVE_Y: 0x8517; - TEXTURE_CUBE_MAP_POSITIVE_Y: 0x8517; - static TEXTURE_CUBE_MAP_NEGATIVE_Y: 0x8518; - TEXTURE_CUBE_MAP_NEGATIVE_Y: 0x8518; - static TEXTURE_CUBE_MAP_POSITIVE_Z: 0x8519; - TEXTURE_CUBE_MAP_POSITIVE_Z: 0x8519; - static TEXTURE_CUBE_MAP_NEGATIVE_Z: 0x851a; - TEXTURE_CUBE_MAP_NEGATIVE_Z: 0x851a; - static MAX_CUBE_MAP_TEXTURE_SIZE: 0x851c; - MAX_CUBE_MAP_TEXTURE_SIZE: 0x851c; - static TEXTURE0: 0x84c0; - TEXTURE0: 0x84c0; - static TEXTURE1: 0x84c1; - TEXTURE1: 0x84c1; - static TEXTURE2: 0x84c2; - TEXTURE2: 0x84c2; - static TEXTURE3: 0x84c3; - TEXTURE3: 0x84c3; - static TEXTURE4: 0x84c4; - TEXTURE4: 0x84c4; - static TEXTURE5: 0x84c5; - TEXTURE5: 0x84c5; - static TEXTURE6: 0x84c6; - TEXTURE6: 0x84c6; - static TEXTURE7: 0x84c7; - TEXTURE7: 0x84c7; - static TEXTURE8: 0x84c8; - TEXTURE8: 0x84c8; - static TEXTURE9: 0x84c9; - TEXTURE9: 0x84c9; - static TEXTURE10: 0x84ca; - TEXTURE10: 0x84ca; - static TEXTURE11: 0x84cb; - TEXTURE11: 0x84cb; - static TEXTURE12: 0x84cc; - TEXTURE12: 0x84cc; - static TEXTURE13: 0x84cd; - TEXTURE13: 0x84cd; - static TEXTURE14: 0x84ce; - TEXTURE14: 0x84ce; - static TEXTURE15: 0x84cf; - TEXTURE15: 0x84cf; - static TEXTURE16: 0x84d0; - TEXTURE16: 0x84d0; - static TEXTURE17: 0x84d1; - TEXTURE17: 0x84d1; - static TEXTURE18: 0x84d2; - TEXTURE18: 0x84d2; - static TEXTURE19: 0x84d3; - TEXTURE19: 0x84d3; - static TEXTURE20: 0x84d4; - TEXTURE20: 0x84d4; - static TEXTURE21: 0x84d5; - TEXTURE21: 0x84d5; - static TEXTURE22: 0x84d6; - TEXTURE22: 0x84d6; - static TEXTURE23: 0x84d7; - TEXTURE23: 0x84d7; - static TEXTURE24: 0x84d8; - TEXTURE24: 0x84d8; - static TEXTURE25: 0x84d9; - TEXTURE25: 0x84d9; - static TEXTURE26: 0x84da; - TEXTURE26: 0x84da; - static TEXTURE27: 0x84db; - TEXTURE27: 0x84db; - static TEXTURE28: 0x84dc; - TEXTURE28: 0x84dc; - static TEXTURE29: 0x84dd; - TEXTURE29: 0x84dd; - static TEXTURE30: 0x84de; - TEXTURE30: 0x84de; - static TEXTURE31: 0x84df; - TEXTURE31: 0x84df; - static ACTIVE_TEXTURE: 0x84e0; - ACTIVE_TEXTURE: 0x84e0; - static REPEAT: 0x2901; - REPEAT: 0x2901; - static CLAMP_TO_EDGE: 0x812f; - CLAMP_TO_EDGE: 0x812f; - static MIRRORED_REPEAT: 0x8370; - MIRRORED_REPEAT: 0x8370; - static FLOAT_VEC2: 0x8b50; - FLOAT_VEC2: 0x8b50; - static FLOAT_VEC3: 0x8b51; - FLOAT_VEC3: 0x8b51; - static FLOAT_VEC4: 0x8b52; - FLOAT_VEC4: 0x8b52; - static INT_VEC2: 0x8b53; - INT_VEC2: 0x8b53; - static INT_VEC3: 0x8b54; - INT_VEC3: 0x8b54; - static INT_VEC4: 0x8b55; - INT_VEC4: 0x8b55; - static BOOL: 0x8b56; - BOOL: 0x8b56; - static BOOL_VEC2: 0x8b57; - BOOL_VEC2: 0x8b57; - static BOOL_VEC3: 0x8b58; - BOOL_VEC3: 0x8b58; - static BOOL_VEC4: 0x8b59; - BOOL_VEC4: 0x8b59; - static FLOAT_MAT2: 0x8b5a; - FLOAT_MAT2: 0x8b5a; - static FLOAT_MAT3: 0x8b5b; - FLOAT_MAT3: 0x8b5b; - static FLOAT_MAT4: 0x8b5c; - FLOAT_MAT4: 0x8b5c; - static SAMPLER_2D: 0x8b5e; - SAMPLER_2D: 0x8b5e; - static SAMPLER_CUBE: 0x8b60; - SAMPLER_CUBE: 0x8b60; - static VERTEX_ATTRIB_ARRAY_ENABLED: 0x8622; - VERTEX_ATTRIB_ARRAY_ENABLED: 0x8622; - static VERTEX_ATTRIB_ARRAY_SIZE: 0x8623; - VERTEX_ATTRIB_ARRAY_SIZE: 0x8623; - static VERTEX_ATTRIB_ARRAY_STRIDE: 0x8624; - VERTEX_ATTRIB_ARRAY_STRIDE: 0x8624; - static VERTEX_ATTRIB_ARRAY_TYPE: 0x8625; - VERTEX_ATTRIB_ARRAY_TYPE: 0x8625; - static VERTEX_ATTRIB_ARRAY_NORMALIZED: 0x886a; - VERTEX_ATTRIB_ARRAY_NORMALIZED: 0x886a; - static VERTEX_ATTRIB_ARRAY_POINTER: 0x8645; - VERTEX_ATTRIB_ARRAY_POINTER: 0x8645; - static VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: 0x889f; - VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: 0x889f; - static IMPLEMENTATION_COLOR_READ_TYPE: 0x8b9a; - IMPLEMENTATION_COLOR_READ_TYPE: 0x8b9a; - static IMPLEMENTATION_COLOR_READ_FORMAT: 0x8b9b; - IMPLEMENTATION_COLOR_READ_FORMAT: 0x8b9b; - static COMPILE_STATUS: 0x8b81; - COMPILE_STATUS: 0x8b81; - static LOW_FLOAT: 0x8df0; - LOW_FLOAT: 0x8df0; - static MEDIUM_FLOAT: 0x8df1; - MEDIUM_FLOAT: 0x8df1; - static HIGH_FLOAT: 0x8df2; - HIGH_FLOAT: 0x8df2; - static LOW_INT: 0x8df3; - LOW_INT: 0x8df3; - static MEDIUM_INT: 0x8df4; - MEDIUM_INT: 0x8df4; - static HIGH_INT: 0x8df5; - HIGH_INT: 0x8df5; - static FRAMEBUFFER: 0x8d40; - FRAMEBUFFER: 0x8d40; - static RENDERBUFFER: 0x8d41; - RENDERBUFFER: 0x8d41; - static RGBA4: 0x8056; - RGBA4: 0x8056; - static RGB5_A1: 0x8057; - RGB5_A1: 0x8057; - static RGB565: 0x8d62; - RGB565: 0x8d62; - static DEPTH_COMPONENT16: 0x81a5; - DEPTH_COMPONENT16: 0x81a5; - static STENCIL_INDEX: 0x1901; - STENCIL_INDEX: 0x1901; - static STENCIL_INDEX8: 0x8d48; - STENCIL_INDEX8: 0x8d48; - static DEPTH_STENCIL: 0x84f9; - DEPTH_STENCIL: 0x84f9; - static RENDERBUFFER_WIDTH: 0x8d42; - RENDERBUFFER_WIDTH: 0x8d42; - static RENDERBUFFER_HEIGHT: 0x8d43; - RENDERBUFFER_HEIGHT: 0x8d43; - static RENDERBUFFER_INTERNAL_FORMAT: 0x8d44; - RENDERBUFFER_INTERNAL_FORMAT: 0x8d44; - static RENDERBUFFER_RED_SIZE: 0x8d50; - RENDERBUFFER_RED_SIZE: 0x8d50; - static RENDERBUFFER_GREEN_SIZE: 0x8d51; - RENDERBUFFER_GREEN_SIZE: 0x8d51; - static RENDERBUFFER_BLUE_SIZE: 0x8d52; - RENDERBUFFER_BLUE_SIZE: 0x8d52; - static RENDERBUFFER_ALPHA_SIZE: 0x8d53; - RENDERBUFFER_ALPHA_SIZE: 0x8d53; - static RENDERBUFFER_DEPTH_SIZE: 0x8d54; - RENDERBUFFER_DEPTH_SIZE: 0x8d54; - static RENDERBUFFER_STENCIL_SIZE: 0x8d55; - RENDERBUFFER_STENCIL_SIZE: 0x8d55; - static FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 0x8cd0; - FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 0x8cd0; - static FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 0x8cd1; - FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 0x8cd1; - static FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: 0x8cd2; - FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: 0x8cd2; - static FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: 0x8cd3; - FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: 0x8cd3; - static COLOR_ATTACHMENT0: 0x8ce0; - COLOR_ATTACHMENT0: 0x8ce0; - static DEPTH_ATTACHMENT: 0x8d00; - DEPTH_ATTACHMENT: 0x8d00; - static STENCIL_ATTACHMENT: 0x8d20; - STENCIL_ATTACHMENT: 0x8d20; - static DEPTH_STENCIL_ATTACHMENT: 0x821a; - DEPTH_STENCIL_ATTACHMENT: 0x821a; - static NONE: 0; - NONE: 0; - static FRAMEBUFFER_COMPLETE: 0x8cd5; - FRAMEBUFFER_COMPLETE: 0x8cd5; - static FRAMEBUFFER_INCOMPLETE_ATTACHMENT: 0x8cd6; - FRAMEBUFFER_INCOMPLETE_ATTACHMENT: 0x8cd6; - static FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: 0x8cd7; - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: 0x8cd7; - static FRAMEBUFFER_INCOMPLETE_DIMENSIONS: 0x8cd9; - FRAMEBUFFER_INCOMPLETE_DIMENSIONS: 0x8cd9; - static FRAMEBUFFER_UNSUPPORTED: 0x8cdd; - FRAMEBUFFER_UNSUPPORTED: 0x8cdd; - static FRAMEBUFFER_BINDING: 0x8ca6; - FRAMEBUFFER_BINDING: 0x8ca6; - static RENDERBUFFER_BINDING: 0x8ca7; - RENDERBUFFER_BINDING: 0x8ca7; - static MAX_RENDERBUFFER_SIZE: 0x84e8; - MAX_RENDERBUFFER_SIZE: 0x84e8; - static INVALID_FRAMEBUFFER_OPERATION: 0x0506; - INVALID_FRAMEBUFFER_OPERATION: 0x0506; - static UNPACK_FLIP_Y_WEBGL: 0x9240; - UNPACK_FLIP_Y_WEBGL: 0x9240; - static UNPACK_PREMULTIPLY_ALPHA_WEBGL: 0x9241; - UNPACK_PREMULTIPLY_ALPHA_WEBGL: 0x9241; - static CONTEXT_LOST_WEBGL: 0x9242; - CONTEXT_LOST_WEBGL: 0x9242; - static UNPACK_COLORSPACE_CONVERSION_WEBGL: 0x9243; - UNPACK_COLORSPACE_CONVERSION_WEBGL: 0x9243; - static BROWSER_DEFAULT_WEBGL: 0x9244; - BROWSER_DEFAULT_WEBGL: 0x9244; + static DEPTH_BUFFER_BIT : 0x00000100; + DEPTH_BUFFER_BIT : 0x00000100; + static STENCIL_BUFFER_BIT : 0x00000400; + STENCIL_BUFFER_BIT : 0x00000400; + static COLOR_BUFFER_BIT : 0x00004000; + COLOR_BUFFER_BIT : 0x00004000; + static POINTS : 0x0000; + POINTS : 0x0000; + static LINES : 0x0001; + LINES : 0x0001; + static LINE_LOOP : 0x0002; + LINE_LOOP : 0x0002; + static LINE_STRIP : 0x0003; + LINE_STRIP : 0x0003; + static TRIANGLES : 0x0004; + TRIANGLES : 0x0004; + static TRIANGLE_STRIP : 0x0005; + TRIANGLE_STRIP : 0x0005; + static TRIANGLE_FAN : 0x0006; + TRIANGLE_FAN : 0x0006; + static ZERO : 0; + ZERO : 0; + static ONE : 1; + ONE : 1; + static SRC_COLOR : 0x0300; + SRC_COLOR : 0x0300; + static ONE_MINUS_SRC_COLOR : 0x0301; + ONE_MINUS_SRC_COLOR : 0x0301; + static SRC_ALPHA : 0x0302; + SRC_ALPHA : 0x0302; + static ONE_MINUS_SRC_ALPHA : 0x0303; + ONE_MINUS_SRC_ALPHA : 0x0303; + static DST_ALPHA : 0x0304; + DST_ALPHA : 0x0304; + static ONE_MINUS_DST_ALPHA : 0x0305; + ONE_MINUS_DST_ALPHA : 0x0305; + static DST_COLOR : 0x0306; + DST_COLOR : 0x0306; + static ONE_MINUS_DST_COLOR : 0x0307; + ONE_MINUS_DST_COLOR : 0x0307; + static SRC_ALPHA_SATURATE : 0x0308; + SRC_ALPHA_SATURATE : 0x0308; + static FUNC_ADD : 0x8006; + FUNC_ADD : 0x8006; + static BLEND_EQUATION : 0x8009; + BLEND_EQUATION : 0x8009; + static BLEND_EQUATION_RGB : 0x8009; + BLEND_EQUATION_RGB : 0x8009; + static BLEND_EQUATION_ALPHA : 0x883D; + BLEND_EQUATION_ALPHA : 0x883D; + static FUNC_SUBTRACT : 0x800A; + FUNC_SUBTRACT : 0x800A; + static FUNC_REVERSE_SUBTRACT : 0x800B; + FUNC_REVERSE_SUBTRACT : 0x800B; + static BLEND_DST_RGB : 0x80C8; + BLEND_DST_RGB : 0x80C8; + static BLEND_SRC_RGB : 0x80C9; + BLEND_SRC_RGB : 0x80C9; + static BLEND_DST_ALPHA : 0x80CA; + BLEND_DST_ALPHA : 0x80CA; + static BLEND_SRC_ALPHA : 0x80CB; + BLEND_SRC_ALPHA : 0x80CB; + static CONSTANT_COLOR : 0x8001; + CONSTANT_COLOR : 0x8001; + static ONE_MINUS_CONSTANT_COLOR : 0x8002; + ONE_MINUS_CONSTANT_COLOR : 0x8002; + static CONSTANT_ALPHA : 0x8003; + CONSTANT_ALPHA : 0x8003; + static ONE_MINUS_CONSTANT_ALPHA : 0x8004; + ONE_MINUS_CONSTANT_ALPHA : 0x8004; + static BLEND_COLOR : 0x8005; + BLEND_COLOR : 0x8005; + static ARRAY_BUFFER : 0x8892; + ARRAY_BUFFER : 0x8892; + static ELEMENT_ARRAY_BUFFER : 0x8893; + ELEMENT_ARRAY_BUFFER : 0x8893; + static ARRAY_BUFFER_BINDING : 0x8894; + ARRAY_BUFFER_BINDING : 0x8894; + static ELEMENT_ARRAY_BUFFER_BINDING : 0x8895; + ELEMENT_ARRAY_BUFFER_BINDING : 0x8895; + static STREAM_DRAW : 0x88E0; + STREAM_DRAW : 0x88E0; + static STATIC_DRAW : 0x88E4; + STATIC_DRAW : 0x88E4; + static DYNAMIC_DRAW : 0x88E8; + DYNAMIC_DRAW : 0x88E8; + static BUFFER_SIZE : 0x8764; + BUFFER_SIZE : 0x8764; + static BUFFER_USAGE : 0x8765; + BUFFER_USAGE : 0x8765; + static CURRENT_VERTEX_ATTRIB : 0x8626; + CURRENT_VERTEX_ATTRIB : 0x8626; + static FRONT : 0x0404; + FRONT : 0x0404; + static BACK : 0x0405; + BACK : 0x0405; + static FRONT_AND_BACK : 0x0408; + FRONT_AND_BACK : 0x0408; + static CULL_FACE : 0x0B44; + CULL_FACE : 0x0B44; + static BLEND : 0x0BE2; + BLEND : 0x0BE2; + static DITHER : 0x0BD0; + DITHER : 0x0BD0; + static STENCIL_TEST : 0x0B90; + STENCIL_TEST : 0x0B90; + static DEPTH_TEST : 0x0B71; + DEPTH_TEST : 0x0B71; + static SCISSOR_TEST : 0x0C11; + SCISSOR_TEST : 0x0C11; + static POLYGON_OFFSET_FILL : 0x8037; + POLYGON_OFFSET_FILL : 0x8037; + static SAMPLE_ALPHA_TO_COVERAGE : 0x809E; + SAMPLE_ALPHA_TO_COVERAGE : 0x809E; + static SAMPLE_COVERAGE : 0x80A0; + SAMPLE_COVERAGE : 0x80A0; + static NO_ERROR : 0; + NO_ERROR : 0; + static INVALID_ENUM : 0x0500; + INVALID_ENUM : 0x0500; + static INVALID_VALUE : 0x0501; + INVALID_VALUE : 0x0501; + static INVALID_OPERATION : 0x0502; + INVALID_OPERATION : 0x0502; + static OUT_OF_MEMORY : 0x0505; + OUT_OF_MEMORY : 0x0505; + static CW : 0x0900; + CW : 0x0900; + static CCW : 0x0901; + CCW : 0x0901; + static LINE_WIDTH : 0x0B21; + LINE_WIDTH : 0x0B21; + static ALIASED_POINT_SIZE_RANGE : 0x846D; + ALIASED_POINT_SIZE_RANGE : 0x846D; + static ALIASED_LINE_WIDTH_RANGE : 0x846E; + ALIASED_LINE_WIDTH_RANGE : 0x846E; + static CULL_FACE_MODE : 0x0B45; + CULL_FACE_MODE : 0x0B45; + static FRONT_FACE : 0x0B46; + FRONT_FACE : 0x0B46; + static DEPTH_RANGE : 0x0B70; + DEPTH_RANGE : 0x0B70; + static DEPTH_WRITEMASK : 0x0B72; + DEPTH_WRITEMASK : 0x0B72; + static DEPTH_CLEAR_VALUE : 0x0B73; + DEPTH_CLEAR_VALUE : 0x0B73; + static DEPTH_FUNC : 0x0B74; + DEPTH_FUNC : 0x0B74; + static STENCIL_CLEAR_VALUE : 0x0B91; + STENCIL_CLEAR_VALUE : 0x0B91; + static STENCIL_FUNC : 0x0B92; + STENCIL_FUNC : 0x0B92; + static STENCIL_FAIL : 0x0B94; + STENCIL_FAIL : 0x0B94; + static STENCIL_PASS_DEPTH_FAIL : 0x0B95; + STENCIL_PASS_DEPTH_FAIL : 0x0B95; + static STENCIL_PASS_DEPTH_PASS : 0x0B96; + STENCIL_PASS_DEPTH_PASS : 0x0B96; + static STENCIL_REF : 0x0B97; + STENCIL_REF : 0x0B97; + static STENCIL_VALUE_MASK : 0x0B93; + STENCIL_VALUE_MASK : 0x0B93; + static STENCIL_WRITEMASK : 0x0B98; + STENCIL_WRITEMASK : 0x0B98; + static STENCIL_BACK_FUNC : 0x8800; + STENCIL_BACK_FUNC : 0x8800; + static STENCIL_BACK_FAIL : 0x8801; + STENCIL_BACK_FAIL : 0x8801; + static STENCIL_BACK_PASS_DEPTH_FAIL : 0x8802; + STENCIL_BACK_PASS_DEPTH_FAIL : 0x8802; + static STENCIL_BACK_PASS_DEPTH_PASS : 0x8803; + STENCIL_BACK_PASS_DEPTH_PASS : 0x8803; + static STENCIL_BACK_REF : 0x8CA3; + STENCIL_BACK_REF : 0x8CA3; + static STENCIL_BACK_VALUE_MASK : 0x8CA4; + STENCIL_BACK_VALUE_MASK : 0x8CA4; + static STENCIL_BACK_WRITEMASK : 0x8CA5; + STENCIL_BACK_WRITEMASK : 0x8CA5; + static VIEWPORT : 0x0BA2; + VIEWPORT : 0x0BA2; + static SCISSOR_BOX : 0x0C10; + SCISSOR_BOX : 0x0C10; + static COLOR_CLEAR_VALUE : 0x0C22; + COLOR_CLEAR_VALUE : 0x0C22; + static COLOR_WRITEMASK : 0x0C23; + COLOR_WRITEMASK : 0x0C23; + static UNPACK_ALIGNMENT : 0x0CF5; + UNPACK_ALIGNMENT : 0x0CF5; + static PACK_ALIGNMENT : 0x0D05; + PACK_ALIGNMENT : 0x0D05; + static MAX_TEXTURE_SIZE : 0x0D33; + MAX_TEXTURE_SIZE : 0x0D33; + static MAX_VIEWPORT_DIMS : 0x0D3A; + MAX_VIEWPORT_DIMS : 0x0D3A; + static SUBPIXEL_BITS : 0x0D50; + SUBPIXEL_BITS : 0x0D50; + static RED_BITS : 0x0D52; + RED_BITS : 0x0D52; + static GREEN_BITS : 0x0D53; + GREEN_BITS : 0x0D53; + static BLUE_BITS : 0x0D54; + BLUE_BITS : 0x0D54; + static ALPHA_BITS : 0x0D55; + ALPHA_BITS : 0x0D55; + static DEPTH_BITS : 0x0D56; + DEPTH_BITS : 0x0D56; + static STENCIL_BITS : 0x0D57; + STENCIL_BITS : 0x0D57; + static POLYGON_OFFSET_UNITS : 0x2A00; + POLYGON_OFFSET_UNITS : 0x2A00; + static POLYGON_OFFSET_FACTOR : 0x8038; + POLYGON_OFFSET_FACTOR : 0x8038; + static TEXTURE_BINDING_2D : 0x8069; + TEXTURE_BINDING_2D : 0x8069; + static SAMPLE_BUFFERS : 0x80A8; + SAMPLE_BUFFERS : 0x80A8; + static SAMPLES : 0x80A9; + SAMPLES : 0x80A9; + static SAMPLE_COVERAGE_VALUE : 0x80AA; + SAMPLE_COVERAGE_VALUE : 0x80AA; + static SAMPLE_COVERAGE_INVERT : 0x80AB; + SAMPLE_COVERAGE_INVERT : 0x80AB; + static COMPRESSED_TEXTURE_FORMATS : 0x86A3; + COMPRESSED_TEXTURE_FORMATS : 0x86A3; + static DONT_CARE : 0x1100; + DONT_CARE : 0x1100; + static FASTEST : 0x1101; + FASTEST : 0x1101; + static NICEST : 0x1102; + NICEST : 0x1102; + static GENERATE_MIPMAP_HINT : 0x8192; + GENERATE_MIPMAP_HINT : 0x8192; + static BYTE : 0x1400; + BYTE : 0x1400; + static UNSIGNED_BYTE : 0x1401; + UNSIGNED_BYTE : 0x1401; + static SHORT : 0x1402; + SHORT : 0x1402; + static UNSIGNED_SHORT : 0x1403; + UNSIGNED_SHORT : 0x1403; + static INT : 0x1404; + INT : 0x1404; + static UNSIGNED_INT : 0x1405; + UNSIGNED_INT : 0x1405; + static FLOAT : 0x1406; + FLOAT : 0x1406; + static DEPTH_COMPONENT : 0x1902; + DEPTH_COMPONENT : 0x1902; + static ALPHA : 0x1906; + ALPHA : 0x1906; + static RGB : 0x1907; + RGB : 0x1907; + static RGBA : 0x1908; + RGBA : 0x1908; + static LUMINANCE : 0x1909; + LUMINANCE : 0x1909; + static LUMINANCE_ALPHA : 0x190A; + LUMINANCE_ALPHA : 0x190A; + static UNSIGNED_SHORT_4_4_4_4 : 0x8033; + UNSIGNED_SHORT_4_4_4_4 : 0x8033; + static UNSIGNED_SHORT_5_5_5_1 : 0x8034; + UNSIGNED_SHORT_5_5_5_1 : 0x8034; + static UNSIGNED_SHORT_5_6_5 : 0x8363; + UNSIGNED_SHORT_5_6_5 : 0x8363; + static FRAGMENT_SHADER : 0x8B30; + FRAGMENT_SHADER : 0x8B30; + static VERTEX_SHADER : 0x8B31; + VERTEX_SHADER : 0x8B31; + static MAX_VERTEX_ATTRIBS : 0x8869; + MAX_VERTEX_ATTRIBS : 0x8869; + static MAX_VERTEX_UNIFORM_VECTORS : 0x8DFB; + MAX_VERTEX_UNIFORM_VECTORS : 0x8DFB; + static MAX_VARYING_VECTORS : 0x8DFC; + MAX_VARYING_VECTORS : 0x8DFC; + static MAX_COMBINED_TEXTURE_IMAGE_UNITS : 0x8B4D; + MAX_COMBINED_TEXTURE_IMAGE_UNITS : 0x8B4D; + static MAX_VERTEX_TEXTURE_IMAGE_UNITS : 0x8B4C; + MAX_VERTEX_TEXTURE_IMAGE_UNITS : 0x8B4C; + static MAX_TEXTURE_IMAGE_UNITS : 0x8872; + MAX_TEXTURE_IMAGE_UNITS : 0x8872; + static MAX_FRAGMENT_UNIFORM_VECTORS : 0x8DFD; + MAX_FRAGMENT_UNIFORM_VECTORS : 0x8DFD; + static SHADER_TYPE : 0x8B4F; + SHADER_TYPE : 0x8B4F; + static DELETE_STATUS : 0x8B80; + DELETE_STATUS : 0x8B80; + static LINK_STATUS : 0x8B82; + LINK_STATUS : 0x8B82; + static VALIDATE_STATUS : 0x8B83; + VALIDATE_STATUS : 0x8B83; + static ATTACHED_SHADERS : 0x8B85; + ATTACHED_SHADERS : 0x8B85; + static ACTIVE_UNIFORMS : 0x8B86; + ACTIVE_UNIFORMS : 0x8B86; + static ACTIVE_ATTRIBUTES : 0x8B89; + ACTIVE_ATTRIBUTES : 0x8B89; + static SHADING_LANGUAGE_VERSION : 0x8B8C; + SHADING_LANGUAGE_VERSION : 0x8B8C; + static CURRENT_PROGRAM : 0x8B8D; + CURRENT_PROGRAM : 0x8B8D; + static NEVER : 0x0200; + NEVER : 0x0200; + static LESS : 0x0201; + LESS : 0x0201; + static EQUAL : 0x0202; + EQUAL : 0x0202; + static LEQUAL : 0x0203; + LEQUAL : 0x0203; + static GREATER : 0x0204; + GREATER : 0x0204; + static NOTEQUAL : 0x0205; + NOTEQUAL : 0x0205; + static GEQUAL : 0x0206; + GEQUAL : 0x0206; + static ALWAYS : 0x0207; + ALWAYS : 0x0207; + static KEEP : 0x1E00; + KEEP : 0x1E00; + static REPLACE : 0x1E01; + REPLACE : 0x1E01; + static INCR : 0x1E02; + INCR : 0x1E02; + static DECR : 0x1E03; + DECR : 0x1E03; + static INVERT : 0x150A; + INVERT : 0x150A; + static INCR_WRAP : 0x8507; + INCR_WRAP : 0x8507; + static DECR_WRAP : 0x8508; + DECR_WRAP : 0x8508; + static VENDOR : 0x1F00; + VENDOR : 0x1F00; + static RENDERER : 0x1F01; + RENDERER : 0x1F01; + static VERSION : 0x1F02; + VERSION : 0x1F02; + static NEAREST : 0x2600; + NEAREST : 0x2600; + static LINEAR : 0x2601; + LINEAR : 0x2601; + static NEAREST_MIPMAP_NEAREST : 0x2700; + NEAREST_MIPMAP_NEAREST : 0x2700; + static LINEAR_MIPMAP_NEAREST : 0x2701; + LINEAR_MIPMAP_NEAREST : 0x2701; + static NEAREST_MIPMAP_LINEAR : 0x2702; + NEAREST_MIPMAP_LINEAR : 0x2702; + static LINEAR_MIPMAP_LINEAR : 0x2703; + LINEAR_MIPMAP_LINEAR : 0x2703; + static TEXTURE_MAG_FILTER : 0x2800; + TEXTURE_MAG_FILTER : 0x2800; + static TEXTURE_MIN_FILTER : 0x2801; + TEXTURE_MIN_FILTER : 0x2801; + static TEXTURE_WRAP_S : 0x2802; + TEXTURE_WRAP_S : 0x2802; + static TEXTURE_WRAP_T : 0x2803; + TEXTURE_WRAP_T : 0x2803; + static TEXTURE_2D : 0x0DE1; + TEXTURE_2D : 0x0DE1; + static TEXTURE : 0x1702; + TEXTURE : 0x1702; + static TEXTURE_CUBE_MAP : 0x8513; + TEXTURE_CUBE_MAP : 0x8513; + static TEXTURE_BINDING_CUBE_MAP : 0x8514; + TEXTURE_BINDING_CUBE_MAP : 0x8514; + static TEXTURE_CUBE_MAP_POSITIVE_X : 0x8515; + TEXTURE_CUBE_MAP_POSITIVE_X : 0x8515; + static TEXTURE_CUBE_MAP_NEGATIVE_X : 0x8516; + TEXTURE_CUBE_MAP_NEGATIVE_X : 0x8516; + static TEXTURE_CUBE_MAP_POSITIVE_Y : 0x8517; + TEXTURE_CUBE_MAP_POSITIVE_Y : 0x8517; + static TEXTURE_CUBE_MAP_NEGATIVE_Y : 0x8518; + TEXTURE_CUBE_MAP_NEGATIVE_Y : 0x8518; + static TEXTURE_CUBE_MAP_POSITIVE_Z : 0x8519; + TEXTURE_CUBE_MAP_POSITIVE_Z : 0x8519; + static TEXTURE_CUBE_MAP_NEGATIVE_Z : 0x851A; + TEXTURE_CUBE_MAP_NEGATIVE_Z : 0x851A; + static MAX_CUBE_MAP_TEXTURE_SIZE : 0x851C; + MAX_CUBE_MAP_TEXTURE_SIZE : 0x851C; + static TEXTURE0 : 0x84C0; + TEXTURE0 : 0x84C0; + static TEXTURE1 : 0x84C1; + TEXTURE1 : 0x84C1; + static TEXTURE2 : 0x84C2; + TEXTURE2 : 0x84C2; + static TEXTURE3 : 0x84C3; + TEXTURE3 : 0x84C3; + static TEXTURE4 : 0x84C4; + TEXTURE4 : 0x84C4; + static TEXTURE5 : 0x84C5; + TEXTURE5 : 0x84C5; + static TEXTURE6 : 0x84C6; + TEXTURE6 : 0x84C6; + static TEXTURE7 : 0x84C7; + TEXTURE7 : 0x84C7; + static TEXTURE8 : 0x84C8; + TEXTURE8 : 0x84C8; + static TEXTURE9 : 0x84C9; + TEXTURE9 : 0x84C9; + static TEXTURE10 : 0x84CA; + TEXTURE10 : 0x84CA; + static TEXTURE11 : 0x84CB; + TEXTURE11 : 0x84CB; + static TEXTURE12 : 0x84CC; + TEXTURE12 : 0x84CC; + static TEXTURE13 : 0x84CD; + TEXTURE13 : 0x84CD; + static TEXTURE14 : 0x84CE; + TEXTURE14 : 0x84CE; + static TEXTURE15 : 0x84CF; + TEXTURE15 : 0x84CF; + static TEXTURE16 : 0x84D0; + TEXTURE16 : 0x84D0; + static TEXTURE17 : 0x84D1; + TEXTURE17 : 0x84D1; + static TEXTURE18 : 0x84D2; + TEXTURE18 : 0x84D2; + static TEXTURE19 : 0x84D3; + TEXTURE19 : 0x84D3; + static TEXTURE20 : 0x84D4; + TEXTURE20 : 0x84D4; + static TEXTURE21 : 0x84D5; + TEXTURE21 : 0x84D5; + static TEXTURE22 : 0x84D6; + TEXTURE22 : 0x84D6; + static TEXTURE23 : 0x84D7; + TEXTURE23 : 0x84D7; + static TEXTURE24 : 0x84D8; + TEXTURE24 : 0x84D8; + static TEXTURE25 : 0x84D9; + TEXTURE25 : 0x84D9; + static TEXTURE26 : 0x84DA; + TEXTURE26 : 0x84DA; + static TEXTURE27 : 0x84DB; + TEXTURE27 : 0x84DB; + static TEXTURE28 : 0x84DC; + TEXTURE28 : 0x84DC; + static TEXTURE29 : 0x84DD; + TEXTURE29 : 0x84DD; + static TEXTURE30 : 0x84DE; + TEXTURE30 : 0x84DE; + static TEXTURE31 : 0x84DF; + TEXTURE31 : 0x84DF; + static ACTIVE_TEXTURE : 0x84E0; + ACTIVE_TEXTURE : 0x84E0; + static REPEAT : 0x2901; + REPEAT : 0x2901; + static CLAMP_TO_EDGE : 0x812F; + CLAMP_TO_EDGE : 0x812F; + static MIRRORED_REPEAT : 0x8370; + MIRRORED_REPEAT : 0x8370; + static FLOAT_VEC2 : 0x8B50; + FLOAT_VEC2 : 0x8B50; + static FLOAT_VEC3 : 0x8B51; + FLOAT_VEC3 : 0x8B51; + static FLOAT_VEC4 : 0x8B52; + FLOAT_VEC4 : 0x8B52; + static INT_VEC2 : 0x8B53; + INT_VEC2 : 0x8B53; + static INT_VEC3 : 0x8B54; + INT_VEC3 : 0x8B54; + static INT_VEC4 : 0x8B55; + INT_VEC4 : 0x8B55; + static BOOL : 0x8B56; + BOOL : 0x8B56; + static BOOL_VEC2 : 0x8B57; + BOOL_VEC2 : 0x8B57; + static BOOL_VEC3 : 0x8B58; + BOOL_VEC3 : 0x8B58; + static BOOL_VEC4 : 0x8B59; + BOOL_VEC4 : 0x8B59; + static FLOAT_MAT2 : 0x8B5A; + FLOAT_MAT2 : 0x8B5A; + static FLOAT_MAT3 : 0x8B5B; + FLOAT_MAT3 : 0x8B5B; + static FLOAT_MAT4 : 0x8B5C; + FLOAT_MAT4 : 0x8B5C; + static SAMPLER_2D : 0x8B5E; + SAMPLER_2D : 0x8B5E; + static SAMPLER_CUBE : 0x8B60; + SAMPLER_CUBE : 0x8B60; + static VERTEX_ATTRIB_ARRAY_ENABLED : 0x8622; + VERTEX_ATTRIB_ARRAY_ENABLED : 0x8622; + static VERTEX_ATTRIB_ARRAY_SIZE : 0x8623; + VERTEX_ATTRIB_ARRAY_SIZE : 0x8623; + static VERTEX_ATTRIB_ARRAY_STRIDE : 0x8624; + VERTEX_ATTRIB_ARRAY_STRIDE : 0x8624; + static VERTEX_ATTRIB_ARRAY_TYPE : 0x8625; + VERTEX_ATTRIB_ARRAY_TYPE : 0x8625; + static VERTEX_ATTRIB_ARRAY_NORMALIZED : 0x886A; + VERTEX_ATTRIB_ARRAY_NORMALIZED : 0x886A; + static VERTEX_ATTRIB_ARRAY_POINTER : 0x8645; + VERTEX_ATTRIB_ARRAY_POINTER : 0x8645; + static VERTEX_ATTRIB_ARRAY_BUFFER_BINDING : 0x889F; + VERTEX_ATTRIB_ARRAY_BUFFER_BINDING : 0x889F; + static IMPLEMENTATION_COLOR_READ_TYPE : 0x8B9A; + IMPLEMENTATION_COLOR_READ_TYPE : 0x8B9A; + static IMPLEMENTATION_COLOR_READ_FORMAT : 0x8B9B; + IMPLEMENTATION_COLOR_READ_FORMAT : 0x8B9B; + static COMPILE_STATUS : 0x8B81; + COMPILE_STATUS : 0x8B81; + static LOW_FLOAT : 0x8DF0; + LOW_FLOAT : 0x8DF0; + static MEDIUM_FLOAT : 0x8DF1; + MEDIUM_FLOAT : 0x8DF1; + static HIGH_FLOAT : 0x8DF2; + HIGH_FLOAT : 0x8DF2; + static LOW_INT : 0x8DF3; + LOW_INT : 0x8DF3; + static MEDIUM_INT : 0x8DF4; + MEDIUM_INT : 0x8DF4; + static HIGH_INT : 0x8DF5; + HIGH_INT : 0x8DF5; + static FRAMEBUFFER : 0x8D40; + FRAMEBUFFER : 0x8D40; + static RENDERBUFFER : 0x8D41; + RENDERBUFFER : 0x8D41; + static RGBA4 : 0x8056; + RGBA4 : 0x8056; + static RGB5_A1 : 0x8057; + RGB5_A1 : 0x8057; + static RGB565 : 0x8D62; + RGB565 : 0x8D62; + static DEPTH_COMPONENT16 : 0x81A5; + DEPTH_COMPONENT16 : 0x81A5; + static STENCIL_INDEX : 0x1901; + STENCIL_INDEX : 0x1901; + static STENCIL_INDEX8 : 0x8D48; + STENCIL_INDEX8 : 0x8D48; + static DEPTH_STENCIL : 0x84F9; + DEPTH_STENCIL : 0x84F9; + static RENDERBUFFER_WIDTH : 0x8D42; + RENDERBUFFER_WIDTH : 0x8D42; + static RENDERBUFFER_HEIGHT : 0x8D43; + RENDERBUFFER_HEIGHT : 0x8D43; + static RENDERBUFFER_INTERNAL_FORMAT : 0x8D44; + RENDERBUFFER_INTERNAL_FORMAT : 0x8D44; + static RENDERBUFFER_RED_SIZE : 0x8D50; + RENDERBUFFER_RED_SIZE : 0x8D50; + static RENDERBUFFER_GREEN_SIZE : 0x8D51; + RENDERBUFFER_GREEN_SIZE : 0x8D51; + static RENDERBUFFER_BLUE_SIZE : 0x8D52; + RENDERBUFFER_BLUE_SIZE : 0x8D52; + static RENDERBUFFER_ALPHA_SIZE : 0x8D53; + RENDERBUFFER_ALPHA_SIZE : 0x8D53; + static RENDERBUFFER_DEPTH_SIZE : 0x8D54; + RENDERBUFFER_DEPTH_SIZE : 0x8D54; + static RENDERBUFFER_STENCIL_SIZE : 0x8D55; + RENDERBUFFER_STENCIL_SIZE : 0x8D55; + static FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE : 0x8CD0; + FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE : 0x8CD0; + static FRAMEBUFFER_ATTACHMENT_OBJECT_NAME : 0x8CD1; + FRAMEBUFFER_ATTACHMENT_OBJECT_NAME : 0x8CD1; + static FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL : 0x8CD2; + FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL : 0x8CD2; + static FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE : 0x8CD3; + FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE : 0x8CD3; + static COLOR_ATTACHMENT0 : 0x8CE0; + COLOR_ATTACHMENT0 : 0x8CE0; + static DEPTH_ATTACHMENT : 0x8D00; + DEPTH_ATTACHMENT : 0x8D00; + static STENCIL_ATTACHMENT : 0x8D20; + STENCIL_ATTACHMENT : 0x8D20; + static DEPTH_STENCIL_ATTACHMENT : 0x821A; + DEPTH_STENCIL_ATTACHMENT : 0x821A; + static NONE : 0; + NONE : 0; + static FRAMEBUFFER_COMPLETE : 0x8CD5; + FRAMEBUFFER_COMPLETE : 0x8CD5; + static FRAMEBUFFER_INCOMPLETE_ATTACHMENT : 0x8CD6; + FRAMEBUFFER_INCOMPLETE_ATTACHMENT : 0x8CD6; + static FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT : 0x8CD7; + FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT : 0x8CD7; + static FRAMEBUFFER_INCOMPLETE_DIMENSIONS : 0x8CD9; + FRAMEBUFFER_INCOMPLETE_DIMENSIONS : 0x8CD9; + static FRAMEBUFFER_UNSUPPORTED : 0x8CDD; + FRAMEBUFFER_UNSUPPORTED : 0x8CDD; + static FRAMEBUFFER_BINDING : 0x8CA6; + FRAMEBUFFER_BINDING : 0x8CA6; + static RENDERBUFFER_BINDING : 0x8CA7; + RENDERBUFFER_BINDING : 0x8CA7; + static MAX_RENDERBUFFER_SIZE : 0x84E8; + MAX_RENDERBUFFER_SIZE : 0x84E8; + static INVALID_FRAMEBUFFER_OPERATION : 0x0506; + INVALID_FRAMEBUFFER_OPERATION : 0x0506; + static UNPACK_FLIP_Y_WEBGL : 0x9240; + UNPACK_FLIP_Y_WEBGL : 0x9240; + static UNPACK_PREMULTIPLY_ALPHA_WEBGL : 0x9241; + UNPACK_PREMULTIPLY_ALPHA_WEBGL : 0x9241; + static CONTEXT_LOST_WEBGL : 0x9242; + CONTEXT_LOST_WEBGL : 0x9242; + static UNPACK_COLORSPACE_CONVERSION_WEBGL : 0x9243; + UNPACK_COLORSPACE_CONVERSION_WEBGL : 0x9243; + static BROWSER_DEFAULT_WEBGL : 0x9244; + BROWSER_DEFAULT_WEBGL : 0x9244; canvas: HTMLCanvasElement; drawingBufferWidth: number; @@ -2888,12 +2162,7 @@ declare class WebGLRenderingContext { blendEquation(mode: number): void; blendEquationSeparate(modeRGB: number, modeAlpha: number): void; blendFunc(sfactor: number, dfactor: number): void; - blendFuncSeparate( - srcRGB: number, - dstRGB: number, - srcAlpha: number, - dstAlpha: number - ): void; + blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void; bufferData(target: number, size: number, usage: number): void; bufferData(target: number, data: ?ArrayBuffer, usage: number): void; @@ -2908,47 +2177,20 @@ declare class WebGLRenderingContext { colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; compileShader(shader: WebGLShader): void; - compressedTexImage2D( - target: number, - level: number, - internalformat: number, - width: number, - height: number, - border: number, - data: $ArrayBufferView - ): void; + compressedTexImage2D(target: number, level: number, internalformat: number, + width: number, height: number, border: number, + data: $ArrayBufferView): void; - compressedTexSubImage2D( - target: number, - level: number, - xoffset: number, - yoffset: number, - width: number, - height: number, - format: number, - data: $ArrayBufferView - ): void; + compressedTexSubImage2D(target: number, level: number, + xoffset: number, yoffset: number, + width: number, height: number, format: number, + data: $ArrayBufferView): void; - copyTexImage2D( - target: number, - level: number, - internalformat: number, - x: number, - y: number, - width: number, - height: number, - border: number - ): void; - copyTexSubImage2D( - target: number, - level: number, - xoffset: number, - yoffset: number, - x: number, - y: number, - width: number, - height: number - ): void; + copyTexImage2D(target: number, level: number, internalformat: number, + x: number, y: number, width: number, height: number, + border: number): void; + copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, + x: number, y: number, width: number, height: number): void; createBuffer(): ?WebGLBuffer; createFramebuffer(): ?WebGLFramebuffer; @@ -2979,19 +2221,11 @@ declare class WebGLRenderingContext { enableVertexAttribArray(index: number): void; finish(): void; flush(): void; - framebufferRenderbuffer( - target: number, - attachment: number, - renderbuffertarget: number, - renderbuffer: ?WebGLRenderbuffer - ): void; - framebufferTexture2D( - target: number, - attachment: number, - textarget: number, - texture: ?WebGLTexture, - level: number - ): void; + framebufferRenderbuffer(target: number, attachment: number, + renderbuffertarget: number, + renderbuffer: ?WebGLRenderbuffer): void; + framebufferTexture2D(target: number, attachment: number, textarget: number, + texture: ?WebGLTexture, level: number): void; frontFace(mode: number): void; generateMipmap(target: number): void; @@ -3007,19 +2241,13 @@ declare class WebGLRenderingContext { getError(): number; - getFramebufferAttachmentParameter( - target: number, - attachment: number, - pname: number - ): any; + getFramebufferAttachmentParameter(target: number, attachment: number, + pname: number): any; getProgramParameter(program: WebGLProgram, pname: number): any; getProgramInfoLog(program: WebGLProgram): ?string; getRenderbufferParameter(target: number, pname: number): any; getShaderParameter(shader: WebGLShader, pname: number): any; - getShaderPrecisionFormat( - shadertype: number, - precisiontype: number - ): ?WebGLShaderPrecisionFormat; + getShaderPrecisionFormat(shadertype: number, precisiontype: number): ?WebGLShaderPrecisionFormat; getShaderInfoLog(shader: WebGLShader): ?string; getShaderSource(shader: WebGLShader): ?string; @@ -3028,10 +2256,7 @@ declare class WebGLRenderingContext { getUniform(program: WebGLProgram, location: WebGLUniformLocation): any; - getUniformLocation( - program: WebGLProgram, - name: string - ): ?WebGLUniformLocation; + getUniformLocation(program: WebGLProgram, name: string): ?WebGLUniformLocation; getVertexAttrib(index: number, pname: number): any; @@ -3050,87 +2275,37 @@ declare class WebGLRenderingContext { pixelStorei(pname: number, param: number): void; polygonOffset(factor: number, units: number): void; - readPixels( - x: number, - y: number, - width: number, - height: number, - format: number, - type: number, - pixels: ?$ArrayBufferView - ): void; + readPixels(x: number, y: number, width: number, height: number, + format: number, type: number, pixels: ?$ArrayBufferView): void; - renderbufferStorage( - target: number, - internalformat: number, - width: number, - height: number - ): void; + renderbufferStorage(target: number, internalformat: number, + width: number, height: number): void; sampleCoverage(value: number, invert: boolean): void; scissor(x: number, y: number, width: number, height: number): void; shaderSource(shader: WebGLShader, source: string): void; stencilFunc(func: number, ref: number, mask: number): void; - stencilFuncSeparate( - face: number, - func: number, - ref: number, - mask: number - ): void; + stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void; stencilMask(mask: number): void; stencilMaskSeparate(face: number, mask: number): void; stencilOp(fail: number, zfail: number, zpass: number): void; - stencilOpSeparate( - face: number, - fail: number, - zfail: number, - zpass: number - ): void; + stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void; - texImage2D( - target: number, - level: number, - internalformat: number, - width: number, - height: number, - border: number, - format: number, - type: number, - pixels: ?$ArrayBufferView - ): void; - texImage2D( - target: number, - level: number, - internalformat: number, - format: number, - type: number, - source: TexImageSource - ): void; + texImage2D(target: number, level: number, internalformat: number, + width: number, height: number, border: number, format: number, + type: number, pixels: ?$ArrayBufferView): void; + texImage2D(target: number, level: number, internalformat: number, + format: number, type: number, source: TexImageSource): void; texParameterf(target: number, pname: number, param: number): void; texParameteri(target: number, pname: number, param: number): void; - texSubImage2D( - target: number, - level: number, - xoffset: number, - yoffset: number, - width: number, - height: number, - format: number, - type: number, - pixels: ?$ArrayBufferView - ): void; - texSubImage2D( - target: number, - level: number, - xoffset: number, - yoffset: number, - format: number, - type: number, - source: TexImageSource - ): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, + width: number, height: number, + format: number, type: number, pixels: ?$ArrayBufferView): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, + format: number, type: number, source: TexImageSource): void; uniform1f(location: ?WebGLUniformLocation, x: number): void; uniform1fv(location: ?WebGLUniformLocation, v: Float32Array): void; @@ -3148,87 +2323,35 @@ declare class WebGLRenderingContext { uniform2iv(location: ?WebGLUniformLocation, v: Int32Array): void; uniform2iv(location: ?WebGLUniformLocation, v: Array): void; uniform2iv(location: ?WebGLUniformLocation, v: [number, number]): void; - uniform3f( - location: ?WebGLUniformLocation, - x: number, - y: number, - z: number - ): void; + uniform3f(location: ?WebGLUniformLocation, x: number, y: number, z: number): void; uniform3fv(location: ?WebGLUniformLocation, v: Float32Array): void; uniform3fv(location: ?WebGLUniformLocation, v: Array): void; - uniform3fv( - location: ?WebGLUniformLocation, - v: [number, number, number] - ): void; - uniform3i( - location: ?WebGLUniformLocation, - x: number, - y: number, - z: number - ): void; + uniform3fv(location: ?WebGLUniformLocation, v: [number, number, number]): void; + uniform3i(location: ?WebGLUniformLocation, x: number, y: number, z: number): void; uniform3iv(location: ?WebGLUniformLocation, v: Int32Array): void; uniform3iv(location: ?WebGLUniformLocation, v: Array): void; - uniform3iv( - location: ?WebGLUniformLocation, - v: [number, number, number] - ): void; - uniform4f( - location: ?WebGLUniformLocation, - x: number, - y: number, - z: number, - w: number - ): void; + uniform3iv(location: ?WebGLUniformLocation, v: [number, number, number]): void; + uniform4f(location: ?WebGLUniformLocation, x: number, y: number, z: number, w: number): void; uniform4fv(location: ?WebGLUniformLocation, v: Float32Array): void; uniform4fv(location: ?WebGLUniformLocation, v: Array): void; - uniform4fv( - location: ?WebGLUniformLocation, - v: [number, number, number, number] - ): void; - uniform4i( - location: ?WebGLUniformLocation, - x: number, - y: number, - z: number, - w: number - ): void; + uniform4fv(location: ?WebGLUniformLocation, v: [number, number, number, number]): void; + uniform4i(location: ?WebGLUniformLocation, x: number, y: number, z: number, w: number): void; uniform4iv(location: ?WebGLUniformLocation, v: Int32Array): void; uniform4iv(location: ?WebGLUniformLocation, v: Array): void; - uniform4iv( - location: ?WebGLUniformLocation, - v: [number, number, number, number] - ): void; - - uniformMatrix2fv( - location: ?WebGLUniformLocation, - transpose: boolean, - value: Float32Array - ): void; - uniformMatrix2fv( - location: ?WebGLUniformLocation, - transpose: boolean, - value: Array - ): void; - uniformMatrix3fv( - location: ?WebGLUniformLocation, - transpose: boolean, - value: Float32Array - ): void; - uniformMatrix3fv( - location: ?WebGLUniformLocation, - transpose: boolean, - value: Array - ): void; - uniformMatrix4fv( - location: ?WebGLUniformLocation, - transpose: boolean, - value: Float32Array - ): void; - uniformMatrix4fv( - location: ?WebGLUniformLocation, - transpose: boolean, - value: Array - ): void; + uniform4iv(location: ?WebGLUniformLocation, v: [number, number, number, number]): void; + + uniformMatrix2fv(location: ?WebGLUniformLocation, transpose: boolean, + value: Float32Array): void; + uniformMatrix2fv(location: ?WebGLUniformLocation, transpose: boolean, + value: Array): void; + uniformMatrix3fv(location: ?WebGLUniformLocation, transpose: boolean, + value: Float32Array): void; + uniformMatrix3fv(location: ?WebGLUniformLocation, transpose: boolean, + value: Array): void; + uniformMatrix4fv(location: ?WebGLUniformLocation, transpose: boolean, + value: Float32Array): void; + uniformMatrix4fv(location: ?WebGLUniformLocation, transpose: boolean, + value: Array): void; useProgram(program: ?WebGLProgram): void; validateProgram(program: WebGLProgram): void; @@ -3239,42 +2362,23 @@ declare class WebGLRenderingContext { vertexAttrib2fv(index: number, values: VertexAttribFVSource): void; vertexAttrib3f(index: number, x: number, y: number, z: number): void; vertexAttrib3fv(index: number, values: VertexAttribFVSource): void; - vertexAttrib4f( - index: number, - x: number, - y: number, - z: number, - w: number - ): void; + vertexAttrib4f(index: number, x: number, y: number, z: number, w: number): void; vertexAttrib4fv(index: number, values: VertexAttribFVSource): void; - vertexAttribPointer( - index: number, - size: number, - type: number, - normalized: boolean, - stride: number, - offset: number - ): void; + vertexAttribPointer(index: number, size: number, type: number, + normalized: boolean, stride: number, offset: number): void; viewport(x: number, y: number, width: number, height: number): void; -} +}; declare class WebGLContextEvent extends Event { statusMessage: string; -} +}; declare class MediaKeyStatusMap { @@iterator(): Iterator<[BufferDataSource, MediaKeyStatus]>; size: number; entries(): Iterator<[BufferDataSource, MediaKeyStatus]>; - forEach( - callbackfn: ( - value: MediaKeyStatus, - key: BufferDataSource, - map: MediaKeyStatusMap - ) => any, - thisArg?: any - ): void; + forEach(callbackfn: (value: MediaKeyStatus, key: BufferDataSource, map: MediaKeyStatusMap) => any, thisArg?: any): void; get(key: BufferDataSource): MediaKeyStatus; has(key: BufferDataSource): boolean; keys(): Iterator; @@ -3287,10 +2391,7 @@ declare class MediaKeySession extends EventTarget { closed: Promise; keyStatuses: MediaKeyStatusMap; - generateRequest( - initDataType: string, - initData: BufferDataSource - ): Promise; + generateRequest(initDataType: string, initData: BufferDataSource): Promise; load(sessionId: string): Promise; update(response: BufferDataSource): Promise; close(): Promise; @@ -3354,16 +2455,8 @@ declare type ClientRectList = DOMRectList; // TODO: HTML*Element declare class DOMImplementation { - createDocumentType( - qualifiedName: string, - publicId: string, - systemId: string - ): DocumentType; - createDocument( - namespaceURI: string | null, - qualifiedName: string, - doctype?: DocumentType | null - ): Document; + createDocumentType(qualifiedName: string, publicId: string, systemId: string): DocumentType; + createDocument(namespaceURI: string | null, qualifiedName: string, doctype?: DocumentType | null): Document; hasFeature(feature: string, version?: string): boolean; // non-standard @@ -3435,13 +2528,14 @@ declare class URL { toJSON(): string; } -declare interface MediaSourceHandle {} +declare interface MediaSourceHandle { +} declare class MediaSource extends EventTarget { sourceBuffers: SourceBufferList; activeSourceBuffers: SourceBufferList; // https://w3c.github.io/media-source/#dom-readystate - readyState: 'closed' | 'open' | 'ended'; + readyState: "closed" | "open" | "ended"; duration: number; handle: MediaSourceHandle; addSourceBuffer(type: string): SourceBuffer; @@ -3451,7 +2545,7 @@ declare class MediaSource extends EventTarget { } declare class SourceBuffer extends EventTarget { - mode: 'segments' | 'sequence'; + mode: "segments" | "sequence"; updating: boolean; buffered: TimeRanges; timestampOffset: number; @@ -3482,7 +2576,7 @@ declare class TrackDefaultList { } declare class TrackDefault { - type: 'audio' | 'video' | 'text'; + type: "audio" | "video" | "text"; byteStreamTrackID: string; language: string; label: string; @@ -3491,16 +2585,12 @@ declare class TrackDefault { // TODO: The use of `typeof` makes this function signature effectively // (node: Node) => number, but it should be (node: Node) => 1|2|3 -type NodeFilterCallback = ( - node: Node -) => - | typeof NodeFilter.FILTER_ACCEPT - | typeof NodeFilter.FILTER_REJECT - | typeof NodeFilter.FILTER_SKIP; +type NodeFilterCallback = (node: Node) => +typeof NodeFilter.FILTER_ACCEPT | +typeof NodeFilter.FILTER_REJECT | +typeof NodeFilter.FILTER_SKIP; -type NodeFilterInterface = - | NodeFilterCallback - | {acceptNode: NodeFilterCallback, ...}; +type NodeFilterInterface = NodeFilterCallback | { acceptNode: NodeFilterCallback, ... } // TODO: window.NodeFilter exists at runtime and behaves as a constructor // as far as `instanceof` is concerned, but it is not callable. @@ -3576,12 +2666,12 @@ type WindowBaseFilePickerOptions = {| id?: number, startIn?: | FileSystemHandle - | 'desktop' - | 'documents' - | 'downloads' - | 'music' - | 'pictures' - | 'videos', + | "desktop" + | "documents" + | "downloads" + | "music" + | "pictures" + | "videos", |}; type WindowFilePickerOptions = WindowBaseFilePickerOptions & {| @@ -3598,7 +2688,7 @@ type WindowSaveFilePickerOptions = WindowFilePickerOptions & {| |}; type WindowDirectoryFilePickerOptions = WindowBaseFilePickerOptions & {| - mode?: 'read' | 'readwrite', + mode?: "read" | "readwrite", |}; // https://wicg.github.io/file-system-access/#api-showopenfilepicker @@ -3621,28 +2711,28 @@ type NotificationPermission = 'default' | 'denied' | 'granted'; type NotificationDirection = 'auto' | 'ltr' | 'rtl'; type VibratePattern = number | Array; type NotificationAction = { - action: string, - title: string, - icon?: string, - ... + action: string, + title: string, + icon?: string, + ... }; type NotificationOptions = { - dir?: NotificationDirection, - lang?: string, - body?: string, - tag?: string, - image?: string, - icon?: string, - badge?: string, - sound?: string, - vibrate?: VibratePattern, - timestamp?: number, - renotify?: boolean, - silent?: boolean, - requireInteraction?: boolean, - data?: ?any, - actions?: Array, - ... + dir?: NotificationDirection, + lang?: string, + body?: string, + tag?: string, + image?: string, + icon?: string, + badge?: string, + sound?: string, + vibrate?: VibratePattern, + timestamp?: number, + renotify?: boolean, + silent?: boolean, + requireInteraction?: boolean, + data?: ?any, + actions?: Array, + ... }; declare class Notification extends EventTarget { @@ -3674,3 +2764,4 @@ declare class Notification extends EventTarget { close(): void; } + diff --git a/flow-typed/environments/html.js b/flow-typed/environments/html.js index 54e1e48f739..0296fee5032 100644 --- a/flow-typed/environments/html.js +++ b/flow-typed/environments/html.js @@ -45,7 +45,7 @@ declare class DataTransferItem { getAsFileSystemHandle?: () => Promise; } -declare type DOMStringMap = {[key: string]: string, ...}; +declare type DOMStringMap = { [key: string]: string, ... }; declare class DOMStringList { @@iterator(): Iterator; @@ -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; diff --git a/flow-typed/environments/node.js b/flow-typed/environments/node.js index a3edff20f89..02a2f76d344 100644 --- a/flow-typed/environments/node.js +++ b/flow-typed/environments/node.js @@ -1,5 +1,5 @@ -// flow-typed signature: 44d8f5b0b708cdf7288ec50b7c08e1bf -// flow-typed version: 832153ff79/node/flow_>=v0.261.x +// flow-typed signature: a3ddd6b8799406b70a8ce7152c8e6fa6 +// flow-typed version: 6073379163/node/flow_>=v0.261.x interface ErrnoError extends Error { address?: string; @@ -19,33 +19,19 @@ type Node$Conditional = T extends true : IfTrue | IfFalse; type buffer$NonBufferEncoding = - | 'hex' - | 'HEX' - | 'utf8' - | 'UTF8' - | 'utf-8' - | 'UTF-8' - | 'ascii' - | 'ASCII' - | 'binary' - | 'BINARY' - | 'base64' - | 'BASE64' - | 'ucs2' - | 'UCS2' - | 'ucs-2' - | 'UCS-2' - | 'utf16le' - | 'UTF16LE' - | 'utf-16le' - | 'UTF-16LE' - | 'latin1'; -type buffer$Encoding = buffer$NonBufferEncoding | 'buffer'; + 'hex' | 'HEX' | + 'utf8' | 'UTF8' | 'utf-8' | 'UTF-8' | + 'ascii' | 'ASCII' | + 'binary' | 'BINARY' | + 'base64' | 'BASE64' | + 'ucs2' | 'UCS2' | 'ucs-2' | 'UCS-2' | + 'utf16le' | 'UTF16LE' | 'utf-16le' | 'UTF-16LE' | 'latin1'; +type buffer$Encoding = buffer$NonBufferEncoding | 'buffer' type buffer$ToJSONRet = { type: string, data: Array, ... -}; +} declare class Buffer extends Uint8Array { constructor( @@ -56,20 +42,10 @@ declare class Buffer extends Uint8Array { length: number; compare(otherBuffer: Buffer): number; - copy( - targetBuffer: Buffer, - targetStart?: number, - sourceStart?: number, - sourceEnd?: number - ): number; + copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; entries(): Iterator<[number, number]>; equals(otherBuffer: Buffer): boolean; - fill( - value: string | Buffer | number, - offset?: number, - end?: number, - encoding?: string - ): this; + fill(value: string | Buffer | number, offset?: number, end?: number, encoding?: string): this; fill(value: string, encoding?: string): this; includes( value: string | Buffer | number, @@ -82,7 +58,7 @@ declare class Buffer extends Uint8Array { encoding?: buffer$Encoding ): number; inspect(): string; - keys(): Iterator; + keys(): Iterator, lastIndexOf( value: string | Buffer | number, offsetOrEncoding?: number | buffer$Encoding, @@ -113,12 +89,7 @@ declare class Buffer extends Uint8Array { toJSON(): buffer$ToJSONRet; toString(encoding?: buffer$Encoding, start?: number, end?: number): string; values(): Iterator; - write( - string: string, - offset?: number, - length?: number, - encoding?: buffer$Encoding - ): number; + write(string: string, offset?: number, length?: number, encoding?: buffer$Encoding): number; writeDoubleBE(value: number, offset?: number, noAssert?: boolean): number; writeDoubleLE(value: number, offset?: number, noAssert?: boolean): number; writeFloatBE(value: number, offset?: number, noAssert?: boolean): number; @@ -128,57 +99,26 @@ declare class Buffer extends Uint8Array { writeInt32BE(value: number, offset?: number, noAssert?: boolean): number; writeInt32LE(value: number, offset?: number, noAssert?: boolean): number; writeInt8(value: number, offset?: number, noAssert?: boolean): number; - writeIntBE( - value: number, - offset: number, - byteLength: number, - noAssert?: boolean - ): number; - writeIntLE( - value: number, - offset: number, - byteLength: number, - noAssert?: boolean - ): number; + writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; writeUInt16BE(value: number, offset?: number, noAssert?: boolean): number; writeUInt16LE(value: number, offset?: number, noAssert?: boolean): number; writeUInt32BE(value: number, offset?: number, noAssert?: boolean): number; writeUInt32LE(value: number, offset?: number, noAssert?: boolean): number; writeUInt8(value: number, offset?: number, noAssert?: boolean): number; - writeUIntBE( - value: number, - offset: number, - byteLength: number, - noAssert?: boolean - ): number; - writeUIntLE( - value: number, - offset: number, - byteLength: number, - noAssert?: boolean - ): number; + writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; - static alloc( - size: number, - fill?: string | number, - encoding?: buffer$Encoding - ): Buffer; + static alloc(size: number, fill?: string | number, encoding?: buffer$Encoding): Buffer; static allocUnsafe(size: number): Buffer; static allocUnsafeSlow(size: number): Buffer; - static byteLength( - string: string | Buffer | $TypedArray | DataView | ArrayBuffer, - encoding?: buffer$Encoding - ): number; + static byteLength(string: string | Buffer | $TypedArray | DataView | ArrayBuffer, encoding?: buffer$Encoding): number; static compare(buf1: Buffer, buf2: Buffer): number; static concat(list: Array, totalLength?: number): Buffer; static from(value: Buffer): Buffer; static from(value: string, encoding?: buffer$Encoding): Buffer; - static from( - value: ArrayBuffer | SharedArrayBuffer, - byteOffset?: number, - length?: number - ): Buffer; + static from(value: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): Buffer; static from(value: Iterable): this; static isBuffer(obj: any): boolean; static isEncoding(encoding: string): boolean; @@ -186,14 +126,10 @@ declare class Buffer extends Uint8Array { declare type Node$Buffer = typeof Buffer; -declare module 'buffer' { +declare module "buffer" { declare var kMaxLength: number; declare var INSPECT_MAX_BYTES: number; - declare function transcode( - source: Node$Buffer, - fromEnc: buffer$Encoding, - toEnc: buffer$Encoding - ): Node$Buffer; + declare function transcode(source: Node$Buffer, fromEnc: buffer$Encoding, toEnc: buffer$Encoding): Node$Buffer; declare var Buffer: Node$Buffer; } @@ -212,21 +148,17 @@ type child_process$execOpts = { }; declare class child_process$Error extends Error { - code: number | string | null; - errno?: string; - syscall?: string; - path?: string; - spawnargs?: Array; - killed?: boolean; - signal?: string | null; - cmd: string; + code: number | string | null, + errno?: string, + syscall?: string, + path?: string, + spawnargs?: Array, + killed?: boolean, + signal?: string | null, + cmd: string, } -type child_process$execCallback = ( - error: ?child_process$Error, - stdout: string | Buffer, - stderr: string | Buffer -) => void; +type child_process$execCallback = (error: ?child_process$Error, stdout: string | Buffer, stderr: string | Buffer) => void; type child_process$execSyncOpts = { cwd?: string, @@ -259,11 +191,7 @@ type child_process$execFileOpts = { ... }; -type child_process$execFileCallback = ( - error: ?child_process$Error, - stdout: string | Buffer, - stderr: string | Buffer -) => void; +type child_process$execFileCallback = (error: ?child_process$Error, stdout: string | Buffer, stderr: string | Buffer) => void; type child_process$execFileSyncOpts = { cwd?: string, @@ -361,7 +289,7 @@ declare class child_process$ChildProcess extends events$EventEmitter { ref(): void; } -declare module 'child_process' { +declare module "child_process" { declare var ChildProcess: typeof child_process$ChildProcess; declare function exec( @@ -372,10 +300,7 @@ declare module 'child_process' { declare function execSync( command: string, - options: { - encoding: buffer$NonBufferEncoding, - ... - } & child_process$execSyncOpts + options: { encoding: buffer$NonBufferEncoding, ... } & child_process$execSyncOpts ): string; declare function execSync( @@ -386,12 +311,8 @@ declare module 'child_process' { declare function execFile( file: string, argsOrOptionsOrCallback?: - | Array - | child_process$execFileOpts - | child_process$execFileCallback, - optionsOrCallback?: - | child_process$execFileOpts - | child_process$execFileCallback, + Array | child_process$execFileOpts | child_process$execFileCallback, + optionsOrCallback?: child_process$execFileOpts | child_process$execFileCallback, callback?: child_process$execFileCallback ): child_process$ChildProcess; @@ -420,7 +341,7 @@ declare module 'child_process' { ): child_process$spawnSyncRet; } -declare module 'cluster' { +declare module "cluster" { declare type ClusterSettings = { execArgv: Array, exec: string, @@ -431,10 +352,10 @@ declare module 'cluster' { stdio: Array, uid: number, gid: number, - inspectPort: number | (() => number), + inspectPort: number | () => number, windowsHide: boolean, ... - }; + } declare type ClusterSettingsOpt = { execArgv?: Array, @@ -446,10 +367,10 @@ declare module 'cluster' { stdio?: Array, uid?: number, gid?: number, - inspectPort?: number | (() => number), + inspectPort?: number | () => number, windowsHide?: boolean, ... - }; + } declare class Worker extends events$EventEmitter { id: number; @@ -463,7 +384,7 @@ declare module 'cluster' { send( message: Object, sendHandleOrCallback?: child_process$Handle | Function, - callback?: Function + callback?: Function, ): boolean; } @@ -472,7 +393,7 @@ declare module 'cluster' { isWorker: boolean; settings: ClusterSettings; worker: Worker; - workers: {[id: number]: Worker}; + workers: { [id: number]: Worker }; disconnect(callback?: () => void): void; fork(env?: Object): Worker; @@ -506,10 +427,14 @@ declare class crypto$Cipher extends stream$Duplex { input_encoding: void | 'utf8' | 'ascii' | 'latin1' | 'binary', output_encoding: 'latin1' | 'binary' | 'base64' | 'hex' ): string; - update(data: Buffer, input_encoding: void, output_encoding: void): Buffer; + update( + data: Buffer, + input_encoding: void, + output_encoding: void + ): Buffer; } -type crypto$Credentials = {...}; +type crypto$Credentials = {...} type crypto$DiffieHellman = { computeSecret( @@ -525,40 +450,36 @@ type crypto$DiffieHellman = { setPrivateKey(private_key: any, encoding?: string): void, setPublicKey(public_key: any, encoding?: string): void, ... -}; +} type crypto$ECDH$Encoding = 'latin1' | 'hex' | 'base64'; type crypto$ECDH$Format = 'compressed' | 'uncompressed'; declare class crypto$ECDH { - computeSecret(other_public_key: Buffer | $TypedArray | DataView): Buffer; + computeSecret( + other_public_key: Buffer | $TypedArray | DataView + ): Buffer, computeSecret( other_public_key: string, input_encoding: crypto$ECDH$Encoding - ): Buffer; + ): Buffer, computeSecret( other_public_key: Buffer | $TypedArray | DataView, output_encoding: crypto$ECDH$Encoding - ): string; + ): string, computeSecret( other_public_key: string, input_encoding: crypto$ECDH$Encoding, output_encoding: crypto$ECDH$Encoding - ): string; - generateKeys(format?: crypto$ECDH$Format): Buffer; - generateKeys( - encoding: crypto$ECDH$Encoding, - format?: crypto$ECDH$Format - ): string; - getPrivateKey(): Buffer; - getPrivateKey(encoding: crypto$ECDH$Encoding): string; - getPublicKey(format?: crypto$ECDH$Format): Buffer; - getPublicKey( - encoding: crypto$ECDH$Encoding, - format?: crypto$ECDH$Format - ): string; - setPrivateKey(private_key: Buffer | $TypedArray | DataView): void; - setPrivateKey(private_key: string, encoding: crypto$ECDH$Encoding): void; + ): string, + generateKeys(format?: crypto$ECDH$Format): Buffer, + generateKeys(encoding: crypto$ECDH$Encoding, format?: crypto$ECDH$Format): string, + getPrivateKey(): Buffer, + getPrivateKey(encoding: crypto$ECDH$Encoding): string, + getPublicKey(format?: crypto$ECDH$Format): Buffer, + getPublicKey(encoding: crypto$ECDH$Encoding, format?: crypto$ECDH$Format): string, + setPrivateKey(private_key: Buffer | $TypedArray | DataView): void, + setPrivateKey(private_key: string, encoding: crypto$ECDH$Encoding): void } declare class crypto$Decipher extends stream$Duplex { @@ -571,7 +492,7 @@ declare class crypto$Decipher extends stream$Duplex { update( data: string, input_encoding: 'latin1' | 'binary' | 'base64' | 'hex', - output_encoding: 'latin1' | 'binary' | 'ascii' | 'utf8' + output_encoding: 'latin1' | 'binary' | 'ascii' | 'utf8', ): string; update( data: string, @@ -581,59 +502,56 @@ declare class crypto$Decipher extends stream$Duplex { update( data: Buffer, input_encoding: void, - output_encoding: 'latin1' | 'binary' | 'ascii' | 'utf8' + output_encoding: 'latin1' | 'binary' | 'ascii' | 'utf8', ): string; - update(data: Buffer, input_encoding: void, output_encoding: void): Buffer; + update( + data: Buffer, + input_encoding: void, + output_encoding: void + ): Buffer; } declare class crypto$Hash extends stream$Duplex { digest(encoding: 'hex' | 'latin1' | 'binary' | 'base64'): string; digest(encoding: 'buffer'): Buffer; digest(encoding: void): Buffer; - update( - data: string | Buffer, - input_encoding?: 'utf8' | 'ascii' | 'latin1' | 'binary' - ): crypto$Hash; + update(data: string | Buffer, input_encoding?: 'utf8' | 'ascii' | 'latin1' | + 'binary'): crypto$Hash; } declare class crypto$Hmac extends stream$Duplex { digest(encoding: 'hex' | 'latin1' | 'binary' | 'base64'): string; digest(encoding: 'buffer'): Buffer; digest(encoding: void): Buffer; - update( - data: string | Buffer, - input_encoding?: 'utf8' | 'ascii' | 'latin1' | 'binary' - ): crypto$Hmac; + update(data: string | Buffer, input_encoding?: 'utf8' | 'ascii' | 'latin1' | + 'binary'): crypto$Hmac; } -type crypto$Sign$private_key = - | string - | { - key: string, - passphrase: string, - ... - }; +type crypto$Sign$private_key = string | { + key: string, + passphrase: string, + ... +} declare class crypto$Sign extends stream$Writable { - static (algorithm: string, options?: writableStreamOptions): crypto$Sign; + static(algorithm: string, options?: writableStreamOptions): crypto$Sign, constructor(algorithm: string, options?: writableStreamOptions): void; sign( private_key: crypto$Sign$private_key, output_format: 'latin1' | 'binary' | 'hex' | 'base64' ): string; - sign(private_key: crypto$Sign$private_key, output_format: void): Buffer; - update( - data: string | Buffer, - input_encoding?: 'utf8' | 'ascii' | 'latin1' | 'binary' - ): crypto$Sign; + sign( + private_key: crypto$Sign$private_key, + output_format: void + ): Buffer; + update(data: string | Buffer, input_encoding?: 'utf8' | 'ascii' | 'latin1' | + 'binary'): crypto$Sign; } declare class crypto$Verify extends stream$Writable { - static (algorithm: string, options?: writableStreamOptions): crypto$Verify; + static(algorithm: string, options?: writableStreamOptions): crypto$Verify, constructor(algorithm: string, options?: writableStreamOptions): void; - update( - data: string | Buffer, - input_encoding?: 'utf8' | 'ascii' | 'latin1' | 'binary' - ): crypto$Verify; + update(data: string | Buffer, input_encoding?: 'utf8' | 'ascii' | 'latin1' | + 'binary' ): crypto$Verify; verify( object: string, signature: string | Buffer | $TypedArray | DataView, @@ -642,26 +560,22 @@ declare class crypto$Verify extends stream$Writable { verify(object: string, signature: Buffer, signature_format: void): boolean; } -type crypto$key = - | string - | { - key: string, - passphrase?: string, - // TODO: enum type in crypto.constants - padding?: string, - ... - }; -declare module 'crypto' { +type crypto$key = string | { + key: string, + passphrase?: string, + // TODO: enum type in crypto.constants + padding?: string, + ... +}; + +declare module "crypto" { declare var DEFAULT_ENCODING: string; declare class Sign extends crypto$Sign {} declare class Verify extends crypto$Verify {} - declare function createCipher( - algorithm: string, - password: string | Buffer - ): crypto$Cipher; + declare function createCipher(algorithm: string, password: string | Buffer): crypto$Cipher; declare function createCipheriv( algorithm: string, key: string | Buffer, @@ -669,29 +583,18 @@ declare module 'crypto' { ): crypto$Cipher; declare function createCredentials( details?: crypto$createCredentialsDetails - ): crypto$Credentials; - declare function createDecipher( - algorithm: string, - password: string | Buffer - ): crypto$Decipher; + ): crypto$Credentials + declare function createDecipher(algorithm: string, password: string | Buffer): crypto$Decipher; declare function createDecipheriv( algorithm: string, key: string | Buffer, iv: string | Buffer ): crypto$Decipher; - declare function createDiffieHellman( - prime_length: number - ): crypto$DiffieHellman; - declare function createDiffieHellman( - prime: number, - encoding?: string - ): crypto$DiffieHellman; + declare function createDiffieHellman(prime_length: number): crypto$DiffieHellman; + declare function createDiffieHellman(prime: number, encoding?: string): crypto$DiffieHellman; declare function createECDH(curveName: string): crypto$ECDH; declare function createHash(algorithm: string): crypto$Hash; - declare function createHmac( - algorithm: string, - key: string | Buffer - ): crypto$Hmac; + declare function createHmac(algorithm: string, key: string | Buffer): crypto$Hmac; declare function createSign(algorithm: string): crypto$Sign; declare function createVerify(algorithm: string): crypto$Verify; declare function getCiphers(): Array; @@ -724,14 +627,8 @@ declare module 'crypto' { password: string | Buffer, salt: string | Buffer, keylen: number, - options: - | {|N?: number, r?: number, p?: number, maxmem?: number|} - | {| - cost?: number, - blockSize?: number, - parallelization?: number, - maxmem?: number, - |}, + options: {|N?: number, r?: number, p?: number, maxmem?: number|} + | {|cost?: number, blockSize?: number, parallelization?: number, maxmem?: number|}, callback: (err: ?Error, derivedKey: Buffer) => void ): void; declare function scrypt( @@ -744,14 +641,8 @@ declare module 'crypto' { password: string | Buffer, salt: string | Buffer, keylen: number, - options?: - | {|N?: number, r?: number, p?: number, maxmem?: number|} - | {| - cost?: number, - blockSize?: number, - parallelization?: number, - maxmem?: number, - |} + options?: {|N?: number, r?: number, p?: number, maxmem?: number|} + | {|cost?: number, blockSize?: number, parallelization?: number, maxmem?: number|}, ): Buffer; declare function privateDecrypt( private_key: crypto$key, @@ -761,8 +652,14 @@ declare module 'crypto' { private_key: crypto$key, buffer: Buffer ): Buffer; - declare function publicDecrypt(key: crypto$key, buffer: Buffer): Buffer; - declare function publicEncrypt(key: crypto$key, buffer: Buffer): Buffer; + declare function publicDecrypt( + key: crypto$key, + buffer: Buffer + ): Buffer; + declare function publicEncrypt( + key: crypto$key, + buffer: Buffer + ): Buffer; // `UNUSED` argument strictly enforces arity to enable overloading this // function with 1-arg and 2-arg variants. declare function pseudoRandomBytes(size: number, UNUSED: void): Buffer; @@ -777,35 +674,30 @@ declare module 'crypto' { size: number, callback: (err: ?Error, buffer: Buffer) => void ): void; - declare function randomFillSync( - buffer: Buffer | $TypedArray | DataView - ): void; - declare function randomFillSync( - buffer: Buffer | $TypedArray | DataView, - offset: number - ): void; + declare function randomFillSync(buffer: Buffer | $TypedArray | DataView): void + declare function randomFillSync(buffer: Buffer | $TypedArray | DataView, offset: number): void declare function randomFillSync( buffer: Buffer | $TypedArray | DataView, offset: number, size: number - ): void; + ): void declare function randomFill( buffer: Buffer | $TypedArray | DataView, callback: (err: ?Error, buffer: Buffer) => void - ): void; + ): void declare function randomFill( buffer: Buffer | $TypedArray | DataView, offset: number, callback: (err: ?Error, buffer: Buffer) => void - ): void; + ): void declare function randomFill( buffer: Buffer | $TypedArray | DataView, offset: number, size: number, callback: (err: ?Error, buffer: Buffer) => void - ): void; + ): void declare function randomUUID( - options?: $ReadOnly<{|disableEntropyCache?: boolean|}> + options?: $ReadOnly<{|disableEntropyCache?: boolean|}>, ): string; declare function timingSafeEqual( a: Buffer | $TypedArray | DataView, @@ -838,7 +730,7 @@ declare class dgram$Socket extends events$EventEmitter { msg: Buffer, port: number, address: string, - callback?: (err: ?Error, bytes: any) => mixed + callback?: (err: ?Error, bytes: any) => mixed, ): void; send( msg: Buffer, @@ -846,23 +738,23 @@ declare class dgram$Socket extends events$EventEmitter { length: number, port: number, address: string, - callback?: (err: ?Error, bytes: any) => mixed + callback?: (err: ?Error, bytes: any) => mixed, ): void; setBroadcast(flag: boolean): void; setMulticastLoopback(flag: boolean): void; setMulticastTTL(ttl: number): void; setTTL(ttl: number): void; unref(): void; -} +}; -declare module 'dgram' { +declare module "dgram" { declare function createSocket( - options: string | {type: string, ...}, + options: string | { type: string, ... }, callback?: () => void ): dgram$Socket; } -declare module 'dns' { +declare module "dns" { declare var ADDRGETNETWORKPARAMS: string; declare var BADFAMILY: string; declare var BADFLAGS: string; @@ -965,7 +857,7 @@ declare class events$EventEmitter { static defaultMaxListeners: number; addListener(event: string, listener: Function): this; - emit(event: string, ...args: Array): boolean; + emit(event: string, ...args:Array): boolean; eventNames(): Array; listeners(event: string): Array; listenerCount(event: string): number; @@ -981,7 +873,8 @@ declare class events$EventEmitter { rawListeners(event: string): Array; } -declare module 'events' { + +declare module "events" { // TODO: See the comment above the events$EventEmitter declaration declare class EventEmitter extends events$EventEmitter { static EventEmitter: typeof EventEmitter; @@ -1003,11 +896,11 @@ declare class domain$Domain extends events$EventEmitter { run(fn: Function): void; } -declare module 'domain' { +declare module "domain" { declare function create(): domain$Domain; } -declare module 'fs' { +declare module "fs" { declare class Stats { dev: number; ino: number; @@ -1064,110 +957,39 @@ declare module 'fs' { isSymbolicLink(): boolean; } - declare function rename( - oldPath: string, - newPath: string, - callback?: (err: ?ErrnoError) => void - ): void; + declare function rename(oldPath: string, newPath: string, callback?: (err: ?ErrnoError) => void): void; declare function renameSync(oldPath: string, newPath: string): void; - declare function ftruncate( - fd: number, - len: number, - callback?: (err: ?ErrnoError) => void - ): void; + declare function ftruncate(fd: number, len: number, callback?: (err: ?ErrnoError) => void): void; declare function ftruncateSync(fd: number, len: number): void; - declare function truncate( - path: string, - len: number, - callback?: (err: ?ErrnoError) => void - ): void; + declare function truncate(path: string, len: number, callback?: (err: ?ErrnoError) => void): void; declare function truncateSync(path: string, len: number): void; - declare function chown( - path: string, - uid: number, - gid: number, - callback?: (err: ?ErrnoError) => void - ): void; + declare function chown(path: string, uid: number, gid: number, callback?: (err: ?ErrnoError) => void): void; declare function chownSync(path: string, uid: number, gid: number): void; - declare function fchown( - fd: number, - uid: number, - gid: number, - callback?: (err: ?ErrnoError) => void - ): void; + declare function fchown(fd: number, uid: number, gid: number, callback?: (err: ?ErrnoError) => void): void; declare function fchownSync(fd: number, uid: number, gid: number): void; - declare function lchown( - path: string, - uid: number, - gid: number, - callback?: (err: ?ErrnoError) => void - ): void; + declare function lchown(path: string, uid: number, gid: number, callback?: (err: ?ErrnoError) => void): void; declare function lchownSync(path: string, uid: number, gid: number): void; - declare function chmod( - path: string, - mode: number | string, - callback?: (err: ?ErrnoError) => void - ): void; + declare function chmod(path: string, mode: number | string, callback?: (err: ?ErrnoError) => void): void; declare function chmodSync(path: string, mode: number | string): void; - declare function fchmod( - fd: number, - mode: number | string, - callback?: (err: ?ErrnoError) => void - ): void; + declare function fchmod(fd: number, mode: number | string, callback?: (err: ?ErrnoError) => void): void; declare function fchmodSync(fd: number, mode: number | string): void; - declare function lchmod( - path: string, - mode: number | string, - callback?: (err: ?ErrnoError) => void - ): void; + declare function lchmod(path: string, mode: number | string, callback?: (err: ?ErrnoError) => void): void; declare function lchmodSync(path: string, mode: number | string): void; - declare function stat( - path: string, - callback?: (err: ?ErrnoError, stats: Stats) => any - ): void; + declare function stat(path: string, callback?: (err: ?ErrnoError, stats: Stats) => any): void; declare function statSync(path: string): Stats; - declare function fstat( - fd: number, - callback?: (err: ?ErrnoError, stats: Stats) => any - ): void; + declare function fstat(fd: number, callback?: (err: ?ErrnoError, stats: Stats) => any): void; declare function fstatSync(fd: number): Stats; - declare function lstat( - path: string, - callback?: (err: ?ErrnoError, stats: Stats) => any - ): void; + declare function lstat(path: string, callback?: (err: ?ErrnoError, stats: Stats) => any): void; declare function lstatSync(path: string): Stats; - declare function link( - srcpath: string, - dstpath: string, - callback?: (err: ?ErrnoError) => void - ): void; + declare function link(srcpath: string, dstpath: string, callback?: (err: ?ErrnoError) => void): void; declare function linkSync(srcpath: string, dstpath: string): void; - declare function symlink( - srcpath: string, - dtspath: string, - type?: string, - callback?: (err: ?ErrnoError) => void - ): void; - declare function symlinkSync( - srcpath: string, - dstpath: string, - type?: string - ): void; - declare function readlink( - path: string, - callback: (err: ?ErrnoError, linkString: string) => void - ): void; + declare function symlink(srcpath: string, dtspath: string, type?: string, callback?: (err: ?ErrnoError) => void): void; + declare function symlinkSync(srcpath: string, dstpath: string, type?: string): void; + declare function readlink(path: string, callback: (err: ?ErrnoError, linkString: string) => void): void; declare function readlinkSync(path: string): string; - declare function realpath( - path: string, - cache?: Object, - callback?: (err: ?ErrnoError, resolvedPath: string) => void - ): void; + declare function realpath(path: string, cache?: Object, callback?: (err: ?ErrnoError, resolvedPath: string) => void): void; declare function realpathSync(path: string, cache?: Object): string; - declare function unlink( - path: string, - callback?: (err: ?ErrnoError) => void - ): void; + declare function unlink(path: string, callback?: (err: ?ErrnoError) => void): void; declare function unlinkSync(path: string): void; declare type RmDirOptions = {| @@ -1198,15 +1020,8 @@ declare module 'fs' { retryDelay?: number | void, |}; - declare function rmdir( - path: PathLike, - callback?: (err: ?ErrnoError) => void - ): void; - declare function rmdir( - path: PathLike, - options: RmDirOptions, - callback?: (err: ?ErrnoError) => void - ): void; + declare function rmdir(path: PathLike, callback?: (err: ?ErrnoError) => void): void; + declare function rmdir(path: PathLike, options: RmDirOptions, callback?: (err: ?ErrnoError) => void): void; declare function rmdirSync(path: PathLike, options?: RmDirOptions): void; declare type RmOptions = {| @@ -1243,15 +1058,8 @@ declare module 'fs' { * completion callback. * @since v14.14.0 */ - declare function rm( - path: PathLike, - callback?: (err: ?ErrnoError) => void - ): void; - declare function rm( - path: PathLike, - options: RmOptions, - callback?: (err: ?ErrnoError) => void - ): void; + declare function rm(path: PathLike, callback?: (err: ?ErrnoError) => void): void; + declare function rm(path: PathLike, options: RmOptions, callback?: (err: ?ErrnoError) => void): void; /** * Synchronously removes files and directories (modeled on the standard POSIX `rm`utility). Returns `undefined`. @@ -1259,40 +1067,26 @@ declare module 'fs' { */ declare function rmSync(path: PathLike, options?: RmOptions): void; - declare function mkdir( - path: string, - mode?: - | number - | { - recursive?: boolean, - mode?: number, - ... - }, - callback?: (err: ?ErrnoError) => void - ): void; - declare function mkdirSync( - path: string, - mode?: - | number - | { - recursive?: boolean, - mode?: number, - ... - } - ): void; - declare function mkdtemp( - prefix: string, - callback: (err: ?ErrnoError, folderPath: string) => void - ): void; + declare function mkdir(path: string, mode?: number | { + recursive?: boolean, + mode?: number, + ... + }, callback?: (err: ?ErrnoError) => void): void; + declare function mkdirSync(path: string, mode?: number | { + recursive?: boolean, + mode?: number, + ... + }): void; + declare function mkdtemp(prefix: string, callback: (err: ?ErrnoError, folderPath: string) => void): void; declare function mkdtempSync(prefix: string): string; declare function readdir( path: string, - options: string | {encoding?: string, withFileTypes?: false, ...}, + options: string | { encoding?: string, withFileTypes?: false, ... }, callback: (err: ?ErrnoError, files: Array) => void ): void; declare function readdir( path: string, - options: {encoding?: string, withFileTypes: true, ...}, + options: { encoding?: string, withFileTypes: true, ... }, callback: (err: ?ErrnoError, files: Array) => void ): void; declare function readdir( @@ -1301,16 +1095,13 @@ declare module 'fs' { ): void; declare function readdirSync( path: string, - options?: string | {encoding?: string, withFileTypes?: false, ...} + options?: string | { encoding?: string, withFileTypes?: false, ... } ): Array; declare function readdirSync( path: string, - options?: string | {encoding?: string, withFileTypes: true, ...} + options?: string | { encoding?: string, withFileTypes: true, ... } ): Array; - declare function close( - fd: number, - callback: (err: ?ErrnoError) => void - ): void; + declare function close(fd: number, callback: (err: ?ErrnoError) => void): void; declare function closeSync(fd: number): void; declare function open( path: string | Buffer | URL, @@ -1323,29 +1114,12 @@ declare module 'fs' { flags: string | number, callback: (err: ?ErrnoError, fd: number) => void ): void; - declare function openSync( - path: string | Buffer, - flags: string | number, - mode?: number - ): number; - declare function utimes( - path: string, - atime: number, - mtime: number, - callback?: (err: ?ErrnoError) => void - ): void; + declare function openSync(path: string | Buffer, flags: string | number, mode?: number): number; + declare function utimes(path: string, atime: number, mtime: number, callback?: (err: ?ErrnoError) => void): void; declare function utimesSync(path: string, atime: number, mtime: number): void; - declare function futimes( - fd: number, - atime: number, - mtime: number, - callback?: (err: ?ErrnoError) => void - ): void; + declare function futimes(fd: number, atime: number, mtime: number, callback?: (err: ?ErrnoError) => void): void; declare function futimesSync(fd: number, atime: number, mtime: number): void; - declare function fsync( - fd: number, - callback?: (err: ?ErrnoError) => void - ): void; + declare function fsync(fd: number, callback?: (err: ?ErrnoError) => void): void; declare function fsyncSync(fd: number): void; declare function write( fd: number, @@ -1396,29 +1170,29 @@ declare module 'fs' { buffer: Buffer, offset: number, length: number, - position: number + position: number, ): number; declare function writeSync( fd: number, buffer: Buffer, offset: number, - length: number + length: number, ): number; declare function writeSync( fd: number, buffer: Buffer, - offset?: number + offset?: number, ): number; declare function writeSync( fd: number, str: string, position: number, - encoding: string + encoding: string, ): number; declare function writeSync( fd: number, str: string, - position?: number + position?: number, ): number; declare function read( fd: number, @@ -1455,41 +1229,35 @@ declare module 'fs' { ): void; declare function readFile( path: string | Buffer | URL | number, - options: {encoding?: null | void, flag?: string, ...}, + options: { encoding?: null | void, flag?: string, ... }, callback: (err: ?ErrnoError, data: Buffer) => void ): void; - declare function readFileSync(path: string | Buffer | URL | number): Buffer; declare function readFileSync( - path: string | Buffer | URL | number, - encoding: string - ): string; + path: string | Buffer | URL | number + ): Buffer; declare function readFileSync( path: string | Buffer | URL | number, - options: { - encoding: string, - flag?: string, - ... - } + encoding: string ): string; - declare function readFileSync( - path: string | Buffer | URL | number, - options: { - encoding?: void, - flag?: string, - ... - } - ): Buffer; + declare function readFileSync(path: string | Buffer | URL | number, options: { + encoding: string, + flag?: string, + ... + }): string; + declare function readFileSync(path: string | Buffer | URL | number, options: { + encoding?: void, + flag?: string, + ... + }): Buffer; declare function writeFile( filename: string | Buffer | number, data: Buffer | string, - options: - | string - | { - encoding?: ?string, - mode?: number, - flag?: string, - ... - }, + options: string | { + encoding?: ?string, + mode?: number, + flag?: string, + ... + }, callback: (err: ?ErrnoError) => void ): void; declare function writeFile( @@ -1500,26 +1268,22 @@ declare module 'fs' { declare function writeFileSync( filename: string, data: Buffer | string, - options?: - | string - | { - encoding?: ?string, - mode?: number, - flag?: string, - ... - } + options?: string | { + encoding?: ?string, + mode?: number, + flag?: string, + ... + } ): void; declare function appendFile( filename: string | Buffer | number, data: string | Buffer, - options: - | string - | { - encoding?: ?string, - mode?: number, - flag?: string, - ... - }, + options: string | { + encoding?: ?string, + mode?: number, + flag?: string, + ... + }, callback: (err: ?ErrnoError) => void ): void; declare function appendFile( @@ -1530,66 +1294,27 @@ declare module 'fs' { declare function appendFileSync( filename: string | Buffer | number, data: string | Buffer, - options?: - | string - | { - encoding?: ?string, - mode?: number, - flag?: string, - ... - } - ): void; - declare function watchFile( - filename: string, - options?: Object, - listener?: (curr: Stats, prev: Stats) => void - ): void; - declare function unwatchFile( - filename: string, - listener?: (curr: Stats, prev: Stats) => void - ): void; - declare function watch( - filename: string, - options?: Object, - listener?: (event: string, filename: string) => void - ): FSWatcher; - declare function exists( - path: string, - callback?: (exists: boolean) => void + options?: string | { + encoding?: ?string, + mode?: number, + flag?: string, + ... + } ): void; + declare function watchFile(filename: string, options?: Object, listener?: (curr: Stats, prev: Stats) => void): void; + declare function unwatchFile(filename: string, listener?: (curr: Stats, prev: Stats) => void): void; + declare function watch(filename: string, options?: Object, listener?: (event: string, filename: string) => void): FSWatcher; + declare function exists(path: string, callback?: (exists: boolean) => void): void; declare function existsSync(path: string): boolean; - declare function access( - path: string, - mode?: number, - callback?: (err: ?ErrnoError) => void - ): void; + declare function access(path: string, mode?: number, callback?: (err: ?ErrnoError) => void): void; declare function accessSync(path: string, mode?: number): void; declare function createReadStream(path: string, options?: Object): ReadStream; - declare function createWriteStream( - path: string, - options?: Object - ): WriteStream; - declare function fdatasync( - fd: number, - callback: (err: ?ErrnoError) => void - ): void; + declare function createWriteStream(path: string, options?: Object): WriteStream; + declare function fdatasync(fd: number, callback: (err: ?ErrnoError) => void): void; declare function fdatasyncSync(fd: number): void; - declare function copyFile( - src: string, - dest: string, - callback: (err: ErrnoError) => void - ): void; - declare function copyFile( - src: string, - dest: string, - flags?: number, - callback: (err: ErrnoError) => void - ): void; - declare function copyFileSync( - src: string, - dest: string, - flags?: number - ): void; + declare function copyFile(src: string, dest: string, callback: (err: ErrnoError) => void): void; + declare function copyFile(src: string, dest: string, flags?: number, callback: (err: ErrnoError) => void): void; + declare function copyFileSync(src: string, dest: string, flags?: number): void; declare type GlobOptions = $ReadOnly<{ /** @@ -1630,7 +1355,7 @@ declare module 'fs' { */ declare function glob( pattern: string | $ReadOnlyArray, - callback: (err: ?ErrnoError, matches: Array) => void + callback: (err: ?ErrnoError, matches: Array) => void, ): void; declare function glob( @@ -1638,8 +1363,8 @@ declare module 'fs' { options: GlobOptions, callback: ( err: ?ErrnoError, - matches: Node$Conditional, Array> - ) => void + matches: Node$Conditional, Array>, + ) => void, ): void; /** @@ -1653,7 +1378,7 @@ declare module 'fs' { */ declare function globSync( pattern: string | $ReadOnlyArray, - options?: GlobOptions + options?: GlobOptions, ): Node$Conditional, Array>; declare var F_OK: number; @@ -1709,22 +1434,15 @@ declare module 'fs' { ... }; - declare type BufferEncoding = 'buffer' | {encoding: 'buffer', ...}; - declare type EncodingOptions = {encoding?: string, ...}; - declare type EncodingFlag = EncodingOptions & {flag?: string, ...}; - declare type WriteOptions = EncodingFlag & {mode?: number, ...}; - declare type RemoveOptions = { - force?: boolean, - maxRetries?: number, - recursive?: boolean, - retryDelay?: number, - ... - }; + declare type BufferEncoding = + | 'buffer' + | { encoding: 'buffer', ... }; + declare type EncodingOptions = { encoding?: string, ... }; + declare type EncodingFlag = EncodingOptions & { flag?: string, ... }; + declare type WriteOptions = EncodingFlag & { mode?: number, ... }; + declare type RemoveOptions = { force?: boolean, maxRetries?: number, recursive?: boolean, retryDelay?: number, ... }; declare class FileHandle { - appendFile( - data: string | Buffer, - options: WriteOptions | string - ): Promise; + appendFile(data: string | Buffer, options: WriteOptions | string): Promise; chmod(mode: number): Promise; chown(uid: number, guid: number): Promise; close(): Promise; @@ -1745,52 +1463,29 @@ declare module 'fs' { stat(): Promise; sync(): Promise; truncate(len?: number): Promise; - utimes( - atime: number | string | Date, - mtime: number | string | Date - ): Promise; - write( - buffer: Buffer | Uint8Array, - offset: number, - length: number, - position: number - ): Promise; - writeFile( - data: string | Buffer | Uint8Array, - options: WriteOptions | string - ): Promise; + utimes(atime: number | string | Date, mtime: number | string | Date): Promise; + write(buffer: Buffer | Uint8Array, offset: number, length: number, position: number): Promise; + writeFile(data: string | Buffer | Uint8Array, options: WriteOptions | string): Promise; } declare type FSPromisePath = string | Buffer | URL; declare type FSPromise = { access(path: FSPromisePath, mode?: number): Promise, - appendFile( - path: FSPromisePath | FileHandle, - data: string | Buffer, - options?: WriteOptions | string - ): Promise, + appendFile(path: FSPromisePath | FileHandle, data: string | Buffer, options?: WriteOptions | string): Promise, chmod(path: FSPromisePath, mode: number): Promise, chown(path: FSPromisePath, uid: number, gid: number): Promise, - copyFile( - src: FSPromisePath, - dest: FSPromisePath, - flags?: number - ): Promise, + copyFile(src: FSPromisePath, dest: FSPromisePath, flags?: number): Promise, fchmod(filehandle: FileHandle, mode: number): Promise, fchown(filehandle: FileHandle, uid: number, guid: number): Promise, fdatasync(filehandle: FileHandle): Promise, fstat(filehandle: FileHandle): Promise, fsync(filehandle: FileHandle): Promise, ftruncate(filehandle: FileHandle, len?: number): Promise, - futimes( - filehandle: FileHandle, - atime: number | string | Date, - mtime: number | string | Date - ): Promise, + futimes(filehandle: FileHandle, atime: number | string | Date, mtime: number | string | Date): Promise, lchmod(path: FSPromisePath, mode: number): Promise, glob( pattern: string | $ReadOnlyArray, - options?: GlobOptions + options?: GlobOptions, ): Node$Conditional< WithFileTypes, AsyncIterator, @@ -1799,22 +1494,13 @@ declare module 'fs' { lchown(path: FSPromisePath, uid: number, guid: number): Promise, link(existingPath: FSPromisePath, newPath: FSPromisePath): Promise, lstat(path: FSPromisePath): Promise, - mkdir( - path: FSPromisePath, - mode?: - | number - | { - recursive?: boolean, - mode?: number, - ... - } - ): Promise, + mkdir(path: FSPromisePath, mode?: number | { + recursive?: boolean, + mode?: number, + ... + }): Promise, mkdtemp(prefix: string, options?: EncodingOptions): Promise, - open( - path: FSPromisePath, - flags?: string | number, - mode?: number - ): Promise, + open(path: FSPromisePath, flags?: string | number, mode?: number): Promise, read( filehandle: FileHandle, buffer: T, @@ -1826,55 +1512,27 @@ declare module 'fs' { buffer: T, ... }>, - readdir: (( - path: FSPromisePath, - options: string | {encoding?: string, withFileTypes?: false, ...} - ) => Promise>) & - (( - path: FSPromisePath, - options: {encoding?: string, withFileTypes: true, ...} - ) => Promise>) & - ((path: FSPromisePath) => Promise>), - readFile: (( - path: FSPromisePath | FileHandle, - options: string - ) => Promise) & - (( - path: FSPromisePath | FileHandle, - options?: EncodingFlag - ) => Promise), - readlink: (( - path: FSPromisePath, - options: BufferEncoding - ) => Promise) & - (( - path: FSPromisePath, - options?: string | EncodingOptions - ) => Promise), - realpath: (( - path: FSPromisePath, - options: BufferEncoding - ) => Promise) & - (( - path: FSPromisePath, - options?: string | EncodingOptions - ) => Promise), + readdir: + & ((path: FSPromisePath, options: string | { encoding?: string, withFileTypes?: false, ... }) => Promise>) + & ((path: FSPromisePath, options: { encoding?: string, withFileTypes: true, ... }) => Promise>) + & ((path: FSPromisePath) => Promise>), + readFile: + & ((path: FSPromisePath | FileHandle, options: string) => Promise) + & ((path: FSPromisePath | FileHandle, options?: EncodingFlag) => Promise), + readlink: + & ((path: FSPromisePath, options: BufferEncoding) => Promise) + & ((path: FSPromisePath, options?: string | EncodingOptions) => Promise), + realpath: + & ((path: FSPromisePath, options: BufferEncoding) => Promise) + & ((path: FSPromisePath, options?: string | EncodingOptions) => Promise), rename(oldPath: FSPromisePath, newPath: FSPromisePath): Promise, rm(path: FSPromisePath, options?: RemoveOptions): Promise, rmdir(path: FSPromisePath): Promise, stat(path: FSPromisePath): Promise, - symlink( - target: FSPromisePath, - path: FSPromisePath, - type?: 'dir' | 'file' | 'junction' - ): Promise, + symlink(target: FSPromisePath, path: FSPromisePath, type?: 'dir' | 'file' | 'junction'): Promise, truncate(path: FSPromisePath, len?: number): Promise, unlink(path: FSPromisePath): Promise, - utimes( - path: FSPromisePath, - atime: number | string | Date, - mtime: number | string | Date - ): Promise, + utimes(path: FSPromisePath, atime: number | string | Date, mtime: number | string | Date): Promise, write( filehandle: FileHandle, buffer: T, @@ -1892,7 +1550,7 @@ declare module 'fs' { options?: string | WriteOptions ): Promise, ... - }; + } declare var promises: FSPromise; } @@ -1903,12 +1561,12 @@ type http$agentOptions = { maxSockets?: number, maxFreeSockets?: number, ... -}; +} declare class http$Agent<+SocketT = net$Socket> { constructor(options: http$agentOptions): void; destroy(): void; - freeSockets: {[name: string]: $ReadOnlyArray, ...}; + freeSockets: { [name: string]: $ReadOnlyArray, ... }; getName(options: { host: string, port: number, @@ -1917,13 +1575,11 @@ declare class http$Agent<+SocketT = net$Socket> { }): string; maxFreeSockets: number; maxSockets: number; - requests: {[name: string]: $ReadOnlyArray>, ...}; - sockets: {[name: string]: $ReadOnlyArray, ...}; + requests: { [name: string]: $ReadOnlyArray>, ... }; + sockets: { [name: string]: $ReadOnlyArray, ... }; } -declare class http$IncomingMessage - extends stream$Readable -{ +declare class http$IncomingMessage extends stream$Readable { headers: Object; rawHeaders: Array; httpVersion: string; @@ -1939,9 +1595,7 @@ declare class http$IncomingMessage rawTrailers: Array; } -declare class http$ClientRequest<+SocketT = net$Socket> - extends stream$Writable -{ +declare class http$ClientRequest<+SocketT = net$Socket> extends stream$Writable { abort(): void; aborted: boolean; +connection: SocketT | null; @@ -1956,13 +1610,13 @@ declare class http$ClientRequest<+SocketT = net$Socket> } declare class http$ServerResponse extends stream$Writable { - addTrailers(headers: {[key: string]: string, ...}): void; + addTrailers(headers: { [key: string] : string, ... }): void; connection: net$Socket; finished: boolean; flushHeaders(): void; getHeader(name: string): string; getHeaderNames(): Array; - getHeaders(): {[key: string]: string | Array, ...}; + getHeaders(): { [key: string] : string | Array, ...}; hasHeader(name: string): boolean; headersSent: boolean; removeHeader(name: string): void; @@ -1973,41 +1627,29 @@ declare class http$ServerResponse extends stream$Writable { statusCode: number; statusMessage: string; writeContinue(): void; - writeHead( - status: number, - statusMessage?: string, - headers?: {[key: string]: string, ...} - ): void; - writeHead(status: number, headers?: {[key: string]: string, ...}): void; + writeHead(status: number, statusMessage?: string, headers?: { [key: string] : string, ... }): void; + writeHead(status: number, headers?: { [key: string] : string, ... }): void; writeProcessing(): void; } declare class http$Server extends net$Server { - listen( - port?: number, - hostname?: string, - backlog?: number, - callback?: Function - ): this; + listen(port?: number, hostname?: string, backlog?: number, callback?: Function): this; // The following signatures are added to allow omitting intermediate arguments listen(port?: number, backlog?: number, callback?: Function): this; listen(port?: number, hostname?: string, callback?: Function): this; listen(port?: number, callback?: Function): this; listen(path: string, callback?: Function): this; - listen( - handle: { - port?: number, - host?: string, - path?: string, - backlog?: number, - exclusive?: boolean, - readableAll?: boolean, - writableAll?: boolean, - ipv6Only?: boolean, - ... - }, - callback?: Function - ): this; + listen(handle: { + port?: number, + host?: string, + path?: string, + backlog?: number, + exclusive?: boolean, + readableAll?: boolean, + writableAll?: boolean, + ipv6Only?: boolean, + ... + }, callback?: Function): this; listening: boolean; close(callback?: (error: ?Error) => mixed): this; closeAllConnections(): void; @@ -2020,31 +1662,23 @@ declare class http$Server extends net$Server { } declare class https$Server extends tls$Server { - listen( - port?: number, - hostname?: string, - backlog?: number, - callback?: Function - ): this; + listen(port?: number, hostname?: string, backlog?: number, callback?: Function): this; // The following signatures are added to allow omitting intermediate arguments listen(port?: number, backlog?: number, callback?: Function): this; listen(port?: number, hostname?: string, callback?: Function): this; listen(port?: number, callback?: Function): this; listen(path: string, callback?: Function): this; - listen( - handle: { - port?: number, - host?: string, - path?: string, - backlog?: number, - exclusive?: boolean, - readableAll?: boolean, - writableAll?: boolean, - ipv6Only?: boolean, - ... - }, - callback?: Function - ): this; + listen(handle: { + port?: number, + host?: string, + path?: string, + backlog?: number, + exclusive?: boolean, + readableAll?: boolean, + writableAll?: boolean, + ipv6Only?: boolean, + ... + }, callback?: Function): this; close(callback?: (error: ?Error) => mixed): this; closeAllConnections(): void; closeIdleConnections(): void; @@ -2058,7 +1692,7 @@ type requestOptions = {| auth?: string, defaultPort?: number, family?: number, - headers?: {[key: string]: mixed, ...}, + headers?: { [key: string] : mixed, ... }, host?: string, hostname?: string, localAddress?: string, @@ -2069,35 +1703,26 @@ type requestOptions = {| setHost?: boolean, socketPath?: string, timeout?: number, -|}; +|} type http$requestOptions = { ...requestOptions, agent?: boolean | http$Agent, - createConnection?: ( - options: net$connectOptions, - callback?: Function - ) => net$Socket, + createConnection?: (options: net$connectOptions, callback?: Function) => net$Socket, ... }; -declare module 'http' { +declare module "http" { declare class Server extends http$Server {} declare class Agent extends http$Agent { - createConnection( - options: net$connectOptions, - callback?: Function - ): net$Socket; + createConnection(options: net$connectOptions, callback?: Function): net$Socket; } declare class ClientRequest extends http$ClientRequest {} declare class IncomingMessage extends http$IncomingMessage {} declare class ServerResponse extends http$ServerResponse {} declare function createServer( - requestListener?: ( - request: IncomingMessage, - response: ServerResponse - ) => void + requestListener?: (request: IncomingMessage, response: ServerResponse) => void ): Server; declare function request( options: http$requestOptions, @@ -2119,28 +1744,21 @@ declare module 'http' { ): ClientRequest; declare var METHODS: Array; - declare var STATUS_CODES: {[key: number]: string, ...}; + declare var STATUS_CODES: { [key: number]: string, ... }; declare var globalAgent: Agent; } type https$requestOptions = { ...requestOptions, agent?: boolean | http$Agent, - createConnection?: ( - options: tls$connectOptions, - callback?: Function - ) => tls$TLSSocket, + createConnection?: (options: tls$connectOptions, callback?: Function) => tls$TLSSocket, ... }; -declare module 'https' { +declare module "https" { declare class Server extends https$Server {} declare class Agent extends http$Agent { - createConnection( - port: ?number, - host: ?string, - options: tls$connectOptions - ): tls$TLSSocket; + createConnection(port: ?number, host: ?string, options: tls$connectOptions): tls$TLSSocket; createConnection(port: ?number, options: tls$connectOptions): tls$TLSSocket; createConnection(options: tls$connectOptions): tls$TLSSocket; } @@ -2151,10 +1769,7 @@ declare module 'https' { declare function createServer( options: Object, - requestListener?: ( - request: IncomingMessage, - response: ServerResponse - ) => void + requestListener?: (request: IncomingMessage, response: ServerResponse) => void ): Server; declare function request( options: https$requestOptions, @@ -2186,7 +1801,7 @@ type module$Module = { ... }; -declare module 'module' { +declare module "module" { declare module.exports: module$Module; } @@ -2197,21 +1812,13 @@ declare class net$Socket extends stream$Duplex { bytesRead: number; bytesWritten: number; connect(path: string, connectListener?: () => mixed): net$Socket; - connect( - port: number, - host?: string, - connectListener?: () => mixed - ): net$Socket; + connect(port: number, host?: string, connectListener?: () => mixed): net$Socket; connect(port: number, connectListener?: () => mixed): net$Socket; connect(options: Object, connectListener?: () => mixed): net$Socket; destroyed: boolean; end( - chunkOrEncodingOrCallback?: - | Buffer - | Uint8Array - | string - | ((data: any) => void), - encodingOrCallback?: string | ((data: any) => void), + chunkOrEncodingOrCallback?: Buffer | Uint8Array | string | (data: any) => void, + encodingOrCallback?: string | (data: any) => void, callback?: (data: any) => void ): this; localAddress: string; @@ -2229,18 +1836,13 @@ declare class net$Socket extends stream$Duplex { unref(): this; write( chunk: Buffer | Uint8Array | string, - encodingOrCallback?: string | ((data: any) => void), + encodingOrCallback?: string | (data: any) => void, callback?: (data: any) => void ): boolean; } declare class net$Server extends events$EventEmitter { - listen( - port?: number, - hostname?: string, - backlog?: number, - callback?: Function - ): net$Server; + listen(port?: number, hostname?: string, backlog?: number, callback?: Function): net$Server; listen(path: string, callback?: Function): net$Server; listen(handle: Object, callback?: Function): net$Server; listening: boolean; @@ -2249,10 +1851,11 @@ declare class net$Server extends events$EventEmitter { connections: number; maxConnections: number; getConnections(callback: Function): void; - ref(): net$Server; - unref(): net$Server; + ref(): net$Server; + unref(): net$Server; } + type net$connectOptions = { port?: number, host?: string, @@ -2268,7 +1871,8 @@ type net$connectOptions = { ... }; -declare module 'net' { +declare module "net" { + declare class Server extends net$Server {} declare class Socket extends net$Socket {} @@ -2276,29 +1880,28 @@ declare module 'net' { declare function isIPv4(input: string): boolean; declare function isIPv6(input: string): boolean; + declare type connectionListener = (socket: Socket) => any; declare function createServer( - options?: - | { - allowHalfOpen?: boolean, - pauseOnConnect?: boolean, - ... - } - | connectionListener, - connectionListener?: connectionListener + options?: { + allowHalfOpen?: boolean, + pauseOnConnect?: boolean, + ... + } | connectionListener, + connectionListener?: connectionListener, ): Server; declare type connectListener = () => any; declare function connect( - pathOrPortOrOptions: string | number | net$connectOptions, + pathOrPortOrOptions: string | number | net$connectOptions, hostOrConnectListener?: string | connectListener, - connectListener?: connectListener + connectListener?: connectListener, ): Socket; declare function createConnection( - pathOrPortOrOptions: string | number | net$connectOptions, + pathOrPortOrOptions: string | number | net$connectOptions, hostOrConnectListener?: string | connectListener, - connectListener?: connectListener + connectListener?: connectListener, ): Socket; } @@ -2343,37 +1946,28 @@ type os$UserInfo$string = { ... }; -declare module 'os' { - declare function arch(): 'x64' | 'arm' | 'ia32'; +declare module "os" { + declare function arch(): "x64"|"arm"|"ia32"; declare function availableParallelism(): number; declare function cpus(): Array; - declare function endianness(): 'BE' | 'LE'; + declare function endianness(): "BE"|"LE"; declare function freemem(): number; declare function homedir(): string; declare function hostname(): string; declare function loadavg(): [number, number, number]; - declare function networkInterfaces(): { - [ifName: string]: Array, - ... - }; + declare function networkInterfaces(): { [ifName: string]: Array, ... }; declare function platform(): string; declare function release(): string; declare function tmpdir(): string; declare function totalmem(): number; declare function type(): string; declare function uptime(): number; - declare function userInfo(options: { - encoding: 'buffer', - ... - }): os$UserInfo$buffer; - declare function userInfo(options?: { - encoding: 'utf8', - ... - }): os$UserInfo$string; + declare function userInfo(options: { encoding: 'buffer', ... }): os$UserInfo$buffer; + declare function userInfo(options?: { encoding: 'utf8', ... }): os$UserInfo$string; declare var EOL: string; } -declare module 'path' { +declare module "path" { declare function normalize(path: string): string; declare function join(...parts: Array): string; declare function resolve(...parts: Array): string; @@ -2404,7 +1998,7 @@ declare module 'path' { declare var win32: any; } -declare module 'punycode' { +declare module "punycode" { declare function decode(string: string): string; declare function encode(string: string): string; declare function toASCII(domain: string): string; @@ -2414,15 +2008,15 @@ declare module 'punycode' { encode: (codePoints: Array) => string, ... }; - declare var version: string; + declare var version : string; } -declare module 'querystring' { +declare module "querystring" { declare function stringify( obj: Object, separator?: string, equal?: string, - options?: {encodeURIComponent?: (str: string) => string, ...} + options?: { encodeURIComponent?: (str: string) => string, ... } ): string; declare function parse( str: string, @@ -2438,14 +2032,9 @@ declare module 'querystring' { declare function unescape(str: string, decodeSpaces?: boolean): string; } -type readline$InterfaceCompleter = ( - line: string -) => - | [Array, string] - | (( - line: string, - ((err: ?Error, data: [Array, string]) => void) - ) => void); +type readline$InterfaceCompleter = + | (line: string) => [Array, string] + | (line: string, (err: ?Error, data: [Array, string]) => void) => void; declare class readline$Interface extends events$EventEmitter { close(): void; @@ -2454,20 +2043,17 @@ declare class readline$Interface extends events$EventEmitter { question( query: string, optionsOrCallback: {|signal?: AbortSignal|} | ((answer: string) => void), - callback?: (answer: string) => void + callback?: (answer: string) => void, ): void; resume(): void; setPrompt(prompt: string): void; - write( - val: string | void | null, - key?: { - name: string, - ctrl?: boolean, - shift?: boolean, - meta?: boolean, - ... - } - ): void; + write(val: string | void | null, key?: { + name: string, + ctrl?: boolean, + shift?: boolean, + meta?: boolean, + ... + }): void; @@asyncIterator(): AsyncIterator; } @@ -2476,11 +2062,11 @@ declare module 'readline' { declare function clearLine( stream: stream$Stream, dir: -1 | 1 | 0, - callback?: () => void + callback?: () => void, ): void; declare function clearScreenDown( stream: stream$Stream, - callback?: () => void + callback?: () => void, ): void; declare function createInterface(opts: { completer?: readline$InterfaceCompleter, @@ -2498,17 +2084,17 @@ declare module 'readline' { stream: stream$Stream, x?: number, y?: number, - callback?: () => void + callback?: () => void, ): void; declare function moveCursor( stream: stream$Stream, dx: number, dy: number, - callback?: () => void + callback?: () => void, ): void; declare function emitKeypressEvents( stream: stream$Stream, - readlineInterface?: readline$Interface + readlineInterface?: readline$Interface, ): void; } @@ -2524,16 +2110,13 @@ type readableStreamOptions = { ... }; declare class stream$Readable extends stream$Stream { - static from( - iterable: Iterable | AsyncIterable, - options?: readableStreamOptions - ): stream$Readable; + static from(iterable: Iterable | AsyncIterable, options?: readableStreamOptions): stream$Readable; constructor(options?: readableStreamOptions): void; destroy(error?: Error): this; isPaused(): boolean; pause(): this; - pipe(dest: T, options?: {end?: boolean, ...}): T; + pipe(dest: T, options?: { end? : boolean, ... }): T; read(size?: number): ?(string | Buffer); readable: boolean; readableHighWaterMark: number; @@ -2545,7 +2128,7 @@ declare class stream$Readable extends stream$Stream { wrap(oldReadable: stream$Stream): this; _read(size: number): void; _destroy(error: ?Error, callback: (error?: Error) => void): void; - push(chunk: ?(Buffer | Uint8Array | string), encoding?: string): boolean; + push(chunk: ?(Buffer | Uint8Array | string), encoding? : string): boolean; @@asyncIterator(): AsyncIterator; } @@ -2555,19 +2138,12 @@ type writableStreamOptions = { defaultEncoding?: string, objectMode?: boolean, emitClose?: boolean, - write?: ( + write?: (chunk: Buffer | string, encoding: string, callback: (error?: Error) => void) => void, + writev?: (chunks: Array<{ chunk: Buffer | string, encoding: string, - callback: (error?: Error) => void - ) => void, - writev?: ( - chunks: Array<{ - chunk: Buffer | string, - encoding: string, - ... - }>, - callback: (error?: Error) => void - ) => void, + ... + }>, callback: (error?: Error) => void) => void, destroy?: (error: ?Error, callback: (error?: Error) => void) => void, final?: (callback: (error?: Error) => void) => void, autoDestroy?: boolean, @@ -2579,38 +2155,20 @@ declare class stream$Writable extends stream$Stream { destroy(error?: Error): this; end(callback?: () => void): this; end(chunk?: string | Buffer | Uint8Array, callback?: () => void): this; - end( - chunk?: string | Buffer | Uint8Array, - encoding?: string, - callback?: () => void - ): this; + end(chunk?: string | Buffer | Uint8Array, encoding?: string, callback?: () => void): this; setDefaultEncoding(encoding: string): this; uncork(): void; writable: boolean; writableHighWaterMark: number; writableLength: number; - write( - chunk: string | Buffer | Uint8Array, - callback?: (error?: Error) => void - ): boolean; - write( - chunk: string | Buffer | Uint8Array, - encoding?: string, - callback?: (error?: Error) => void - ): boolean; - _write( + write(chunk: string | Buffer | Uint8Array, callback?: (error?: Error) => void): boolean; + write(chunk: string | Buffer | Uint8Array, encoding?: string, callback?: (error?: Error) => void): boolean; + _write(chunk: Buffer | string, encoding: string, callback: (error?: Error) => void): void; + _writev(chunks: Array<{ chunk: Buffer | string, encoding: string, - callback: (error?: Error) => void - ): void; - _writev( - chunks: Array<{ - chunk: Buffer | string, - encoding: string, - ... - }>, - callback: (error?: Error) => void - ): void; + ... + }>, callback: (error?: Error) => void): void; _destroy(error: ?Error, callback: (error?: Error) => void): void; _final(callback: (error?: Error) => void): void; } @@ -2619,15 +2177,14 @@ declare class stream$Writable extends stream$Stream { //"Since JavaScript doesn't have multiple prototypal inheritance, this class //prototypally inherits from Readable, and then parasitically from Writable." //Source: void + callback: (error: ?Error, data: ?(Buffer | string)) => void, ) => void, ... }; @@ -2651,16 +2208,16 @@ declare class stream$Transform extends stream$Duplex { } declare class stream$PassThrough extends stream$Transform {} -declare module 'stream' { - declare var Stream: typeof stream$Stream; - declare var Readable: typeof stream$Readable; - declare var Writable: typeof stream$Writable; - declare var Duplex: typeof stream$Duplex; - declare var Transform: typeof stream$Transform; - declare var PassThrough: typeof stream$PassThrough; +declare module "stream" { + declare var Stream : typeof stream$Stream + declare var Readable : typeof stream$Readable + declare var Writable : typeof stream$Writable + declare var Duplex : typeof stream$Duplex + declare var Transform : typeof stream$Transform + declare var PassThrough : typeof stream$PassThrough declare function finished( stream: stream$Stream, - callback: (error?: Error) => void + callback: (error?: Error) => void, ): () => void; declare function finished( stream: stream$Stream, @@ -2670,25 +2227,25 @@ declare module 'stream' { writable?: boolean, ... }, - callback: (error?: Error) => void + callback: (error?: Error) => void, ): () => void; declare function pipeline( s1: stream$Readable, last: T, - cb: (error?: Error) => void + cb: (error?: Error) => void, ): T; declare function pipeline( s1: stream$Readable, s2: stream$Duplex, last: T, - cb: (error?: Error) => void + cb: (error?: Error) => void, ): T; declare function pipeline( s1: stream$Readable, s2: stream$Duplex, s3: stream$Duplex, last: T, - cb: (error?: Error) => void + cb: (error?: Error) => void, ): T; declare function pipeline( s1: stream$Readable, @@ -2696,7 +2253,7 @@ declare module 'stream' { s3: stream$Duplex, s4: stream$Duplex, last: T, - cb: (error?: Error) => void + cb: (error?: Error) => void, ): T; declare function pipeline( s1: stream$Readable, @@ -2705,7 +2262,7 @@ declare module 'stream' { s4: stream$Duplex, s5: stream$Duplex, last: T, - cb: (error?: Error) => void + cb: (error?: Error) => void, ): T; declare function pipeline( s1: stream$Readable, @@ -2715,36 +2272,36 @@ declare module 'stream' { s5: stream$Duplex, s6: stream$Duplex, last: T, - cb: (error?: Error) => void + cb: (error?: Error) => void, ): T; declare function pipeline( streams: Array, - cb: (error?: Error) => void + cb: (error?: Error) => void, ): stream$Stream; declare interface StreamPipelineOptions { - +signal?: AbortSignal; - +end?: boolean; + +signal?: AbortSignal, + +end?: boolean } declare type StreamPromise = { pipeline( s1: stream$Readable, last: stream$Writable, - options?: StreamPipelineOptions + options?: StreamPipelineOptions, ): Promise, pipeline( s1: stream$Readable, s2: stream$Duplex, last: stream$Writable, - options?: StreamPipelineOptions + options?: StreamPipelineOptions, ): Promise, pipeline( s1: stream$Readable, s2: stream$Duplex, s3: stream$Duplex, last: stream$Writable, - options?: StreamPipelineOptions + options?: StreamPipelineOptions, ): Promise, pipeline( s1: stream$Readable, @@ -2752,7 +2309,7 @@ declare module 'stream' { s3: stream$Duplex, s4: stream$Duplex, last: stream$Writable, - options?: StreamPipelineOptions + options?: StreamPipelineOptions, ): Promise, pipeline( s1: stream$Readable, @@ -2761,7 +2318,7 @@ declare module 'stream' { s4: stream$Duplex, s5: stream$Duplex, last: stream$Writable, - options?: StreamPipelineOptions + options?: StreamPipelineOptions, ): Promise, pipeline( s1: stream$Readable, @@ -2771,47 +2328,50 @@ declare module 'stream' { s5: stream$Duplex, s6: stream$Duplex, last: stream$Writable, - options?: StreamPipelineOptions + options?: StreamPipelineOptions, ): Promise, pipeline( streams: $ReadOnlyArray, - options?: StreamPipelineOptions - ): Promise, + options?: StreamPipelineOptions, + ): Promise; ... - }; + } declare var promises: StreamPromise; } declare class tty$ReadStream extends net$Socket { constructor(fd: number, options?: Object): void; - isRaw: boolean; - setRawMode(mode: boolean): void; - isTTY: true; + isRaw : boolean; + setRawMode(mode : boolean) : void; + isTTY : true } declare class tty$WriteStream extends net$Socket { - constructor(fd: number): void; + constructor(fd: number) : void; /** * Clears the current line of this `WriteStream` in a direction identified by `dir`. * * TODO: takes a callback and returns `boolean` in v12+ */ clearLine(dir: -1 | 0 | 1): void; - columns: number; + columns : number; /** * Moves this WriteStream's cursor to the specified position * * TODO: takes a callback and returns `boolean` in v12+ */ - cursorTo(x: number, y?: number): void; - isTTY: true; + cursorTo( + x: number, + y?: number + ): void; + isTTY : true; /** * Moves this WriteStream's cursor relative to its current position * * TODO: takes a callback and returns `boolean` in v12+ */ moveCursor(dx: number, dy: number): void; - rows: number; + rows : number; /** * Clears this WriteStream from the current cursor down. @@ -2829,10 +2389,10 @@ declare class tty$WriteStream extends net$Socket { * Disabling color support is also possible by using the NO_COLOR and NODE_DISABLE_COLORS environment variables. */ getColorDepth(env?: typeof process.env): - | 1 // 2 - | 4 // 16 - | 8 // 256 - | 24; // 16,777,216 + 1 | // 2 + 4 | // 16 + 8 | // 256 + 24; // 16,777,216 /** * Returns the size of the TTY corresponding to this WriteStream. The array is of the type [numColumns, numRows] where numColumns and numRows represent the number of columns and rows in the corresponding TTY. @@ -2854,11 +2414,11 @@ declare class tty$WriteStream extends net$Socket { hasColors(count?: number, env?: typeof process.env): boolean; } -declare module 'tty' { - declare function isatty(fd: number): boolean; - declare function setRawMode(mode: boolean): void; - declare var ReadStream: typeof tty$ReadStream; - declare var WriteStream: typeof tty$WriteStream; +declare module "tty" { + declare function isatty(fd : number) : boolean; + declare function setRawMode(mode : boolean) : void; + declare var ReadStream : typeof tty$ReadStream + declare var WriteStream : typeof tty$WriteStream } declare class string_decoder$StringDecoder { @@ -2867,8 +2427,8 @@ declare class string_decoder$StringDecoder { write(buffer: Buffer): string; } -declare module 'string_decoder' { - declare var StringDecoder: typeof string_decoder$StringDecoder; +declare module "string_decoder" { + declare var StringDecoder : typeof string_decoder$StringDecoder; } type tls$connectOptions = { @@ -2907,7 +2467,7 @@ type tls$Certificate = { fingerprint256: string, ext_key_usage?: Array, subjectaltname?: string, - infoAccess?: {[string]: Array, ...}, + infoAccess?: { [string]: Array, ... }, issuerCertificate?: tls$Certificate, ... }; @@ -2922,19 +2482,16 @@ declare class tls$TLSSocket extends net$Socket { version: string, ... } | null; - getEphemeralKeyInfo(): - | { - type: 'DH', - size: number, - ... - } - | { - type: 'EDHC', - name: string, - size: number, - ... - } - | null; + getEphemeralKeyInfo(): { + type: 'DH', + size: number, + ... + } | { + type: 'EDHC', + name: string, + size: number, + ... + } | null; getPeerCertificate(detailed?: boolean): tls$Certificate | null; getSession(): ?Buffer; getTLSTicket(): Buffer | void; @@ -2943,12 +2500,7 @@ declare class tls$TLSSocket extends net$Socket { } declare class tls$Server extends net$Server { - listen( - port?: number, - hostname?: string, - backlog?: number, - callback?: Function - ): tls$Server; + listen(port?: number, hostname?: string, backlog?: number, callback?: Function): tls$Server; listen(path: string, callback?: Function): tls$Server; listen(handle: Object, callback?: Function): tls$Server; close(callback?: Function): tls$Server; @@ -2957,47 +2509,24 @@ declare class tls$Server extends net$Server { setTicketKeys(keys: Buffer): void; } -declare module 'tls' { +declare module "tls" { declare var CLIENT_RENEG_LIMIT: number; declare var CLIENT_RENEG_WINDOW: number; declare var SLAB_BUFFER_SIZE: number; declare var DEFAULT_CIPHERS: string; declare var DEFAULT_ECDH_CURVE: string; declare function getCiphers(): Array; - declare function convertNPNProtocols( - NPNProtocols: Array, - out: Object - ): void; - declare function checkServerIdentity( - servername: string, - cert: string - ): Error | void; + declare function convertNPNProtocols(NPNProtocols: Array, out: Object): void; + declare function checkServerIdentity(servername: string, cert: string): Error | void; declare function parseCertString(s: string): Object; declare function createSecureContext(details: Object): Object; declare var SecureContext: Object; declare var TLSSocket: typeof tls$TLSSocket; declare var Server: typeof tls$Server; - declare function createServer( - options: Object, - secureConnectionListener?: Function - ): tls$Server; - declare function connect( - options: tls$connectOptions, - callback?: Function - ): tls$TLSSocket; - declare function connect( - port: number, - host?: string, - options?: tls$connectOptions, - callback?: Function - ): tls$TLSSocket; - declare function createSecurePair( - context?: Object, - isServer?: boolean, - requestCert?: boolean, - rejectUnauthorized?: boolean, - options?: Object - ): Object; + declare function createServer(options: Object, secureConnectionListener?: Function): tls$Server; + declare function connect(options: tls$connectOptions, callback?: Function): tls$TLSSocket; + declare function connect(port: number, host?: string, options?: tls$connectOptions, callback?: Function): tls$TLSSocket; + declare function createSecurePair(context?: Object, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean, options?: Object): Object; } type url$urlObject = { @@ -3015,7 +2544,7 @@ type url$urlObject = { ... }; -declare module 'url' { +declare module "url" { declare type Url = {| protocol: string | null, slashes: boolean | null, @@ -3025,37 +2554,25 @@ declare module 'url' { hostname: string | null, hash: string | null, search: string | null, - query: string | null | {[string]: string, ...}, + query: string | null | { [string]: string, ... }, pathname: string | null, path: string | null, href: string, - |}; + |} declare type UrlWithStringQuery = {| ...Url, - query: string | null, - |}; + query: string | null + |} declare type UrlWithParsedQuery = {| ...Url, - query: {[string]: string, ...}, - |}; + query: { [string]: string, ... } + |} - declare function parse( - urlStr: string, - parseQueryString: true, - slashesDenoteHost?: boolean - ): UrlWithParsedQuery; - declare function parse( - urlStr: string, - parseQueryString?: false | void, - slashesDenoteHost?: boolean - ): UrlWithStringQuery; - declare function parse( - urlStr: string, - parseQueryString?: boolean, - slashesDenoteHost?: boolean - ): Url; + declare function parse(urlStr: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery; + declare function parse(urlStr: string, parseQueryString?: false | void, slashesDenoteHost?: boolean): UrlWithStringQuery; + declare function parse(urlStr: string, parseQueryString?: boolean, slashesDenoteHost?: boolean): Url; declare function format(urlObj: url$urlObject): string; declare function resolve(from: string, to: string): string; declare function domainToASCII(domain: string): string; @@ -3067,25 +2584,11 @@ declare module 'url' { size: number; - constructor( - init?: - | string - | URLSearchParams - | Array<[string, string]> - | {[string]: string, ...} - ): void; + constructor(init?: string | URLSearchParams | Array<[string, string]> | { [string]: string, ... } ): void; append(name: string, value: string): void; delete(name: string, value?: void): void; entries(): Iterator<[string, string]>; - forEach( - callback: ( - this: This, - value: string, - name: string, - searchParams: URLSearchParams - ) => mixed, - thisArg?: This - ): void; + forEach(callback: (this : This, value: string, name: string, searchParams: URLSearchParams) => mixed, thisArg?: This): void; get(name: string): string | null; getAll(name: string): string[]; has(name: string, value?: string): boolean; @@ -3127,46 +2630,44 @@ type util$InspectOptions = { }; declare type util$ParseArgsOption = - | {| - type: 'boolean', - multiple?: false, - short?: string, - default?: boolean, - |} - | {| - type: 'boolean', - multiple: true, - short?: string, - default?: Array, - |} - | {| - type: 'string', - multiple?: false, - short?: string, - default?: string, - |} - | {| - type: 'string', - multiple: true, - short?: string, - default?: Array, - |}; +| {| + type: 'boolean', + multiple?: false, + short?: string, + default?: boolean, + |} +| {| + type: 'boolean', + multiple: true, + short?: string, + default?: Array, + |} +| {| + type: 'string', + multiple?: false, + short?: string, + default?: string, + |} +| {| + type: 'string', + multiple: true, + short?: string, + default?: Array, + |}; -type util$ParseArgsOptionToValue = TOption['type'] extends 'boolean' - ? TOption['multiple'] extends true - ? Array - : boolean - : TOption['type'] extends 'string' - ? TOption['multiple'] extends true - ? Array - : string - : empty; +type util$ParseArgsOptionToValue = + TOption['type'] extends 'boolean' ? + TOption['multiple'] extends true ? + Array : + boolean : + TOption['type'] extends 'string' ? + TOption['multiple'] extends true ? + Array : + string : + empty; type util$ParseArgsOptionsToValues = { - [key in keyof TOptions]: util$ParseArgsOptionToValue<{| - multiple: false, - ...TOptions[key], - |}>, + [key in keyof TOptions]: util$ParseArgsOptionToValue<{|multiple: false, ...TOptions[key]|}>, }; type util$ParseArgsToken = @@ -3188,7 +2689,7 @@ type util$ParseArgsToken = index: number, |}; -declare module 'util' { +declare module "util" { declare function debuglog(section: string): (data: any, ...args: any) => void; declare function format(format: string, ...placeholders: any): string; declare function log(string: string): void; @@ -3197,10 +2698,7 @@ declare module 'util' { declare function isRegExp(object: any): boolean; declare function isDate(object: any): boolean; declare function isError(object: any): boolean; - declare function inherits( - constructor: Function, - superConstructor: Function - ): void; + declare function inherits(constructor: Function, superConstructor: Function): void; declare function deprecate(f: Function, string: string): Function; declare function promisify(f: Function): Function; declare function callbackify(f: Function): Function; @@ -3234,18 +2732,12 @@ declare module 'util' { |}; declare class TextDecoder { - constructor( - encoding?: string, - options?: { - fatal?: boolean, - ignoreBOM?: boolean, - ... - } - ): void; - decode( - input?: ArrayBuffer | DataView | $TypedArray, - options?: {stream?: boolean, ...} - ): string; + constructor(encoding?: string, options: { + fatal?: boolean, + ignoreBOM?: boolean, + ... + }): void; + decode(input?: ArrayBuffer | DataView | $TypedArray, options?: { stream?: boolean, ... }): string; encoding: string; fatal: boolean; ignoreBOM: boolean; @@ -3253,56 +2745,52 @@ declare module 'util' { declare class TextEncoder { constructor(): void; - encode(input: string): Uint8Array; - encodeInto( - input: string, - buffer: Uint8Array - ): {written: number, read: number}; - encoding: 'utf-8'; + encode(input?: string): Uint8Array; + encoding: string; } declare var types: { - isAnyArrayBuffer: (value: mixed) => boolean, - isArgumentsObject: (value: mixed) => boolean, - isArrayBuffer: (value: mixed) => boolean, - isAsyncFunction: (value: mixed) => boolean, - isBigInt64Array: (value: mixed) => boolean, - isBigUint64Array: (value: mixed) => boolean, - isBooleanObject: (value: mixed) => boolean, - isBoxedPrimitive: (value: mixed) => boolean, - isDataView: (value: mixed) => boolean, - isDate: (value: mixed) => boolean, - isExternal: (value: mixed) => boolean, - isFloat32Array: (value: mixed) => boolean, - isFloat64Array: (value: mixed) => boolean, - isGeneratorFunction: (value: mixed) => boolean, - isGeneratorObject: (value: mixed) => boolean, - isInt8Array: (value: mixed) => boolean, - isInt16Array: (value: mixed) => boolean, - isInt32Array: (value: mixed) => boolean, - isMap: (value: mixed) => boolean, - isMapIterator: (value: mixed) => boolean, - isModuleNamespaceObject: (value: mixed) => boolean, - isNativeError: (value: mixed) => boolean, - isNumberObject: (value: mixed) => boolean, - isPromise: (value: mixed) => boolean, - isProxy: (value: mixed) => boolean, - isRegExp: (value: mixed) => boolean, - isSet: (value: mixed) => boolean, - isSetIterator: (value: mixed) => boolean, - isSharedArrayBuffer: (value: mixed) => boolean, - isStringObject: (value: mixed) => boolean, - isSymbolObject: (value: mixed) => boolean, - isTypedArray: (value: mixed) => boolean, - isUint8Array: (value: mixed) => boolean, - isUint8ClampedArray: (value: mixed) => boolean, - isUint16Array: (value: mixed) => boolean, - isUint32Array: (value: mixed) => boolean, - isWeakMap: (value: mixed) => boolean, - isWeakSet: (value: mixed) => boolean, - isWebAssemblyCompiledModule: (value: mixed) => boolean, + isAnyArrayBuffer: (value: mixed) => boolean; + isArgumentsObject:(value: mixed) => boolean; + isArrayBuffer:(value: mixed) => boolean; + isAsyncFunction:(value: mixed) => boolean; + isBigInt64Array:(value: mixed) => boolean; + isBigUint64Array:(value: mixed) => boolean; + isBooleanObject:(value: mixed) => boolean; + isBoxedPrimitive:(value: mixed) => boolean; + isDataView:(value: mixed) => boolean; + isDate:(value: mixed) => boolean; + isExternal:(value: mixed) => boolean; + isFloat32Array:(value: mixed) => boolean; + isFloat64Array:(value: mixed) => boolean; + isGeneratorFunction:(value: mixed) => boolean; + isGeneratorObject:(value: mixed) => boolean; + isInt8Array:(value: mixed) => boolean; + isInt16Array:(value: mixed) => boolean; + isInt32Array:(value: mixed) => boolean; + isMap:(value: mixed) => boolean; + isMapIterator:(value: mixed) => boolean; + isModuleNamespaceObject:(value: mixed) => boolean; + isNativeError:(value: mixed) => boolean; + isNumberObject:(value: mixed) => boolean; + isPromise:(value: mixed) => boolean; + isProxy:(value: mixed) => boolean; + isRegExp:(value: mixed) => boolean; + isSet:(value: mixed) => boolean; + isSetIterator:(value: mixed) => boolean; + isSharedArrayBuffer:(value: mixed) => boolean; + isStringObject:(value: mixed) => boolean; + isSymbolObject:(value: mixed) => boolean; + isTypedArray:(value: mixed) => boolean; + isUint8Array:(value: mixed) => boolean; + isUint8ClampedArray:(value: mixed) => boolean; + isUint16Array:(value: mixed) => boolean; + isUint32Array:(value: mixed) => boolean; + isWeakMap:(value: mixed) => boolean; + isWeakSet:(value: mixed) => boolean; + isWebAssemblyCompiledModule:(value: mixed) => boolean; ... - }; + } } type vm$ScriptOptions = { @@ -3317,73 +2805,49 @@ type vm$ScriptOptions = { }; type vm$CreateContextOptions = { - name?: string, - origin?: string, + name?: string; + origin?: string; codeGeneration?: { - strings?: boolean, - wasm?: boolean, + strings?: boolean; + wasm?: boolean; ... - }, + }; ... -}; +} type vm$CompileFunctionOptions = { - filename?: string, - lineOffset?: number, - columnOffset?: number, - cachedData?: Buffer, - produceCachedData?: boolean, - parsingContext?: {[key: string]: any, ...}, - contextExtensions?: Array<{[key: string]: any, ...}>, + filename?: string; + lineOffset?: number; + columnOffset?: number; + cachedData?: Buffer; + produceCachedData?: boolean; + parsingContext?: { [key: string]: any, ... }; + contextExtensions?: Array<{ [key: string]: any, ... }>; ... -}; +} declare class vm$Script { constructor(code: string, options?: vm$ScriptOptions | string): void; cachedData: ?Buffer; cachedDataRejected: ?boolean; cachedDataProduced: ?boolean; - runInContext( - contextifiedSandbox: vm$Context, - options?: vm$ScriptOptions - ): any; - runInNewContext( - sandbox?: {[key: string]: any, ...}, - options?: vm$ScriptOptions - ): any; + runInContext(contextifiedSandbox: vm$Context, options?: vm$ScriptOptions): any; + runInNewContext(sandbox?: { [key: string]: any, ... }, options?: vm$ScriptOptions): any; runInThisContext(options?: vm$ScriptOptions): any; createCachedData(): Buffer; } declare class vm$Context {} -declare module 'vm' { +declare module "vm" { declare var Script: typeof vm$Script; - declare function createContext( - sandbox?: interface {[key: string]: any}, - options?: vm$CreateContextOptions - ): vm$Context; - declare function isContext(sandbox: {[key: string]: any, ...}): boolean; - declare function runInContext( - code: string, - contextifiedSandbox: vm$Context, - options?: vm$ScriptOptions | string - ): any; + declare function createContext(sandbox?: interface { [key: string]: any }, options?: vm$CreateContextOptions): vm$Context; + declare function isContext(sandbox: { [key: string]: any, ... }): boolean; + declare function runInContext(code: string, contextifiedSandbox: vm$Context, options?: vm$ScriptOptions | string): any; declare function runInDebugContext(code: string): any; - declare function runInNewContext( - code: string, - sandbox?: {[key: string]: any, ...}, - options?: vm$ScriptOptions | string - ): any; - declare function runInThisContext( - code: string, - options?: vm$ScriptOptions | string - ): any; - declare function compileFunction( - code: string, - params: string[], - options: vm$CompileFunctionOptions - ): Function; + declare function runInNewContext(code: string, sandbox?: { [key: string]: any, ... }, options?: vm$ScriptOptions | string): any; + declare function runInThisContext(code: string, options?: vm$ScriptOptions | string): any; + declare function compileFunction(code: string, params: string[], options: vm$CompileFunctionOptions): Function; } type zlib$options = { @@ -3407,7 +2871,7 @@ type zlib$brotliOptions = { }, maxOutputLength?: number, ... -}; +} type zlib$syncFn = ( buffer: Buffer | $TypedArray | DataView | ArrayBuffer | string, @@ -3434,7 +2898,7 @@ type zlib$brotliAsyncFn = ( // Accessing the constants directly from the module is currently still // possible but should be considered deprecated. // ref: https://github.com/nodejs/node/blob/master/doc/api/zlib.md -declare module 'zlib' { +declare module "zlib" { declare var Z_NO_FLUSH: number; declare var Z_PARTIAL_FLUSH: number; declare var Z_SYNC_FLUSH: number; @@ -3612,12 +3076,8 @@ declare module 'zlib' { declare class DeflateRaw extends Zlib {} declare class InflateRaw extends Zlib {} declare class Unzip extends Zlib {} - declare function createBrotliCompress( - options?: zlib$brotliOptions - ): BrotliCompress; - declare function createBrotliDecompress( - options?: zlib$brotliOptions - ): BrotliDecompress; + declare function createBrotliCompress(options?: zlib$brotliOptions): BrotliCompress; + declare function createBrotliDecompress(options?: zlib$brotliOptions): BrotliDecompress; declare function createDeflate(options?: zlib$options): Deflate; declare function createInflate(options?: zlib$options): Inflate; declare function createDeflateRaw(options?: zlib$options): DeflateRaw; @@ -3645,29 +3105,29 @@ declare module 'zlib' { declare var inflateRawSync: zlib$syncFn; } -declare module 'assert' { +declare module "assert" { declare class AssertionError extends Error {} declare type AssertStrict = { - (value: any, message?: string): void, - ok(value: any, message?: string): void, - fail(message?: string | Error): void, + (value: any, message?: string): void; + ok(value: any, message?: string): void; + fail(message?: string | Error): void; // deprecated since v10.15 - fail(actual: any, expected: any, message: string, operator: string): void, - equal(actual: any, expected: any, message?: string): void, - notEqual(actual: any, expected: any, message?: string): void, - deepEqual(actual: any, expected: any, message?: string): void, - notDeepEqual(actual: any, expected: any, message?: string): void, + fail(actual: any, expected: any, message: string, operator: string): void; + equal(actual: any, expected: any, message?: string): void; + notEqual(actual: any, expected: any, message?: string): void; + deepEqual(actual: any, expected: any, message?: string): void; + notDeepEqual(actual: any, expected: any, message?: string): void; throws( block: Function, - error?: Function | RegExp | ((err: any) => boolean), + error?: Function | RegExp | (err: any) => boolean, message?: string - ): void, - doesNotThrow(block: Function, message?: string): void, - ifError(value: any): void, - AssertionError: typeof AssertionError, - strict: AssertStrict, + ): void; + doesNotThrow(block: Function, message?: string): void; + ifError(value: any): void; + AssertionError: typeof AssertionError; + strict: AssertStrict; ... - }; + } declare module.exports: { (value: any, message?: string): void, ok(value: any, message?: string): void, @@ -3684,15 +3144,15 @@ declare module 'assert' { notDeepStrictEqual(actual: any, expected: any, message?: string): void, throws( block: Function, - error?: Function | RegExp | ((err: any) => boolean), + error?: Function | RegExp | (err: any) => boolean, message?: string ): void, doesNotThrow(block: Function, message?: string): void, ifError(value: any): void, AssertionError: typeof AssertionError, - strict: AssertStrict, + strict: AssertStrict; ... - }; + } } type HeapCodeStatistics = { @@ -3885,7 +3345,10 @@ declare module 'v8' { declare function deserialize(data: Buffer | $TypedArray | DataView): any; } -type repl$DefineCommandOptions = (...args: Array) => void | { + +type repl$DefineCommandOptions = + | (...args: Array) => void + | { action: (...args: Array) => void, help?: string, ... @@ -3918,10 +3381,7 @@ declare module 'repl' { ignoreUndefined?: boolean, writer?: (object: any, options?: util$InspectOptions) => string, completer?: readline$InterfaceCompleter, - replMode?: - | $SymbolReplModeMagic - | $SymbolReplModeSloppy - | $SymbolReplModeStrict, + replMode?: $SymbolReplModeMagic | $SymbolReplModeSloppy | $SymbolReplModeStrict, breakEvalOnSigint?: boolean, ... }): REPLServer; @@ -3932,10 +3392,14 @@ declare module 'repl' { } declare module 'inspector' { - declare function open(port?: number, host?: string, wait?: boolean): void; + declare function open( + port?: number, + host?: string, + wait?: boolean + ): void; declare function close(): void; - declare function url(): string | void; + declare function url() : string | void; declare var console: Object; declare function waitForDebugger(): void; @@ -3944,7 +3408,11 @@ declare module 'inspector' { connect(): void; connectToMainThread(): void; disconnect(): void; - post(method: string, params?: Object, callback?: Function): void; + post( + method: string, + params?: Object, + callback?: Function + ): void; } } @@ -3954,94 +3422,85 @@ type process$CPUUsage = { user: number, system: number, ... -}; +} declare class Process extends events$EventEmitter { - abort(): void; + abort() : void; allowedNodeEnvironmentFlags: Set; - arch: string; - argv: Array; - chdir(directory: string): void; - config: Object; - connected: boolean; - cpuUsage(previousValue?: process$CPUUsage): process$CPUUsage; - cwd(): string; - disconnect?: () => void; - domain?: domain$Domain; - env: {[key: string]: string | void, ...}; + arch : string; + argv : Array; + chdir(directory : string) : void; + config : Object; + connected : boolean; + cpuUsage(previousValue?: process$CPUUsage) : process$CPUUsage; + cwd() : string; + disconnect? : () => void; + domain? : domain$Domain; + env : { [key: string] : string | void, ... }; emitWarning(warning: string | Error): void; - emitWarning( - warning: string, - typeOrCtor: string | ((...empty) => mixed) - ): void; - emitWarning( - warning: string, - type: string, - codeOrCtor: string | ((...empty) => mixed) - ): void; + emitWarning(warning: string, typeOrCtor: string | (...empty) => mixed): void; + emitWarning(warning: string, type: string, codeOrCtor: string | (...empty) => mixed): void; emitWarning( warning: string, type: string, code: string, ctor?: (...empty) => mixed ): void; - execArgv: Array; - execPath: string; - exit(code?: number): empty; - exitCode?: number; - getegid?: () => number; - geteuid?: () => number; - getgid?: () => number; - getgroups?: () => Array; - getuid?: () => number; + execArgv : Array; + execPath : string; + exit(code? : number) : empty; + exitCode? : number; + getegid? : () => number; + geteuid? : () => number; + getgid? : () => number; + getgroups? : () => Array; + getuid? : () => number; hrtime: { - (time?: [number, number]): [number, number], + (time?: [ number, number ]) : [ number, number ], bigint: () => bigint, ... }; - initgroups?: (user: number | string, extra_group: number | string) => void; - kill(pid: number, signal?: string | number): void; - mainModule: Object; - memoryUsage(): { + initgroups? : (user : number | string, extra_group : number | string) => void; + kill(pid : number, signal? : string | number) : void; + mainModule : Object; + memoryUsage() : { arrayBuffers: number, - rss: number, - heapTotal: number, - heapUsed: number, - external: number, + rss : number, + heapTotal : number, + heapUsed : number, + external : number, ... }; nextTick: (cb: (...T) => mixed, ...T) => void; - pid: number; - platform: string; - release: { - name: string, - lts?: string, - sourceUrl: string, - headersUrl: string, - libUrl: string, + pid : number; + platform : string; + release : { + name : string, + lts? : string, + sourceUrl : string, + headersUrl : string, + libUrl : string, ... }; - send?: ( - message: any, - sendHandleOrCallback?: net$Socket | net$Server | Function, - callback?: Function - ) => void; - setegid?: (id: number | string) => void; - seteuid?: (id: number | string) => void; - setgid?: (id: number | string) => void; - setgroups?: (groups: Array) => void; - setuid?: (id: number | string) => void; - stderr: stream$Writable | tty$WriteStream; - stdin: stream$Readable | tty$ReadStream; - stdout: stream$Writable | tty$WriteStream; - title: string; - umask(mask?: number): number; - uptime(): number; - version: string; - versions: { - [key: string]: ?string, - node: string, - v8: string, + send? : (message : any, + sendHandleOrCallback? : net$Socket | net$Server | Function, + callback? : Function) => void; + setegid? : (id : number | string) => void; + seteuid? : (id : number | string) => void; + setgid? : (id : number | string) => void; + setgroups? : (groups : Array) => void; + setuid? : (id : number | string) => void; + stderr : stream$Writable | tty$WriteStream; + stdin : stream$Readable | tty$ReadStream; + stdout : stream$Writable | tty$WriteStream; + title : string; + umask(mask? : number) : number; + uptime() : number; + version : string; + versions : { + [key: string] : ?string, + node : string, + v8 : string, ... }; } @@ -4050,10 +3509,7 @@ declare var process: Process; declare var __filename: string; declare var __dirname: string; -declare function setImmediate( - callback: (...args: Array) => mixed, - ...args: Array -): Object; +declare function setImmediate(callback: ((...args: Array) => mixed), ...args: Array): Object; declare function clearImmediate(immediateObject: any): Object; // https://nodejs.org/api/esm.html#node-imports @@ -4066,6 +3522,10 @@ declare module 'node:assert/strict' { declare module.exports: $Exports<'assert'>['strict']; } +declare module 'node:crypto' { + declare module.exports: $Exports<'crypto'>; +} + declare module 'node:events' { declare module.exports: $Exports<'events'>; } @@ -4098,6 +3558,10 @@ declare module 'node:process' { declare module.exports: $Exports<'process'>; } +declare module 'node:readline' { + declare module.exports: $Exports<'readline'>; +} + declare module 'node:util' { declare module.exports: $Exports<'util'>; } @@ -4119,56 +3583,41 @@ declare module 'worker_threads' { declare class MessagePort extends events$EventEmitter { close(): void; - postMessage( - value: any, - transferList?: Array - ): void; + postMessage(value: any, transferList?: Array): void; ref(): void; unref(): void; start(): void; - addListener(event: 'close', listener: () => void): this; - addListener(event: 'message', listener: (value: any) => void): this; - addListener( - event: string | Symbol, - listener: (...args: any[]) => void - ): this; + addListener(event: "close", listener: () => void): this; + addListener(event: "message", listener: (value: any) => void): this; + addListener(event: string | Symbol, listener: (...args: any[]) => void): this; - emit(event: 'close'): boolean; - emit(event: 'message', value: any): boolean; + emit(event: "close"): boolean; + emit(event: "message", value: any): boolean; emit(event: string | Symbol, ...args: any[]): boolean; - on(event: 'close', listener: () => void): this; - on(event: 'message', listener: (value: any) => void): this; + on(event: "close", listener: () => void): this; + on(event: "message", listener: (value: any) => void): this; on(event: string | Symbol, listener: (...args: any[]) => void): this; - once(event: 'close', listener: () => void): this; - once(event: 'message', listener: (value: any) => void): this; + once(event: "close", listener: () => void): this; + once(event: "message", listener: (value: any) => void): this; once(event: string | Symbol, listener: (...args: any[]) => void): this; - prependListener(event: 'close', listener: () => void): this; - prependListener(event: 'message', listener: (value: any) => void): this; - prependListener( - event: string | Symbol, - listener: (...args: any[]) => void - ): this; - - prependOnceListener(event: 'close', listener: () => void): this; - prependOnceListener(event: 'message', listener: (value: any) => void): this; - prependOnceListener( - event: string | Symbol, - listener: (...args: any[]) => void - ): this; - - removeListener(event: 'close', listener: () => void): this; - removeListener(event: 'message', listener: (value: any) => void): this; - removeListener( - event: string | Symbol, - listener: (...args: any[]) => void - ): this; - - off(event: 'close', listener: () => void): this; - off(event: 'message', listener: (value: any) => void): this; + prependListener(event: "close", listener: () => void): this; + prependListener(event: "message", listener: (value: any) => void): this; + prependListener(event: string | Symbol, listener: (...args: any[]) => void): this; + + prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "message", listener: (value: any) => void): this; + prependOnceListener(event: string | Symbol, listener: (...args: any[]) => void): this; + + removeListener(event: "close", listener: () => void): this; + removeListener(event: "message", listener: (value: any) => void): this; + removeListener(event: string | Symbol, listener: (...args: any[]) => void): this; + + off(event: "close", listener: () => void): this; + off(event: "message", listener: (value: any) => void): this; off(event: string | Symbol, listener: (...args: any[]) => void): this; } @@ -4179,8 +3628,8 @@ declare module 'worker_threads' { stdin?: boolean, stdout?: boolean, stderr?: boolean, - execArgv?: string[], - |}; + execArgv?: string[] + |} declare class Worker extends events$EventEmitter { +stdin: stream$Writable | null; @@ -4190,10 +3639,7 @@ declare module 'worker_threads' { constructor(filename: string, options?: WorkerOptions): void; - postMessage( - value: any, - transferList?: Array - ): void; + postMessage(value: any, transferList?: Array): void; ref(): void; unref(): void; terminate(callback?: (err: Error, exitCode: number) => void): void; @@ -4211,72 +3657,54 @@ declare module 'worker_threads' { * `EventEmitter`, and only `port.onmessage()` can be used to receive * events using it. */ - moveMessagePortToContext( - port: MessagePort, - context: vm$Context - ): MessagePort; - - addListener(event: 'error', listener: (err: Error) => void): this; - addListener(event: 'exit', listener: (exitCode: number) => void): this; - addListener(event: 'message', listener: (value: any) => void): this; - addListener(event: 'online', listener: () => void): this; - addListener( - event: string | Symbol, - listener: (...args: any[]) => void - ): this; - - emit(event: 'error', err: Error): boolean; - emit(event: 'exit', exitCode: number): boolean; - emit(event: 'message', value: any): boolean; - emit(event: 'online'): boolean; + moveMessagePortToContext(port: MessagePort, context: vm$Context): MessagePort; + + addListener(event: "error", listener: (err: Error) => void): this; + addListener(event: "exit", listener: (exitCode: number) => void): this; + addListener(event: "message", listener: (value: any) => void): this; + addListener(event: "online", listener: () => void): this; + addListener(event: string | Symbol, listener: (...args: any[]) => void): this; + + emit(event: "error", err: Error): boolean; + emit(event: "exit", exitCode: number): boolean; + emit(event: "message", value: any): boolean; + emit(event: "online"): boolean; emit(event: string | Symbol, ...args: any[]): boolean; - on(event: 'error', listener: (err: Error) => void): this; - on(event: 'exit', listener: (exitCode: number) => void): this; - on(event: 'message', listener: (value: any) => void): this; - on(event: 'online', listener: () => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: "exit", listener: (exitCode: number) => void): this; + on(event: "message", listener: (value: any) => void): this; + on(event: "online", listener: () => void): this; on(event: string | Symbol, listener: (...args: any[]) => void): this; - once(event: 'error', listener: (err: Error) => void): this; - once(event: 'exit', listener: (exitCode: number) => void): this; - once(event: 'message', listener: (value: any) => void): this; - once(event: 'online', listener: () => void): this; + once(event: "error", listener: (err: Error) => void): this; + once(event: "exit", listener: (exitCode: number) => void): this; + once(event: "message", listener: (value: any) => void): this; + once(event: "online", listener: () => void): this; once(event: string | Symbol, listener: (...args: any[]) => void): this; - prependListener(event: 'error', listener: (err: Error) => void): this; - prependListener(event: 'exit', listener: (exitCode: number) => void): this; - prependListener(event: 'message', listener: (value: any) => void): this; - prependListener(event: 'online', listener: () => void): this; - prependListener( - event: string | Symbol, - listener: (...args: any[]) => void - ): this; - - prependOnceListener(event: 'error', listener: (err: Error) => void): this; - prependOnceListener( - event: 'exit', - listener: (exitCode: number) => void - ): this; - prependOnceListener(event: 'message', listener: (value: any) => void): this; - prependOnceListener(event: 'online', listener: () => void): this; - prependOnceListener( - event: string | Symbol, - listener: (...args: any[]) => void - ): this; - - removeListener(event: 'error', listener: (err: Error) => void): this; - removeListener(event: 'exit', listener: (exitCode: number) => void): this; - removeListener(event: 'message', listener: (value: any) => void): this; - removeListener(event: 'online', listener: () => void): this; - removeListener( - event: string | Symbol, - listener: (...args: any[]) => void - ): this; - - off(event: 'error', listener: (err: Error) => void): this; - off(event: 'exit', listener: (exitCode: number) => void): this; - off(event: 'message', listener: (value: any) => void): this; - off(event: 'online', listener: () => void): this; + prependListener(event: "error", listener: (err: Error) => void): this; + prependListener(event: "exit", listener: (exitCode: number) => void): this; + prependListener(event: "message", listener: (value: any) => void): this; + prependListener(event: "online", listener: () => void): this; + prependListener(event: string | Symbol, listener: (...args: any[]) => void): this; + + prependOnceListener(event: "error", listener: (err: Error) => void): this; + prependOnceListener(event: "exit", listener: (exitCode: number) => void): this; + prependOnceListener(event: "message", listener: (value: any) => void): this; + prependOnceListener(event: "online", listener: () => void): this; + prependOnceListener(event: string | Symbol, listener: (...args: any[]) => void): this; + + removeListener(event: "error", listener: (err: Error) => void): this; + removeListener(event: "exit", listener: (exitCode: number) => void): this; + removeListener(event: "message", listener: (value: any) => void): this; + removeListener(event: "online", listener: () => void): this; + removeListener(event: string | Symbol, listener: (...args: any[]) => void): this; + + off(event: "error", listener: (err: Error) => void): this; + off(event: "exit", listener: (exitCode: number) => void): this; + off(event: "message", listener: (value: any) => void): this; + off(event: "online", listener: () => void): this; off(event: string | Symbol, listener: (...args: any[]) => void): this; } } diff --git a/flow-typed/environments/serviceworkers.js b/flow-typed/environments/serviceworkers.js index 86479648e2e..f26c12edd49 100644 --- a/flow-typed/environments/serviceworkers.js +++ b/flow-typed/environments/serviceworkers.js @@ -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; - navigate(url: string): Promise; + visibilityState: VisibilityState, + focused: boolean, + focus(): Promise, + navigate(url: string): Promise, } declare class Client { - id: string; - reserved: boolean; - url: string; - frameType: FrameType; - postMessage(message: any, transfer?: Iterator | Array): void; + id: string, + reserved: boolean, + url: string, + frameType: FrameType, + postMessage(message: any, transfer?: Iterator | Array): void, } declare class ExtendableEvent extends Event { - waitUntil(f: Promise): void; + waitUntil(f: Promise): 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): void; - preloadResponse: Promise; + request: Request, + clientId: string, + isReload: boolean, + respondWith(response: Response | Promise): void, + preloadResponse: Promise, } type ClientType = 'window' | 'worker' | 'sharedworker' | 'all'; @@ -63,68 +63,65 @@ type ClientQueryOptions = { }; declare class Clients { - get(id: string): Promise; - matchAll(options?: ClientQueryOptions): Promise>; - openWindow(url: string): Promise; - claim(): Promise; + get(id: string): Promise, + matchAll(options?: ClientQueryOptions): Promise>, + openWindow(url: string): Promise, + claim(): Promise, } -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): void; + postMessage(message: any, transfer?: Iterator): void, - onstatechange?: EventHandler; + onstatechange?: EventHandler, } declare class NavigationPreloadState { - enabled: boolean; - headerValue: string; + enabled: boolean, + headerValue: string, } declare class NavigationPreloadManager { - enable: Promise; - disable: Promise; - setHeaderValue(value: string): Promise; - getState: Promise; + enable: Promise, + disable: Promise, + setHeaderValue(value: string): Promise, + getState: Promise, } 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; + +endpoint: string, + +expirationTime: number | null, + +options: PushSubscriptionOptions, + getKey(name: string): ArrayBuffer | null, + toJSON(): PushSubscriptionJSON, + unsubscribe(): Promise, } declare class PushManager { - +supportedContentEncodings: Array; - subscribe(options?: PushSubscriptionOptions): Promise; - getSubscription(): Promise; - permissionState( - options?: PushSubscriptionOptions - ): Promise<'granted' | 'denied' | 'prompt'>; + +supportedContentEncodings: Array, + subscribe(options?: PushSubscriptionOptions): Promise, + getSubscription(): Promise, + 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; - - getNotifications?: ( - filter?: GetNotificationOptions - ) => Promise<$ReadOnlyArray>; - showNotification?: ( - title: string, - options?: NotificationOptions - ) => Promise; - update(): Promise; - unregister(): Promise; - - onupdatefound?: EventHandler; + +installing: ?ServiceWorker, + +waiting: ?ServiceWorker, + +active: ?ServiceWorker, + +navigationPreload: NavigationPreloadManager, + +scope: string, + +updateViaCache: ServiceWorkerUpdateViaCache, + +pushManager: PushManager, + + getNotifications?: (filter?: GetNotificationOptions) => Promise<$ReadOnlyArray>, + showNotification?: (title: string, options?: NotificationOptions) => Promise, + update(): Promise, + unregister(): Promise, + + onupdatefound?: EventHandler, } type WorkerType = 'classic' | 'module'; @@ -166,41 +158,39 @@ type RegistrationOptions = { }; declare class ServiceWorkerContainer extends EventTarget { - +controller: ?ServiceWorker; - +ready: Promise; + +controller: ?ServiceWorker, + +ready: Promise, - getRegistration( - clientURL?: string - ): Promise; - getRegistrations(): Promise>; + getRegistration(clientURL?: string): Promise, + getRegistrations(): Promise>, register( scriptURL: string | TrustedScriptURL, options?: RegistrationOptions - ): Promise; - startMessages(): void; + ): Promise, + 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; - source: ?(ServiceWorker | MessagePort); + data: any, + lastEventId: string, + origin: string, + ports: Array, + source: ?(ServiceWorker | MessagePort), } declare class ExtendableMessageEvent extends ExtendableEvent { - data: any; - lastEventId: string; - origin: string; - ports: Array; - source: ?(ServiceWorker | MessagePort); + data: any, + lastEventId: string, + origin: string, + ports: Array, + source: ?(ServiceWorker | MessagePort), } type CacheQueryOptions = { @@ -209,30 +199,30 @@ type CacheQueryOptions = { ignoreVary?: boolean, cacheName?: string, ... -}; +} declare class Cache { - match(request: RequestInfo, options?: CacheQueryOptions): Promise; + match(request: RequestInfo, options?: CacheQueryOptions): Promise, matchAll( request: RequestInfo, options?: CacheQueryOptions - ): Promise>; - add(request: RequestInfo): Promise; - addAll(requests: Array): Promise; - put(request: RequestInfo, response: Response): Promise; - delete(request: RequestInfo, options?: CacheQueryOptions): Promise; + ): Promise>, + add(request: RequestInfo): Promise, + addAll(requests: Array): Promise, + put(request: RequestInfo, response: Response): Promise, + delete(request: RequestInfo, options?: CacheQueryOptions): Promise, keys( request?: RequestInfo, options?: CacheQueryOptions - ): Promise>; + ): Promise>, } declare class CacheStorage { - match(request: RequestInfo, options?: CacheQueryOptions): Promise; - has(cacheName: string): Promise; - open(cacheName: string): Promise; - delete(cacheName: string): Promise; - keys(): Promise>; + match(request: RequestInfo, options?: CacheQueryOptions): Promise, + has(cacheName: string): Promise, + open(cacheName: string): Promise, + delete(cacheName: string): Promise, + keys(): Promise>, } // Service worker global scope diff --git a/flow-typed/environments/streams.js b/flow-typed/environments/streams.js index 17bfae29e61..3fd1200f062 100644 --- a/flow-typed/environments/streams.js +++ b/flow-typed/environments/streams.js @@ -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: string): 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; - pull?: (controller: ReadableStreamController) => ?Promise; - cancel?: (reason: string) => ?Promise; + start?: (controller: ReadableStreamController) => ?Promise, + pull?: (controller: ReadableStreamController) => ?Promise, + cancel?: (reason: string) => ?Promise, } declare class TransformStream { - readable: ReadableStream; - writable: WritableStream; -} + readable: ReadableStream, + writable: WritableStream, +}; interface PipeThroughTransformStream { - readable: ReadableStream; - writable: WritableStream; + readable: ReadableStream, + writable: WritableStream, } type PipeToOptions = { @@ -77,7 +77,7 @@ type PipeToOptions = { ... }; -type QueuingStrategy = { +type QueuingStrategy = { highWaterMark: number, size(chunk: ?any): number, ... @@ -86,51 +86,51 @@ type QueuingStrategy = { declare class ReadableStream { constructor( underlyingSource: ?UnderlyingSource, - queuingStrategy: ?QueuingStrategy - ): void; + queuingStrategy: ?QueuingStrategy, + ): void, - locked: boolean; + locked: boolean, - cancel(reason: string): void; - getReader(): ReadableStreamReader; - pipeThrough(transform: PipeThroughTransformStream, options: ?any): void; - pipeTo(dest: WritableStream, options: ?PipeToOptions): Promise; - tee(): [ReadableStream, ReadableStream]; -} + cancel(reason: string): void, + getReader(): ReadableStreamReader, + pipeThrough(transform: PipeThroughTransformStream, options: ?any): void, + pipeTo(dest: WritableStream, options: ?PipeToOptions): Promise, + 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: string) => ?Promise; - close?: (controller: WritableStreamController) => ?Promise; - start?: (controller: WritableStreamController) => ?Promise; - write?: (chunk: any, controller: WritableStreamController) => ?Promise; + abort?: (reason: string) => ?Promise, + close?: (controller: WritableStreamController) => ?Promise, + start?: (controller: WritableStreamController) => ?Promise, + write?: (chunk: any, controller: WritableStreamController) => ?Promise, } declare interface WritableStreamWriter { - closed: Promise; - desiredSize?: number; - ready: Promise; - - abort(reason: string): ?Promise; - close(): Promise; - releaseLock(): void; - write(chunk: any): Promise; + closed: Promise, + desiredSize?: number, + ready: Promise, + + abort(reason: string): ?Promise, + close(): Promise, + releaseLock(): void, + write(chunk: any): Promise, } 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, } diff --git a/flow-typed/npm/error-stack-parser_v2.x.x.js b/flow-typed/npm/error-stack-parser_v2.x.x.js index d23b837af25..ee8190cf3fa 100644 --- a/flow-typed/npm/error-stack-parser_v2.x.x.js +++ b/flow-typed/npm/error-stack-parser_v2.x.x.js @@ -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; diff --git a/flow-typed/npm/minimist_v1.x.x.js b/flow-typed/npm/minimist_v1.x.x.js index 9da29ffe60c..9e64e11f428 100644 --- a/flow-typed/npm/minimist_v1.x.x.js +++ b/flow-typed/npm/minimist_v1.x.x.js @@ -5,8 +5,8 @@ declare module 'minimist' { declare type minimistOptions = { string?: string | Array, boolean?: boolean | string | Array, - alias?: {[arg: string]: string | Array, ...}, - default?: {[arg: string]: any, ...}, + alias?: { [arg: string]: string | Array, ... }, + 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, - opts?: minimistOptions - ) => minimistOutput; + declare module.exports: (argv: Array, opts?: minimistOptions) => minimistOutput; } diff --git a/package.json b/package.json index 6969bc14f86..af3b4b1e624 100644 --- a/package.json +++ b/package.json @@ -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.281.0", + "flow-remove-types": "^2.281.0", "flow-typed": "^4.1.1", "glob": "^7.1.6", "glob-stream": "^6.1.0", diff --git a/packages/internal-test-utils/internalAct.js b/packages/internal-test-utils/internalAct.js index 1a420bcf203..0bd87ef0457 100644 --- a/packages/internal-test-utils/internalAct.js +++ b/packages/internal-test-utils/internalAct.js @@ -165,6 +165,7 @@ export async function act(scope: () => Thenable): Thenable { } // $FlowFixMe[incompatible-return] + // $FlowFixMe[incompatible-type] return result; } finally { const depth = actingUpdatesScopeDepth; @@ -287,6 +288,7 @@ export async function serverAct(scope: () => Thenable): Thenable { } // $FlowFixMe[incompatible-return] + // $FlowFixMe[incompatible-type] return result; } finally { if (typeof process === 'object') { diff --git a/packages/react-client/src/ReactClientConsoleConfigBrowser.js b/packages/react-client/src/ReactClientConsoleConfigBrowser.js index f67e4afa0c4..3a8625177ea 100644 --- a/packages/react-client/src/ReactClientConsoleConfigBrowser.js +++ b/packages/react-client/src/ReactClientConsoleConfigBrowser.js @@ -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': { @@ -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 } diff --git a/packages/react-client/src/ReactClientConsoleConfigPlain.js b/packages/react-client/src/ReactClientConsoleConfigPlain.js index ee4c87ca613..3841007b492 100644 --- a/packages/react-client/src/ReactClientConsoleConfigPlain.js +++ b/packages/react-client/src/ReactClientConsoleConfigPlain.js @@ -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': { @@ -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 } diff --git a/packages/react-client/src/ReactClientConsoleConfigServer.js b/packages/react-client/src/ReactClientConsoleConfigServer.js index 6e69ef12a3c..6663549fbd7 100644 --- a/packages/react-client/src/ReactClientConsoleConfigServer.js +++ b/packages/react-client/src/ReactClientConsoleConfigServer.js @@ -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': { @@ -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 } diff --git a/packages/react-client/src/ReactFlightClient.js b/packages/react-client/src/ReactFlightClient.js index 49da30ccf4c..4beb9fe6617 100644 --- a/packages/react-client/src/ReactFlightClient.js +++ b/packages/react-client/src/ReactFlightClient.js @@ -283,12 +283,12 @@ ReactPromise.prototype.then = function ( const rejectCallback = reject; const wrapperPromise: Promise = 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); }; @@ -720,6 +720,7 @@ function triggerErrorOnChunk( const streamChunk: InitializedStreamChunk = (chunk: any); const controller = streamChunk.reason; // $FlowFixMe[incompatible-call]: The error method should accept mixed. + // $FlowFixMe[incompatible-type] controller.error(error); return; } @@ -3207,6 +3208,7 @@ function startReadableStream( error(error: mixed): void { if (previousBlockedChunk === null) { // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] controller.error(error); } else { const blockedChunk = previousBlockedChunk; @@ -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; @@ -4266,7 +4268,7 @@ function logComponentInfo( childrenEndTime: number, isLastComponent: boolean, ): void { - // $FlowFixMe: Refined. + // $FlowFixMe[incompatible-use]: Refined. if ( isLastComponent && root.status === ERRORED && @@ -4445,7 +4447,7 @@ function flushComponentPerformance( if (componentEndTime > childrenEndTime) { childrenEndTime = componentEndTime; } - // $FlowFixMe: Refined. + // $FlowFixMe[incompatible-type]: Refined. const componentInfo: ReactComponentInfo = candidateInfo; logComponentInfo( response, @@ -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; @@ -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( diff --git a/packages/react-client/src/ReactFlightClientStreamConfigNode.js b/packages/react-client/src/ReactFlightClientStreamConfigNode.js index f544759ccce..c043447398c 100644 --- a/packages/react-client/src/ReactFlightClientStreamConfigNode.js +++ b/packages/react-client/src/ReactFlightClientStreamConfigNode.js @@ -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, diff --git a/packages/react-client/src/ReactFlightReplyClient.js b/packages/react-client/src/ReactFlightReplyClient.js index f75f54f4ead..0b0e71b6a3a 100644 --- a/packages/react-client/src/ReactFlightReplyClient.js +++ b/packages/react-client/src/ReactFlightReplyClient.js @@ -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? @@ -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); @@ -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); } @@ -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); } } @@ -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; @@ -1184,6 +1189,7 @@ function bind(this: Function): Function { if (!referenceClosure) { // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] return FunctionBind.apply(this, arguments); } diff --git a/packages/react-debug-tools/src/ReactDebugHooks.js b/packages/react-debug-tools/src/ReactDebugHooks.js index db9495a97dd..89f4609e289 100644 --- a/packages/react-debug-tools/src/ReactDebugHooks.js +++ b/packages/react-debug-tools/src/ReactDebugHooks.js @@ -726,9 +726,11 @@ function useActionState( function useHostTransitionStatus(): TransitionStatus { const status = readContext( + // $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), ); diff --git a/packages/react-devtools-core/src/backend.js b/packages/react-devtools-core/src/backend.js index 9305155ab0e..c5f3fce8771 100644 --- a/packages/react-devtools-core/src/backend.js +++ b/packages/react-devtools-core/src/backend.js @@ -188,7 +188,7 @@ export function connectToDevTools(options: ?ConnectOptions) { } // TODO (npm-packages) Warn if "isBackendStorageAPISupported" - // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] found when upgrading Flow const agent = new Agent(bridge, isProfiling, onReloadAndProfile); if (typeof onReloadAndProfileFlagsReset === 'function') { onReloadAndProfileFlagsReset(); @@ -212,7 +212,7 @@ export function connectToDevTools(options: ?ConnectOptions) { // Setup React Native style editor if the environment supports it. if (resolveRNStyle != null || hook.resolveRNStyle != null) { setupNativeStyleEditor( - // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] found when upgrading Flow bridge, agent, ((resolveRNStyle || hook.resolveRNStyle: any): ResolveNativeStyle), diff --git a/packages/react-devtools-core/src/standalone.js b/packages/react-devtools-core/src/standalone.js index f8286783a9b..d7cd070aa2c 100644 --- a/packages/react-devtools-core/src/standalone.js +++ b/packages/react-devtools-core/src/standalone.js @@ -265,7 +265,7 @@ function initialize(socket: WebSocket) { socket.close(); }); - // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] found when upgrading Flow store = new Store(bridge, { checkBridgeProtocolCompatibility: true, supportsTraceUpdates: true, diff --git a/packages/react-devtools-shared/src/backend/fiber/renderer.js b/packages/react-devtools-shared/src/backend/fiber/renderer.js index 4f755fda293..a395f5df93c 100644 --- a/packages/react-devtools-shared/src/backend/fiber/renderer.js +++ b/packages/react-devtools-shared/src/backend/fiber/renderer.js @@ -3770,7 +3770,7 @@ export function attach( start, end, value: promise, - // $FlowFixMe: This field doesn't usually take a Fiber but we're only using inside this file. + // $FlowFixMe[incompatible-type]: This field doesn't usually take a Fiber but we're only using inside this file. owner: fiber, // Allow linking to the if it's not filtered. }; if (byteSize > 0) { @@ -3779,7 +3779,7 @@ export function attach( } const asyncInfo: ReactAsyncInfo = { awaited: ioInfo, - // $FlowFixMe: This field doesn't usually take a Fiber but we're only using inside this file. + // $FlowFixMe[incompatible-type]: This field doesn't usually take a Fiber but we're only using inside this file. owner: fiber._debugOwner == null ? null : fiber._debugOwner, debugStack: fiber._debugStack == null ? null : fiber._debugStack, debugTask: fiber._debugTask == null ? null : fiber._debugTask, @@ -3886,7 +3886,7 @@ export function attach( start, end, value: promise, - // $FlowFixMe: This field doesn't usually take a Fiber but we're only using inside this file. + // $FlowFixMe[incompatible-type]: This field doesn't usually take a Fiber but we're only using inside this file. owner: fiber, // Allow linking to the if it's not filtered. }; if (byteSize > 0) { @@ -3895,7 +3895,7 @@ export function attach( } const asyncInfo: ReactAsyncInfo = { awaited: ioInfo, - // $FlowFixMe: This field doesn't usually take a Fiber but we're only using inside this file. + // $FlowFixMe[incompatible-type]: This field doesn't usually take a Fiber but we're only using inside this file. owner: fiber._debugOwner == null ? null : fiber._debugOwner, debugStack: fiber._debugStack == null ? null : fiber._debugStack, debugTask: fiber._debugTask == null ? null : fiber._debugTask, @@ -4701,7 +4701,7 @@ export function attach( return; } pushOperation(SUSPENSE_TREE_OPERATION_REORDER_CHILDREN); - // $FlowFixMe[incompatible-call] TODO: Allow filtering SuspenseNode + // $FlowFixMe[incompatible-type] TODO: Allow filtering SuspenseNode pushOperation(parentInstance.instance.id); pushOperation(numChildren); for (let i = 0; i < nextChildren.length; i++) { @@ -6053,7 +6053,7 @@ export function attach( function getNearestMountedDOMNode(publicInstance: Element): null | Element { let domNode: null | Element = publicInstance; while (domNode && !publicInstanceToDevToolsInstanceMap.has(domNode)) { - // $FlowFixMe: In practice this is either null or Element. + // $FlowFixMe[incompatible-type]: In practice this is either null or Element. domNode = domNode.parentNode; } return domNode; @@ -8807,7 +8807,7 @@ export function attach( return (instance.source = extractLocationFromComponentStack(lastLine)); } - // $FlowFixMe: refined. + // $FlowFixMe[incompatible-return]: refined. return unresolvedSource; } diff --git a/packages/react-devtools-shared/src/backend/utils/index.js b/packages/react-devtools-shared/src/backend/utils/index.js index fcb8d448a0c..e9a8677000a 100644 --- a/packages/react-devtools-shared/src/backend/utils/index.js +++ b/packages/react-devtools-shared/src/backend/utils/index.js @@ -195,7 +195,7 @@ export function formatConsoleArgumentsToSingleString( if (args.length) { const REGEXP = /(%?)(%([jds]))/g; - // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] formatted = formatted.replace(REGEXP, (match, escaped, ptn, flag) => { let arg = args.shift(); switch (flag) { diff --git a/packages/react-devtools-shared/src/backend/views/TraceUpdates/canvas.js b/packages/react-devtools-shared/src/backend/views/TraceUpdates/canvas.js index b9e2cd90681..6c7383183d0 100644 --- a/packages/react-devtools-shared/src/backend/views/TraceUpdates/canvas.js +++ b/packages/react-devtools-shared/src/backend/views/TraceUpdates/canvas.js @@ -217,7 +217,7 @@ function destroyWeb() { // $FlowFixMe[incompatible-use]: Flow doesn't recognize Popover API and loses canvas nullability tracking if (canvas.parentNode != null) { - // $FlowFixMe[incompatible-call]: Flow doesn't track that canvas is non-null here + // $FlowFixMe[incompatible-type]: Flow doesn't track that canvas is non-null here canvas.parentNode.removeChild(canvas); } canvas = null; diff --git a/packages/react-devtools-shared/src/bridge.js b/packages/react-devtools-shared/src/bridge.js index b00867cc0cb..d9d2249a8fc 100644 --- a/packages/react-devtools-shared/src/bridge.js +++ b/packages/react-devtools-shared/src/bridge.js @@ -362,13 +362,13 @@ class Bridge< this._messageQueue.push(event, payload); if (!this._scheduledFlush) { this._scheduledFlush = true; - // $FlowFixMe + // $FlowFixMe[cannot-resolve-name] if (typeof devtoolsJestTestScheduler === 'function') { // This exists just for our own jest tests. // They're written in such a way that we can neither mock queueMicrotask // because then we break React DOM and we can't not mock it because then // we can't synchronously flush it. So they need to be rewritten. - // $FlowFixMe + // $FlowFixMe[cannot-resolve-name] devtoolsJestTestScheduler(this._flush); // eslint-disable-line no-undef } else { queueMicrotask(this._flush); diff --git a/packages/react-devtools-shared/src/devtools/views/Components/OwnersListContext.js b/packages/react-devtools-shared/src/devtools/views/Components/OwnersListContext.js index 060a5711626..4044b93dc40 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/OwnersListContext.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/OwnersListContext.js @@ -57,7 +57,7 @@ const resource: Resource< resolveFn = resolve; }); - // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] found when upgrading Flow inProgressRequests.set(element, {promise, resolveFn}); return (promise: $FlowFixMe); @@ -93,7 +93,7 @@ function useChangeOwnerAction(): (nextOwnerID: number) => void { resolveFn = resolve; }); - // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] found when upgrading Flow inProgressRequests.set(element, {promise, resolveFn}); } diff --git a/packages/react-devtools-shared/src/devtools/views/Components/Tree.js b/packages/react-devtools-shared/src/devtools/views/Components/Tree.js index 5623d507a3b..f44ce77b775 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/Tree.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/Tree.js @@ -132,7 +132,7 @@ export default function Tree(): React.Node { Math.min(0, elementLeft - viewportLeft) + Math.max(0, elementRight - viewportRight); - // $FlowExpectedError[incompatible-call] Flow doesn't support instant as an option for behavior. + // $FlowExpectedError[incompatible-type] Flow doesn't support instant as an option for behavior. listDOMElement.scrollBy({ left: horizontalDelta, behavior: 'instant', @@ -181,7 +181,7 @@ export default function Tree(): React.Node { Math.min(0, elementLeft - viewportLeft) + Math.max(0, elementRight - viewportRight); - // $FlowExpectedError[incompatible-call] Flow doesn't support instant as an option for behavior. + // $FlowExpectedError[incompatible-type] Flow doesn't support instant as an option for behavior. listDOMElement.scrollBy({ top: verticalDelta, left: horizontalDelta, diff --git a/packages/react-devtools-shared/src/devtools/views/Profiler/CommitTreeBuilder.js b/packages/react-devtools-shared/src/devtools/views/Profiler/CommitTreeBuilder.js index 41c5c7a2c09..957cf699236 100644 --- a/packages/react-devtools-shared/src/devtools/views/Profiler/CommitTreeBuilder.js +++ b/packages/react-devtools-shared/src/devtools/views/Profiler/CommitTreeBuilder.js @@ -515,7 +515,7 @@ const __printTree = (commitTree: CommitTree) => { const id = queue.shift(); const depth = queue.shift(); - // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] const node = nodes.get(id); if (node == null) { // $FlowFixMe[incompatible-type] @@ -523,7 +523,7 @@ const __printTree = (commitTree: CommitTree) => { } console.log( - // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] `${'•'.repeat(depth)}${node.id}:${node.displayName || ''} ${ node.key ? `key:"${node.key}"` : '' } (${node.treeBaseDuration})`, diff --git a/packages/react-devtools-shared/src/devtools/views/Profiler/HookChangeSummary.js b/packages/react-devtools-shared/src/devtools/views/Profiler/HookChangeSummary.js index 5ce3eec42bc..102c8309396 100644 --- a/packages/react-devtools-shared/src/devtools/views/Profiler/HookChangeSummary.js +++ b/packages/react-devtools-shared/src/devtools/views/Profiler/HookChangeSummary.js @@ -27,7 +27,7 @@ import Toggle from '../Toggle'; import type {HooksNode} from 'react-debug-tools/src/ReactDebugHooks'; import type {ChangeDescription} from './types'; -// $FlowFixMe: Flow doesn't know about Intl.ListFormat +// $FlowFixMe[prop-missing]: Flow doesn't know about Intl.ListFormat const hookListFormatter = new Intl.ListFormat('en', { style: 'long', type: 'conjunction', diff --git a/packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTreeContext.js b/packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTreeContext.js index 6cb4eb7a487..a17f2701851 100644 --- a/packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTreeContext.js +++ b/packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTreeContext.js @@ -174,9 +174,9 @@ function SuspenseTreeContextController({children}: Props): React.Node { let selectedTimelineID: null | number = null; if (selectedTimelineStep !== null) { selectedTimelineID = selectedTimelineStep.id; - // $FlowFixMe + // $FlowFixMe[incompatible-call] while (removedIDs.has(selectedTimelineID)) { - // $FlowFixMe + // $FlowFixMe[incompatible-type] selectedTimelineID = removedIDs.get(selectedTimelineID); } } diff --git a/packages/react-devtools-shared/src/devtools/views/hooks.js b/packages/react-devtools-shared/src/devtools/views/hooks.js index 2984c2fbfcd..85fc1790abf 100644 --- a/packages/react-devtools-shared/src/devtools/views/hooks.js +++ b/packages/react-devtools-shared/src/devtools/views/hooks.js @@ -235,7 +235,7 @@ export function useModalDismissSignal( const handleRootNodeClick: MouseEventHandler = event => { if ( modalRef.current !== null && - /* $FlowExpectedError[incompatible-call] Instead of dealing with possibly multiple realms + /* $FlowExpectedError[incompatible-type] Instead of dealing with possibly multiple realms and multiple Node references to comply with Flow (e.g. checking with `event.target instanceof Node`) just delegate it to contains call */ !modalRef.current.contains(event.target) diff --git a/packages/react-devtools-shared/src/hook.js b/packages/react-devtools-shared/src/hook.js index 699d2309457..9331b6c5011 100644 --- a/packages/react-devtools-shared/src/hook.js +++ b/packages/react-devtools-shared/src/hook.js @@ -422,7 +422,7 @@ export function installHook( const startStackFrame = openModuleRangesStack.pop(); const stopStackFrame = getTopStackFrameString(error); if (stopStackFrame !== null) { - // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] moduleRanges.push([startStackFrame, stopStackFrame]); } } diff --git a/packages/react-devtools-shared/src/utils.js b/packages/react-devtools-shared/src/utils.js index c84ed2d3647..214d4e05972 100644 --- a/packages/react-devtools-shared/src/utils.js +++ b/packages/react-devtools-shared/src/utils.js @@ -604,7 +604,7 @@ export function parseElementDisplayNameFromBackend( } return { - // $FlowFixMe[incompatible-return] + // $FlowFixMe[incompatible-type] formattedDisplayName: displayName, hocDisplayNames, compiledWithForget: false, diff --git a/packages/react-devtools-shell/src/app/index.js b/packages/react-devtools-shell/src/app/index.js index 473cc40c3be..56666b4139c 100644 --- a/packages/react-devtools-shell/src/app/index.js +++ b/packages/react-devtools-shell/src/app/index.js @@ -94,7 +94,7 @@ function mountLegacyApp(App: () => React$Node) { // $FlowFixMe[not-a-function]: These are removed in 19. render(createElement(LegacyRender), container); - // $FlowFixMe: These are removed in 19. + // $FlowFixMe[not-a-function]: These are removed in 19. unmountFunctions.push(() => unmountComponentAtNode(container)); } diff --git a/packages/react-devtools-timeline/src/content-views/SnapshotsView.js b/packages/react-devtools-timeline/src/content-views/SnapshotsView.js index 494cca38c4f..23d61a3b63b 100644 --- a/packages/react-devtools-timeline/src/content-views/SnapshotsView.js +++ b/packages/react-devtools-timeline/src/content-views/SnapshotsView.js @@ -166,7 +166,7 @@ export class SnapshotsView extends View { imageRect.size.height, ); - // $FlowFixMe[incompatible-call] Flow doesn't know about the 9 argument variant of drawImage() + // $FlowFixMe[incompatible-type] Flow doesn't know about the 9 argument variant of drawImage() context.drawImage( snapshot.image, diff --git a/packages/react-devtools-timeline/src/view-base/useCanvasInteraction.js b/packages/react-devtools-timeline/src/view-base/useCanvasInteraction.js index 59fd89c26f3..0f2bf0e87c4 100644 --- a/packages/react-devtools-timeline/src/view-base/useCanvasInteraction.js +++ b/packages/react-devtools-timeline/src/view-base/useCanvasInteraction.js @@ -125,7 +125,7 @@ export function useCanvasInteraction( } function localToCanvasCoordinates(localCoordinates: Point): Point { - // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] found when upgrading Flow const canvasRect = cacheFirstGetCanvasBoundingRect(canvas); return { x: localCoordinates.x - canvasRect.left, diff --git a/packages/react-dom-bindings/src/client/DOMPropertyOperations.js b/packages/react-dom-bindings/src/client/DOMPropertyOperations.js index df09445acc5..b783d4225b5 100644 --- a/packages/react-dom-bindings/src/client/DOMPropertyOperations.js +++ b/packages/react-dom-bindings/src/client/DOMPropertyOperations.js @@ -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; } diff --git a/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js b/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js index e4c45ccc4c3..f64d0eaebc1 100644 --- a/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js +++ b/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js @@ -1455,6 +1455,7 @@ export function applyViewTransitionName( const rects = instance.getClientRects(); if ( // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] countClientRects(rects) === 1 ) { // If the instance has a single client rect, that means that it can be @@ -1711,11 +1712,11 @@ function moveOutOfViewport( // while still letting it paint its "old" state to a snapshot. const transform = getComputedTransform(originalStyle); // Clear the long form properties. - // $FlowFixMe + // $FlowFixMe[prop-missing] element.style.translate = 'none'; - // $FlowFixMe + // $FlowFixMe[prop-missing] element.style.scale = 'none'; - // $FlowFixMe + // $FlowFixMe[prop-missing] element.style.rotate = 'none'; // Apply a translate to move it way out of the viewport. This is applied first // so that it is in the coordinate space of the parent and not after applying @@ -1798,7 +1799,7 @@ export function cloneRootViewTransitionContainer( if (getComputedStyle(positionedAncestor).position !== 'static') { break; } - // $FlowFixMe: This is refined. + // $FlowFixMe[incompatible-type]: This is refined. positionedAncestor = positionedAncestor.parentNode; } @@ -2004,7 +2005,6 @@ function cancelAllViewTransitionAnimations(scope: Element) { for (let i = 0; i < animations.length; i++) { const anim = animations[i]; const effect: KeyframeEffect = (anim.effect: any); - // $FlowFixMe const pseudo: ?string = effect.pseudoElement; if ( pseudo != null && @@ -2218,7 +2218,6 @@ export function startViewTransition( for (let i = 0; i < animations.length; i++) { const animation = animations[i]; const effect: KeyframeEffect = (animation.effect: any); - // $FlowFixMe const pseudoElement: ?string = effect.pseudoElement; if ( pseudoElement != null && @@ -2259,13 +2258,13 @@ export function startViewTransition( height !== undefined ) { // Replace the keyframes with ones that don't animate the width/height. - // $FlowFixMe + // $FlowFixMe[incompatible-type] effect.setKeyframes(keyframes); // Read back the new animation to see what the underlying width/height of the pseudo-element was. const computedStyle = getComputedStyle( - // $FlowFixMe + // $FlowFixMe[incompatible-type] effect.target, - // $FlowFixMe + // $FlowFixMe[incompatible-type] effect.pseudoElement, ); if ( @@ -2280,7 +2279,7 @@ export function startViewTransition( const last = keyframes[keyframes.length - 1]; last.width = width; last.height = height; - // $FlowFixMe + // $FlowFixMe[incompatible-type] effect.setKeyframes(keyframes); } } @@ -2562,7 +2561,6 @@ export function startGestureTransition( let longestDuration = 0; for (let i = 0; i < animations.length; i++) { const effect: KeyframeEffect = (animations[i].effect: any); - // $FlowFixMe const pseudoElement: ?string = effect.pseudoElement; if (pseudoElement == null) { } else if (pseudoElement.startsWith('::view-transition')) { @@ -2594,7 +2592,6 @@ export function startGestureTransition( continue; } const effect: KeyframeEffect = (anim.effect: any); - // $FlowFixMe const pseudoElement: ?string = effect.pseudoElement; if ( pseudoElement != null && @@ -2654,7 +2651,7 @@ export function startGestureTransition( } animateGesture( effect.getKeyframes(), - // $FlowFixMe: Always documentElement atm. + // $FlowFixMe[incompatible-type]: Always documentElement atm. effect.target, pseudoElement, timeline, @@ -2681,7 +2678,7 @@ export function startGestureTransition( const pseudoElementName = '::view-transition-group' + groupName; animateGesture( [{}, {}], - // $FlowFixMe: Always documentElement atm. + // $FlowFixMe[incompatible-type]: Always documentElement atm. effect.target, pseudoElementName, timeline, @@ -3203,6 +3200,7 @@ FragmentInstance.prototype.getRootNode = function ( getInstanceFromHostFiber(parentHostFiber); const rootNode = // $FlowFixMe[incompatible-cast] Flow expects Node + // $FlowFixMe[incompatible-type] (parentHostInstance.getRootNode(getRootNodeOptions): Document | ShadowRoot); return rootNode; }; @@ -4649,9 +4647,11 @@ export function getHoistableRoot(container: Container): HoistableRoot { return typeof container.getRootNode === 'function' ? /* $FlowFixMe[incompatible-cast] Flow types this as returning a `Node`, * but it's either a `Document` or `ShadowRoot`. */ + // $FlowFixMe[incompatible-type] (container.getRootNode(): Document | ShadowRoot) : container.nodeType === DOCUMENT_NODE ? // $FlowFixMe[incompatible-cast] We've constrained this to be a Document which satisfies the return type + // $FlowFixMe[incompatible-type] (container: Document) : container.ownerDocument; } @@ -4962,12 +4962,14 @@ function preinitStyle( } // Construct a Resource and cache it + // $FlowFixMe[incompatible-type] resource = { type: 'stylesheet', instance, count: 1, state, }; + // $FlowFixMe[incompatible-type] styles.set(key, resource); return; } diff --git a/packages/react-dom-bindings/src/client/estimateBandwidth.js b/packages/react-dom-bindings/src/client/estimateBandwidth.js index 4b143a5b562..7d1e542112d 100644 --- a/packages/react-dom-bindings/src/client/estimateBandwidth.js +++ b/packages/react-dom-bindings/src/client/estimateBandwidth.js @@ -98,7 +98,8 @@ export default function estimateBandwidth(): number { // Fallback to the navigator.connection estimate if available // $FlowFixMe[prop-missing] if (navigator.connection) { - // $FlowFixMe + // $FlowFixMe[prop-missing] + // $FlowFixMe[incompatible-use] const downlink: ?number = navigator.connection.downlink; if (typeof downlink === 'number') { return downlink; diff --git a/packages/react-dom-bindings/src/events/SyntheticEvent.js b/packages/react-dom-bindings/src/events/SyntheticEvent.js index acd50cf8e0c..c51ba896638 100644 --- a/packages/react-dom-bindings/src/events/SyntheticEvent.js +++ b/packages/react-dom-bindings/src/events/SyntheticEvent.js @@ -392,6 +392,7 @@ function getEventKey(nativeEvent: {[propName: string]: mixed}) { if (nativeEvent.type === 'keypress') { const charCode = getEventCharCode( // $FlowFixMe[incompatible-call] unable to narrow to `KeyboardEvent` + // $FlowFixMe[incompatible-type] nativeEvent, ); @@ -464,6 +465,7 @@ const KeyboardEventInterface: EventInterfaceType = { if (event.type === 'keypress') { return getEventCharCode( // $FlowFixMe[incompatible-call] unable to narrow to `KeyboardEvent` + // $FlowFixMe[incompatible-type] event, ); } @@ -488,6 +490,7 @@ const KeyboardEventInterface: EventInterfaceType = { if (event.type === 'keypress') { return getEventCharCode( // $FlowFixMe[incompatible-call] unable to narrow to `KeyboardEvent` + // $FlowFixMe[incompatible-type] event, ); } diff --git a/packages/react-dom-bindings/src/server/ReactDOMLegacyServerStreamConfig.js b/packages/react-dom-bindings/src/server/ReactDOMLegacyServerStreamConfig.js index 54c57685686..24424086a61 100644 --- a/packages/react-dom-bindings/src/server/ReactDOMLegacyServerStreamConfig.js +++ b/packages/react-dom-bindings/src/server/ReactDOMLegacyServerStreamConfig.js @@ -76,6 +76,7 @@ export function byteLengthOfBinaryChunk(chunk: BinaryChunk): number { export function closeWithError(destination: Destination, error: mixed): void { // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types. + // $FlowFixMe[incompatible-type] destination.destroy(error); } diff --git a/packages/react-dom-bindings/src/server/ReactDOMServerExternalRuntime.js b/packages/react-dom-bindings/src/server/ReactDOMServerExternalRuntime.js index 8a13babe2b9..fc85381d5d2 100644 --- a/packages/react-dom-bindings/src/server/ReactDOMServerExternalRuntime.js +++ b/packages/react-dom-bindings/src/server/ReactDOMServerExternalRuntime.js @@ -14,6 +14,7 @@ if (document.body != null) { installFizzInstrObserver(document.body); } // $FlowFixMe[incompatible-cast] + // $FlowFixMe[incompatible-type] handleExistingNodes((document.body: HTMLElement)); } else { // Document must be loading -- body may not exist yet if the fizz external @@ -26,6 +27,7 @@ if (document.body != null) { installFizzInstrObserver(document.body); } // $FlowFixMe[incompatible-cast] + // $FlowFixMe[incompatible-type] handleExistingNodes((document.body: HTMLElement)); // We can call disconnect without takeRecord here, @@ -70,10 +72,12 @@ function installFizzInstrObserver(target: Node) { function handleNode(node_: Node) { // $FlowFixMe[incompatible-cast] + // $FlowFixMe[incompatible-type] if (node_.nodeType !== 1 || !(node_: HTMLElement).dataset) { return; } // $FlowFixMe[incompatible-cast] + // $FlowFixMe[incompatible-type] const node = (node_: HTMLElement); const dataset = node.dataset; if (dataset['rxi'] != null) { diff --git a/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js b/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js index a93c32a947f..9c6eb622e12 100644 --- a/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js +++ b/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js @@ -3366,7 +3366,7 @@ function pushImg( // reenter this branch in a second pass for duplicate img hrefs. promotablePreloads.delete(key); - // $FlowFixMe - Flow should understand that this is a Resource if the condition was true + // $FlowFixMe[incompatible-call] - Flow should understand that this is a Resource if the condition was true renderState.highImagePreloads.add(resource); } } else if (!resumableState.imageResources.hasOwnProperty(key)) { diff --git a/packages/react-dom/src/client/ReactDOMClientFB.js b/packages/react-dom/src/client/ReactDOMClientFB.js index 872a4550aa3..a9e5cd7de19 100644 --- a/packages/react-dom/src/client/ReactDOMClientFB.js +++ b/packages/react-dom/src/client/ReactDOMClientFB.js @@ -83,6 +83,7 @@ function createPortal( // TODO: pass ReactDOM portal implementation as third argument // $FlowFixMe[incompatible-return] The Flow type is opaque but there's no way to actually create it. + // $FlowFixMe[incompatible-type] return createPortalImpl(children, container, null, key); } @@ -101,6 +102,7 @@ function flushSyncFromReconciler(fn: (() => R) | void): R | void { } } // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] return flushSyncWithoutWarningIfAlreadyRendering(fn); } diff --git a/packages/react-dom/src/client/ReactDOMDefaultTransitionIndicator.js b/packages/react-dom/src/client/ReactDOMDefaultTransitionIndicator.js index 37661849cad..751245a40df 100644 --- a/packages/react-dom/src/client/ReactDOMDefaultTransitionIndicator.js +++ b/packages/react-dom/src/client/ReactDOMDefaultTransitionIndicator.js @@ -43,11 +43,12 @@ export function defaultOnDefaultTransitionIndicator(): void | (() => void) { } } - // $FlowFixMe + // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] navigation.addEventListener('navigate', handleNavigate); - // $FlowFixMe + // $FlowFixMe[incompatible-call] navigation.addEventListener('navigatesuccess', handleNavigateComplete); - // $FlowFixMe + // $FlowFixMe[incompatible-call] navigation.addEventListener('navigateerror', handleNavigateComplete); function startFakeNavigation() { @@ -76,11 +77,12 @@ export function defaultOnDefaultTransitionIndicator(): void | (() => void) { return function () { isCancelled = true; - // $FlowFixMe + // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] navigation.removeEventListener('navigate', handleNavigate); - // $FlowFixMe + // $FlowFixMe[incompatible-call] navigation.removeEventListener('navigatesuccess', handleNavigateComplete); - // $FlowFixMe + // $FlowFixMe[incompatible-call] navigation.removeEventListener('navigateerror', handleNavigateComplete); if (pendingResolve !== null) { pendingResolve(); diff --git a/packages/react-dom/src/client/ReactDOMRootFB.js b/packages/react-dom/src/client/ReactDOMRootFB.js index 3a0205fe799..8a677a5b82f 100644 --- a/packages/react-dom/src/client/ReactDOMRootFB.js +++ b/packages/react-dom/src/client/ReactDOMRootFB.js @@ -256,6 +256,7 @@ function legacyCreateRootFromDOMContainer( ? container.parentNode : container; // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] listenToAllSupportedEvents(rootContainerElement); flushSyncWork(); @@ -293,6 +294,7 @@ function legacyCreateRootFromDOMContainer( ? container.parentNode : container; // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] listenToAllSupportedEvents(rootContainerElement); // Initial mount should not be batched. diff --git a/packages/react-dom/src/shared/ReactDOM.js b/packages/react-dom/src/shared/ReactDOM.js index f1d48bfacd4..973caabe766 100644 --- a/packages/react-dom/src/shared/ReactDOM.js +++ b/packages/react-dom/src/shared/ReactDOM.js @@ -64,6 +64,7 @@ function createPortal( // TODO: pass ReactDOM portal implementation as third argument // $FlowFixMe[incompatible-return] The Flow type is opaque but there's no way to actually create it. + // $FlowFixMe[incompatible-type] return createPortalImpl(children, container, null, key); } diff --git a/packages/react-dom/src/test-utils/FizzTestUtils.js b/packages/react-dom/src/test-utils/FizzTestUtils.js index 4d8b6cadbab..aabaf9306b6 100644 --- a/packages/react-dom/src/test-utils/FizzTestUtils.js +++ b/packages/react-dom/src/test-utils/FizzTestUtils.js @@ -95,7 +95,7 @@ async function executeScript(script: Element) { } try { - // $FlowFixMe + // $FlowFixMe[unsupported-syntax] require(scriptSrc); } catch (x) { const event = new window.ErrorEvent('error', {error: x}); diff --git a/packages/react-native-renderer/src/ReactFabricComponentTree.js b/packages/react-native-renderer/src/ReactFabricComponentTree.js index f36e742a45a..e48e57810f7 100644 --- a/packages/react-native-renderer/src/ReactFabricComponentTree.js +++ b/packages/react-native-renderer/src/ReactFabricComponentTree.js @@ -29,7 +29,7 @@ function getInstanceFromNode(node: Instance | TextInstance): Fiber | null { return instance.canonical.internalInstanceHandle; } - // $FlowFixMe[incompatible-return] DevTools incorrectly passes a fiber in React Native. + // $FlowFixMe[incompatible-type] DevTools incorrectly passes a fiber in React Native. return node; } diff --git a/packages/react-native-renderer/src/ReactFabricEventEmitter.js b/packages/react-native-renderer/src/ReactFabricEventEmitter.js index a0b8eb98b48..ddd3b0f6833 100644 --- a/packages/react-native-renderer/src/ReactFabricEventEmitter.js +++ b/packages/react-native-renderer/src/ReactFabricEventEmitter.js @@ -93,7 +93,7 @@ export function dispatchEvent( const stateNode = targetFiber.stateNode; // Guard against Fiber being unmounted if (stateNode != null) { - // $FlowExpectedError[incompatible-cast] public instances in Fabric do not implement `EventTarget` yet. + // $FlowExpectedError[incompatible-type] public instances in Fabric do not implement `EventTarget` yet. eventTarget = (getPublicInstance(stateNode): EventTarget); } } diff --git a/packages/react-native-renderer/src/ReactFiberConfigFabric.js b/packages/react-native-renderer/src/ReactFiberConfigFabric.js index f5a4361fd41..a4bdd5fbce9 100644 --- a/packages/react-native-renderer/src/ReactFiberConfigFabric.js +++ b/packages/react-native-renderer/src/ReactFiberConfigFabric.js @@ -673,7 +673,7 @@ FragmentInstance.prototype.observeUsing = function ( }; function observeChild(child: Fiber, observer: IntersectionObserver) { const publicInstance = getPublicInstanceFromHostFiber(child); - // $FlowFixMe[incompatible-call] DOM types expect Element + // $FlowFixMe[incompatible-type] DOM types expect Element observer.observe(publicInstance); return false; } @@ -697,7 +697,7 @@ FragmentInstance.prototype.unobserveUsing = function ( }; function unobserveChild(child: Fiber, observer: IntersectionObserver) { const publicInstance = getPublicInstanceFromHostFiber(child); - // $FlowFixMe[incompatible-call] DOM types expect Element + // $FlowFixMe[incompatible-type] DOM types expect Element observer.unobserve(publicInstance); return false; } @@ -856,7 +856,7 @@ export function commitNewChildToFragmentInstance( throw new Error('Expected to find a host node. This is a bug in React.'); } fragmentInstance._observers.forEach(observer => { - // $FlowFixMe[incompatible-call] Element types are behind a flag in RN + // $FlowFixMe[incompatible-type] Element types are behind a flag in RN observer.observe(publicInstance); }); } diff --git a/packages/react-native-renderer/src/ReactFiberConfigNative.js b/packages/react-native-renderer/src/ReactFiberConfigNative.js index 89da4108fc9..ef0d2e6479f 100644 --- a/packages/react-native-renderer/src/ReactFiberConfigNative.js +++ b/packages/react-native-renderer/src/ReactFiberConfigNative.js @@ -307,7 +307,7 @@ export function getPublicInstance(instance: Instance): PublicInstance { } // $FlowExpectedError[prop-missing] - // $FlowExpectedError[incompatible-return] + // $FlowExpectedError[incompatible-type] return instance.canonical.publicInstance; } diff --git a/packages/react-native-renderer/src/ReactNativeEventEmitter.js b/packages/react-native-renderer/src/ReactNativeEventEmitter.js index 27070803674..a79c6335aef 100644 --- a/packages/react-native-renderer/src/ReactNativeEventEmitter.js +++ b/packages/react-native-renderer/src/ReactNativeEventEmitter.js @@ -235,7 +235,7 @@ export function receiveTouches( rootNodeID = target; } } - // $FlowFixMe[incompatible-call] Shouldn't we *not* call it if rootNodeID is null? + // $FlowFixMe[incompatible-type] Shouldn't we *not* call it if rootNodeID is null? _receiveRootNodeIDEvent(rootNodeID, eventTopLevelType, nativeEvent); } } diff --git a/packages/react-native-renderer/src/ReactNativeFiberInspector.js b/packages/react-native-renderer/src/ReactNativeFiberInspector.js index e8be83f9a9f..15fd5a12089 100644 --- a/packages/react-native-renderer/src/ReactNativeFiberInspector.js +++ b/packages/react-native-renderer/src/ReactNativeFiberInspector.js @@ -236,7 +236,7 @@ function getInspectorDataForViewAtPoint( pointerY: locationY, frame: {left, top, width, height}, touchedViewTag: nativeViewTag, - // $FlowExpectedError[incompatible-call] + // $FlowExpectedError[incompatible-type] closestPublicInstance: nativeViewTag, }); }, diff --git a/packages/react-native-renderer/src/ReactNativePublicCompat.js b/packages/react-native-renderer/src/ReactNativePublicCompat.js index e0193ddc37e..ad58ce95eb1 100644 --- a/packages/react-native-renderer/src/ReactNativePublicCompat.js +++ b/packages/react-native-renderer/src/ReactNativePublicCompat.js @@ -61,14 +61,14 @@ export function findHostInstance_DEPRECATED( componentOrHandle.canonical && componentOrHandle.canonical.publicInstance ) { - // $FlowExpectedError[incompatible-return] Can't refine componentOrHandle as a Fabric instance + // $FlowExpectedError[incompatible-type] Can't refine componentOrHandle as a Fabric instance return componentOrHandle.canonical.publicInstance; } // For compatibility with legacy renderer instances if (componentOrHandle._nativeTag) { // $FlowFixMe[incompatible-exact] Necessary when running Flow on Fabric - // $FlowFixMe[incompatible-return] + // $FlowFixMe[incompatible-type] return componentOrHandle; } @@ -84,7 +84,7 @@ export function findHostInstance_DEPRECATED( // findHostInstance handles legacy vs. Fabric differences correctly // $FlowFixMe[incompatible-exact] we need to fix the definition of `HostComponent` to use NativeMethods as an interface, not as a type. - // $FlowFixMe[incompatible-return] + // $FlowFixMe[incompatible-type] return hostInstance; } @@ -146,16 +146,16 @@ export function findNodeHandle(componentOrHandle: any): ?number { } if (hostInstance == null) { - // $FlowFixMe[incompatible-return] Flow limitation in refining an opaque type + // $FlowFixMe[incompatible-type] Flow limitation in refining an opaque type return hostInstance; } if (hostInstance._nativeTag != null) { - // $FlowFixMe[incompatible-return] For compatibility with legacy renderer instances + // $FlowFixMe[incompatible-type] For compatibility with legacy renderer instances return hostInstance._nativeTag; } - // $FlowFixMe[incompatible-call] Necessary when running Flow on the legacy renderer + // $FlowFixMe[incompatible-type] Necessary when running Flow on the legacy renderer return getNativeTagFromPublicInstance(hostInstance); } @@ -214,9 +214,9 @@ export function getNodeFromInternalInstanceHandle( internalInstanceHandle: mixed, ): ?Node { return ( - // $FlowExpectedError[incompatible-return] internalInstanceHandle is opaque but we need to make an exception here. + // $FlowExpectedError[incompatible-type] internalInstanceHandle is opaque but we need to make an exception here. internalInstanceHandle && - // $FlowExpectedError[incompatible-return] + // $FlowExpectedError[incompatible-type] internalInstanceHandle.stateNode && // $FlowExpectedError[incompatible-use] internalInstanceHandle.stateNode.node diff --git a/packages/react-native-renderer/src/legacy-events/forEachAccumulated.js b/packages/react-native-renderer/src/legacy-events/forEachAccumulated.js index e9d82b0dd2a..ef93bbc3189 100644 --- a/packages/react-native-renderer/src/legacy-events/forEachAccumulated.js +++ b/packages/react-native-renderer/src/legacy-events/forEachAccumulated.js @@ -22,7 +22,7 @@ function forEachAccumulated( scope: ?any, ) { if (Array.isArray(arr)) { - // $FlowFixMe[incompatible-call] if `T` is an array, `cb` cannot be called + // $FlowFixMe[incompatible-type] if `T` is an array, `cb` cannot be called arr.forEach(cb, scope); } else if (arr) { cb.call(scope, arr); diff --git a/packages/react-reconciler/src/ReactCapturedValue.js b/packages/react-reconciler/src/ReactCapturedValue.js index d53489cc3b7..feb0a9f0752 100644 --- a/packages/react-reconciler/src/ReactCapturedValue.js +++ b/packages/react-reconciler/src/ReactCapturedValue.js @@ -56,7 +56,9 @@ export function createCapturedValueFromError( stack: stack, }; if (typeof stack === 'string') { + // $FlowFixMe[incompatible-type] CapturedStacks.set(value, captured); } + // $FlowFixMe[incompatible-type] return captured; } diff --git a/packages/react-reconciler/src/ReactChildFiber.js b/packages/react-reconciler/src/ReactChildFiber.js index 2a726447263..c5aeebeebf6 100644 --- a/packages/react-reconciler/src/ReactChildFiber.js +++ b/packages/react-reconciler/src/ReactChildFiber.js @@ -2224,10 +2224,12 @@ export function validateSuspenseListChildren( enableAsyncIterableChildren && children.$$typeof === REACT_ELEMENT_TYPE && typeof children.type === 'function' && - // $FlowFixMe + // $FlowFixMe[incompatible-use] + // $FlowFixMe[method-unbinding] (Object.prototype.toString.call(children.type) === '[object GeneratorFunction]' || - // $FlowFixMe + // $FlowFixMe[incompatible-use] + // $FlowFixMe[method-unbinding] Object.prototype.toString.call(children.type) === '[object AsyncGeneratorFunction]') ) { diff --git a/packages/react-reconciler/src/ReactFiberCommitEffects.js b/packages/react-reconciler/src/ReactFiberCommitEffects.js index f7e20fe9261..ba4fbe29763 100644 --- a/packages/react-reconciler/src/ReactFiberCommitEffects.js +++ b/packages/react-reconciler/src/ReactFiberCommitEffects.js @@ -199,7 +199,7 @@ export function commitHookEffectListMount( addendum = ' You returned null. If your effect does not require clean ' + 'up, return undefined (or nothing).'; - // $FlowFixMe (@poteto) this check is safe on arbitrary non-null/void objects + // $FlowFixMe[incompatible-type] (@poteto) this check is safe on arbitrary non-null/void objects } else if (typeof destroy.then === 'function') { addendum = '\n\nIt looks like you wrote ' + @@ -924,7 +924,8 @@ function safelyCallDestroy( ); } else { try { - // $FlowFixMe(incompatible-call) Already bound to resource + // $FlowFixMe[incompatible-call] Already bound to resource + // $FlowFixMe[incompatible-type] destroy_(); } catch (error) { captureCommitPhaseError(current, nearestMountedAncestor, error); @@ -951,11 +952,11 @@ function commitProfiler( onRender( id, phase, - // $FlowFixMe: This should be always a number in profiling mode + // $FlowFixMe[incompatible-type]: This should be always a number in profiling mode finishedWork.actualDuration, - // $FlowFixMe: This should be always a number in profiling mode + // $FlowFixMe[incompatible-type]: This should be always a number in profiling mode finishedWork.treeBaseDuration, - // $FlowFixMe: This should be always a number in profiling mode + // $FlowFixMe[incompatible-type]: This should be always a number in profiling mode finishedWork.actualStartTime, commitStartTime, ); diff --git a/packages/react-reconciler/src/ReactFiberCommitWork.js b/packages/react-reconciler/src/ReactFiberCommitWork.js index ecacb0c1585..9c639c187a1 100644 --- a/packages/react-reconciler/src/ReactFiberCommitWork.js +++ b/packages/react-reconciler/src/ReactFiberCommitWork.js @@ -488,6 +488,7 @@ function commitBeforeMutationEffectsOnFiber( finishedWork.tag === SuspenseComponent && isSuspenseBoundaryBeingHidden(current, finishedWork) && // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] doesFiberContain(finishedWork, focusedInstanceHandle) ) { shouldFireAfterActiveInstanceBlur = true; diff --git a/packages/react-reconciler/src/ReactFiberHooks.js b/packages/react-reconciler/src/ReactFiberHooks.js index 66a390ebb81..b04f68da7af 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.js +++ b/packages/react-reconciler/src/ReactFiberHooks.js @@ -416,9 +416,9 @@ function warnIfAsyncClientComponent(Component: Function) { // for transpiled async functions. Neither mechanism is completely // bulletproof but together they cover the most common cases. const isAsyncFunction = - // $FlowIgnore[method-unbinding] + // $FlowFixMe[method-unbinding] Object.prototype.toString.call(Component) === '[object AsyncFunction]' || - // $FlowIgnore[method-unbinding] + // $FlowFixMe[method-unbinding] Object.prototype.toString.call(Component) === '[object AsyncGeneratorFunction]'; if (isAsyncFunction) { @@ -2647,6 +2647,7 @@ function updateEffectImpl( const prevEffect: Effect = currentHook.memoizedState; const prevDeps = prevEffect.deps; // $FlowFixMe[incompatible-call] (@poteto) + // $FlowFixMe[incompatible-type] if (areHookInputsEqual(nextDeps, prevDeps)) { hook.memoizedState = pushSimpleEffect( hookFlags, @@ -2727,6 +2728,7 @@ function mountEvent) => Return>( const ref = {impl: callback}; hook.memoizedState = ref; // $FlowIgnore[incompatible-return] + // $FlowFixMe[incompatible-type] return function eventFn() { if (isInvalidExecutionContextForEventFunction()) { throw new Error( @@ -2743,7 +2745,8 @@ function updateEvent) => Return>( const hook = updateWorkInProgressHook(); const ref = hook.memoizedState; useEffectEventImpl({ref, nextImpl: callback}); - // $FlowIgnore[incompatible-return] + // $FlowFixMe[incompatible-return] + // $FlowFixMe[incompatible-type] return function eventFn() { if (isInvalidExecutionContextForEventFunction()) { throw new Error( diff --git a/packages/react-reconciler/src/ReactFiberNewContext.js b/packages/react-reconciler/src/ReactFiberNewContext.js index 02792d863af..81c47d7b649 100644 --- a/packages/react-reconciler/src/ReactFiberNewContext.js +++ b/packages/react-reconciler/src/ReactFiberNewContext.js @@ -551,20 +551,24 @@ function readContextForConsumer( } // This is the first dependency for this component. Create a new list. + // $FlowFixMe[incompatible-type] lastContextDependency = contextItem; consumer.dependencies = __DEV__ - ? { + ? // $FlowFixMe[incompatible-type] + { lanes: NoLanes, firstContext: contextItem, _debugThenableState: null, } - : { + : // $FlowFixMe[incompatible-type] + { lanes: NoLanes, firstContext: contextItem, }; consumer.flags |= NeedsPropagation; } else { // Append a new context item. + // $FlowFixMe[incompatible-type] lastContextDependency = lastContextDependency.next = contextItem; } return value; diff --git a/packages/react-reconciler/src/ReactFiberPerformanceTrack.js b/packages/react-reconciler/src/ReactFiberPerformanceTrack.js index f926bd6085b..416badc9a1e 100644 --- a/packages/react-reconciler/src/ReactFiberPerformanceTrack.js +++ b/packages/react-reconciler/src/ReactFiberPerformanceTrack.js @@ -508,9 +508,11 @@ function logComponentEffectErrored( if (debugTask) { debugTask.run( // $FlowFixMe[method-unbinding] + // $FlowFixMe[incompatible-type] performance.measure.bind(performance, measureName, options), ); } else { + // $FlowFixMe[incompatible-type] performance.measure(measureName, options); } performance.clearMeasures(measureName); @@ -780,9 +782,11 @@ export function logBlockingStart( if (debugTask) { debugTask.run( // $FlowFixMe[method-unbinding] + // $FlowFixMe[incompatible-type] performance.measure.bind(performance, label, measureOptions), ); } else { + // $FlowFixMe[incompatible-type] performance.measure(label, measureOptions); } performance.clearMeasures(label); @@ -886,9 +890,11 @@ export function logGestureStart( if (debugTask) { debugTask.run( // $FlowFixMe[method-unbinding] + // $FlowFixMe[incompatible-type] performance.measure.bind(performance, label, measureOptions), ); } else { + // $FlowFixMe[incompatible-type] performance.measure(label, measureOptions); } performance.clearMeasures(label); @@ -1027,9 +1033,11 @@ export function logTransitionStart( if (debugTask) { debugTask.run( // $FlowFixMe[method-unbinding] + // $FlowFixMe[incompatible-type] performance.measure.bind(performance, label, measureOptions), ); } else { + // $FlowFixMe[incompatible-type] performance.measure(label, measureOptions); } performance.clearMeasures(label); diff --git a/packages/react-reconciler/src/ReactFiberThenable.js b/packages/react-reconciler/src/ReactFiberThenable.js index 643be63ffa1..84c6a93ceca 100644 --- a/packages/react-reconciler/src/ReactFiberThenable.js +++ b/packages/react-reconciler/src/ReactFiberThenable.js @@ -290,6 +290,7 @@ export function suspendCommit(): void { // This extra indirection only exists so it can handle passing // noopSuspenseyCommitThenable through to throwException. // TODO: Factor the thenable check out of throwException + // $FlowFixMe[incompatible-type] suspendedThenable = noopSuspenseyCommitThenable; throw SuspenseyCommitException; } diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.js b/packages/react-reconciler/src/ReactFiberWorkLoop.js index f7200458be1..53eb149b3ca 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.js @@ -2973,6 +2973,7 @@ function workLoopConcurrent(nonIdle: boolean) { const yieldAfter = now() + (nonIdle ? 25 : 5); do { // $FlowFixMe[incompatible-call] flow doesn't know that now() is side-effect free + // $FlowFixMe[incompatible-type] performUnitOfWork(workInProgress); } while (workInProgress !== null && now() < yieldAfter); } @@ -2983,6 +2984,7 @@ function workLoopConcurrentByScheduler() { // Perform work until Scheduler asks us to yield while (workInProgress !== null && !shouldYield()) { // $FlowFixMe[incompatible-call] flow doesn't know that shouldYield() is side-effect free + // $FlowFixMe[incompatible-type] performUnitOfWork(workInProgress); } } diff --git a/packages/react-server-dom-esm/src/ReactFlightESMReferences.js b/packages/react-server-dom-esm/src/ReactFlightESMReferences.js index 6c2737e89e7..3630d57a3d2 100644 --- a/packages/react-server-dom-esm/src/ReactFlightESMReferences.js +++ b/packages/react-server-dom-esm/src/ReactFlightESMReferences.js @@ -49,7 +49,7 @@ const FunctionBind = Function.prototype.bind; // $FlowFixMe[method-unbinding] const ArraySlice = Array.prototype.slice; function bind(this: ServerReference): any { - // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] const newFn = FunctionBind.apply(this, arguments); if (this.$$typeof === SERVER_REFERENCE_TAG) { if (__DEV__) { diff --git a/packages/react-server-dom-esm/src/server/ReactFlightDOMServerNode.js b/packages/react-server-dom-esm/src/server/ReactFlightDOMServerNode.js index b81e177d642..99117785f74 100644 --- a/packages/react-server-dom-esm/src/server/ReactFlightDOMServerNode.js +++ b/packages/react-server-dom-esm/src/server/ReactFlightDOMServerNode.js @@ -389,7 +389,7 @@ function decodeReplyFromBusboy( busboyStream.on('error', err => { reportGlobalError( response, - // $FlowFixMe[incompatible-call] types Error and mixed are incompatible + // $FlowFixMe[incompatible-type] types Error and mixed are incompatible err, ); }); diff --git a/packages/react-server-dom-parcel/src/ReactFlightParcelReferences.js b/packages/react-server-dom-parcel/src/ReactFlightParcelReferences.js index 3e7b603288e..b2ddb76ef23 100644 --- a/packages/react-server-dom-parcel/src/ReactFlightParcelReferences.js +++ b/packages/react-server-dom-parcel/src/ReactFlightParcelReferences.js @@ -56,7 +56,7 @@ const FunctionBind = Function.prototype.bind; // $FlowFixMe[method-unbinding] const ArraySlice = Array.prototype.slice; function bind(this: ServerReference): any { - // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] const newFn = FunctionBind.apply(this, arguments); if (this.$$typeof === SERVER_REFERENCE_TAG) { if (__DEV__) { diff --git a/packages/react-server-dom-parcel/src/server/ReactFlightDOMServerNode.js b/packages/react-server-dom-parcel/src/server/ReactFlightDOMServerNode.js index 294e99e502a..51036df700a 100644 --- a/packages/react-server-dom-parcel/src/server/ReactFlightDOMServerNode.js +++ b/packages/react-server-dom-parcel/src/server/ReactFlightDOMServerNode.js @@ -617,7 +617,7 @@ export function decodeReplyFromBusboy( busboyStream.on('error', err => { reportGlobalError( response, - // $FlowFixMe[incompatible-call] types Error and mixed are incompatible + // $FlowFixMe[incompatible-type] types Error and mixed are incompatible err, ); }); diff --git a/packages/react-server-dom-turbopack/src/ReactFlightTurbopackReferences.js b/packages/react-server-dom-turbopack/src/ReactFlightTurbopackReferences.js index 1b4525a3549..19d82e1310d 100644 --- a/packages/react-server-dom-turbopack/src/ReactFlightTurbopackReferences.js +++ b/packages/react-server-dom-turbopack/src/ReactFlightTurbopackReferences.js @@ -63,7 +63,7 @@ const FunctionBind = Function.prototype.bind; // $FlowFixMe[method-unbinding] const ArraySlice = Array.prototype.slice; function bind(this: ServerReference): any { - // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] const newFn = FunctionBind.apply(this, arguments); if (this.$$typeof === SERVER_REFERENCE_TAG) { if (__DEV__) { diff --git a/packages/react-server-dom-turbopack/src/server/ReactFlightDOMServerNode.js b/packages/react-server-dom-turbopack/src/server/ReactFlightDOMServerNode.js index 2f4301d1120..d8624e74b6b 100644 --- a/packages/react-server-dom-turbopack/src/server/ReactFlightDOMServerNode.js +++ b/packages/react-server-dom-turbopack/src/server/ReactFlightDOMServerNode.js @@ -609,7 +609,7 @@ function decodeReplyFromBusboy( busboyStream.on('error', err => { reportGlobalError( response, - // $FlowFixMe[incompatible-call] types Error and mixed are incompatible + // $FlowFixMe[incompatible-type] types Error and mixed are incompatible err, ); }); diff --git a/packages/react-server-dom-unbundled/src/ReactFlightUnbundledReferences.js b/packages/react-server-dom-unbundled/src/ReactFlightUnbundledReferences.js index de437414ef1..14407e0838f 100644 --- a/packages/react-server-dom-unbundled/src/ReactFlightUnbundledReferences.js +++ b/packages/react-server-dom-unbundled/src/ReactFlightUnbundledReferences.js @@ -63,7 +63,7 @@ const FunctionBind = Function.prototype.bind; // $FlowFixMe[method-unbinding] const ArraySlice = Array.prototype.slice; function bind(this: ServerReference): any { - // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] const newFn = FunctionBind.apply(this, arguments); if (this.$$typeof === SERVER_REFERENCE_TAG) { if (__DEV__) { diff --git a/packages/react-server-dom-unbundled/src/server/ReactFlightDOMServerNode.js b/packages/react-server-dom-unbundled/src/server/ReactFlightDOMServerNode.js index 647498a65d8..228ff286678 100644 --- a/packages/react-server-dom-unbundled/src/server/ReactFlightDOMServerNode.js +++ b/packages/react-server-dom-unbundled/src/server/ReactFlightDOMServerNode.js @@ -609,7 +609,7 @@ function decodeReplyFromBusboy( busboyStream.on('error', err => { reportGlobalError( response, - // $FlowFixMe[incompatible-call] types Error and mixed are incompatible + // $FlowFixMe[incompatible-type] types Error and mixed are incompatible err, ); }); diff --git a/packages/react-server-dom-webpack/src/ReactFlightWebpackNodeLoader.js b/packages/react-server-dom-webpack/src/ReactFlightWebpackNodeLoader.js index 9799acc3a07..69967b1ff4f 100644 --- a/packages/react-server-dom-webpack/src/ReactFlightWebpackNodeLoader.js +++ b/packages/react-server-dom-webpack/src/ReactFlightWebpackNodeLoader.js @@ -726,7 +726,7 @@ async function transformModuleIfNeeded( if (sourceMappingURL) { const sourceMapResult = await loader( sourceMappingURL, - // $FlowFixMe + // $FlowFixMe[incompatible-type] { format: 'json', conditions: [], @@ -738,7 +738,8 @@ async function transformModuleIfNeeded( const sourceMapString = typeof sourceMapResult.source === 'string' ? sourceMapResult.source - : // $FlowFixMe + : // $FlowFixMe[incompatible-call] + // $FlowFixMe[extra-arg] sourceMapResult.source.toString('utf8'); sourceMap = JSON.parse(sourceMapString); diff --git a/packages/react-server-dom-webpack/src/ReactFlightWebpackReferences.js b/packages/react-server-dom-webpack/src/ReactFlightWebpackReferences.js index de437414ef1..2e8c25bb1b0 100644 --- a/packages/react-server-dom-webpack/src/ReactFlightWebpackReferences.js +++ b/packages/react-server-dom-webpack/src/ReactFlightWebpackReferences.js @@ -64,6 +64,7 @@ const FunctionBind = Function.prototype.bind; const ArraySlice = Array.prototype.slice; function bind(this: ServerReference): any { // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] const newFn = FunctionBind.apply(this, arguments); if (this.$$typeof === SERVER_REFERENCE_TAG) { if (__DEV__) { @@ -254,6 +255,8 @@ function getReference(target: Function, name: string | symbol): $FlowFixMe { const clientReference: ClientReference = registerClientReferenceImpl(({}: any), target.$$id, true); + // $FlowFixMe[incompatible-type] + // $FlowFixMe[incompatible-variance] const proxy = new Proxy(clientReference, proxyHandlers); // Treat this as a resolved Promise for React's use() @@ -301,6 +304,7 @@ function getReference(target: Function, name: string | symbol): $FlowFixMe { target.$$async, ); Object.defineProperty((reference: any), 'name', {value: name}); + // $FlowFixMe[incompatible-type] cachedReference = target[name] = new Proxy(reference, deepProxyHandlers); } return cachedReference; @@ -348,5 +352,8 @@ export function createClientModuleProxy( moduleId, false, ); + // $FlowFixMe[incompatible-type] + // $FlowFixMe[incompatible-variance] + // $FlowFixMe[incompatible-exact] return new Proxy(clientReference, proxyHandlers); } diff --git a/packages/react-server-dom-webpack/src/client/ReactFlightClientConfigBundlerWebpackBrowser.js b/packages/react-server-dom-webpack/src/client/ReactFlightClientConfigBundlerWebpackBrowser.js index 7f49e9fd15a..d98b9de4c54 100644 --- a/packages/react-server-dom-webpack/src/client/ReactFlightClientConfigBundlerWebpackBrowser.js +++ b/packages/react-server-dom-webpack/src/client/ReactFlightClientConfigBundlerWebpackBrowser.js @@ -51,7 +51,7 @@ export function addChunkDebugInfo( const scriptFilename = __webpack_get_script_filename__(chunkId); let href; try { - // $FlowFixMe + // $FlowFixMe[incompatible-call] href = new URL(scriptFilename, document.baseURI).href; } catch (_) { href = scriptFilename; @@ -74,9 +74,9 @@ export function addChunkDebugInfo( } } const value = Promise.resolve(href); - // $FlowFixMe + // $FlowFixMe[prop-missing] value.status = 'fulfilled'; - // $FlowFixMe + // $FlowFixMe[prop-missing] value.value = { chunkId: chunkId, href: href, diff --git a/packages/react-server-dom-webpack/src/server/ReactFlightDOMServerNode.js b/packages/react-server-dom-webpack/src/server/ReactFlightDOMServerNode.js index 5e73d8eb3a5..a401db3fede 100644 --- a/packages/react-server-dom-webpack/src/server/ReactFlightDOMServerNode.js +++ b/packages/react-server-dom-webpack/src/server/ReactFlightDOMServerNode.js @@ -129,11 +129,12 @@ function startReadingFromDebugChannelReadable( const ws: WebSocket = (stream: any); ws.binaryType = 'arraybuffer'; ws.addEventListener('message', event => { - // $FlowFixMe + // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] onData(event.data); }); ws.addEventListener('error', event => { - // $FlowFixMe + // $FlowFixMe[prop-missing] onError(event.error); }); ws.addEventListener('close', onClose); @@ -610,6 +611,7 @@ function decodeReplyFromBusboy( reportGlobalError( response, // $FlowFixMe[incompatible-call] types Error and mixed are incompatible + // $FlowFixMe[incompatible-type] err, ); }); @@ -672,7 +674,8 @@ function decodeReplyFromAsyncIterable( reportGlobalError(response, reason); if (typeof (iterator: any).throw === 'function') { // The iterator protocol doesn't necessarily include this but a generator do. - // $FlowFixMe should be able to pass mixed + // $FlowFixMe[incompatible-call] should be able to pass mixed + // $FlowFixMe[prop-missing] iterator.throw(reason).then(error, error); } } diff --git a/packages/react-server/src/ReactFizzHooks.js b/packages/react-server/src/ReactFizzHooks.js index 119c2a0778f..9dfd5c3c2b7 100644 --- a/packages/react-server/src/ReactFizzHooks.js +++ b/packages/react-server/src/ReactFizzHooks.js @@ -546,7 +546,8 @@ function throwOnUseEffectEventCall() { export function useEffectEvent) => Return>( callback: F, ): F { - // $FlowIgnore[incompatible-return] + // $FlowFixMe[incompatible-return] + // $FlowFixMe[incompatible-type] return throwOnUseEffectEventCall; } @@ -630,7 +631,7 @@ function useActionState( const actionStateHookIndex = actionStateCounter++; const request: Request = (currentlyRenderingRequest: any); - // $FlowIgnore[prop-missing] + // $FlowFixMe[prop-missing] const formAction = action.$$FORM_ACTION; if (typeof formAction === 'function') { // This is a server action. These have additional features to enable @@ -652,7 +653,7 @@ function useActionState( let state = initialState; const componentKeyPath = (currentlyRenderingKeyPath: any); const postbackActionState = getFormState(request); - // $FlowIgnore[prop-missing] + // $FlowFixMe[prop-missing] const isSignatureEqual = action.$$IS_SIGNATURE_EQUAL; if ( postbackActionState !== null && @@ -686,9 +687,9 @@ function useActionState( boundAction(payload); }; - // $FlowIgnore[prop-missing] + // $FlowFixMe[prop-missing] if (typeof boundAction.$$FORM_ACTION === 'function') { - // $FlowIgnore[prop-missing] + // $FlowFixMe[prop-missing] dispatch.$$FORM_ACTION = (prefix: string) => { const metadata: ReactCustomFormAction = boundAction.$$FORM_ACTION(prefix); diff --git a/packages/react-server/src/ReactFizzNewContext.js b/packages/react-server/src/ReactFizzNewContext.js index 0a9fe3df4c3..f563091401c 100644 --- a/packages/react-server/src/ReactFizzNewContext.js +++ b/packages/react-server/src/ReactFizzNewContext.js @@ -163,6 +163,7 @@ export function switchContext(newSnapshot: ContextSnapshot): void { if (prev !== next) { if (prev === null) { // $FlowFixMe[incompatible-call]: This has to be non-null since it's not equal to prev. + // $FlowFixMe[incompatible-type] pushAllNext(next); } else if (next === null) { popAllPrevious(prev); diff --git a/packages/react-server/src/ReactFizzServer.js b/packages/react-server/src/ReactFizzServer.js index 4ad48d79fba..a99d245bb0c 100644 --- a/packages/react-server/src/ReactFizzServer.js +++ b/packages/react-server/src/ReactFizzServer.js @@ -1273,7 +1273,7 @@ function renderSuspenseBoundary( } return; } - // $FlowFixMe: Refined. + // $FlowFixMe[incompatible-type]: Refined. const task: RenderTask = someTask; const prevKeyPath = task.keyPath; @@ -2089,7 +2089,8 @@ function renderSuspenseList( // If it's an iterator we need to continue reading where we left // off. We can do that by reading the first few rows from the previous // thenable state. - // $FlowFixMe + // $FlowFixMe[incompatible-type] + // $FlowFixMe[underconstrained-implicit-instantiation] let step = readPreviousThenableFromState(); while (step !== undefined) { if (step.done) { @@ -2226,7 +2227,7 @@ function renderHostElement( props, )); if (isPreambleContext(newContext)) { - // $FlowFixMe: Refined + // $FlowFixMe[incompatible-type]: Refined renderPreamble(request, (task: RenderTask), segment, children); } else { // We use the non-destructive form because if something suspends, we still @@ -3414,7 +3415,8 @@ function retryNode(request: Request, task: Task): void { // If it's an iterator we need to continue reading where we left // off. We can do that by reading the first few rows from the previous // thenable state. - // $FlowFixMe + // $FlowFixMe[incompatible-type] + // $FlowFixMe[underconstrained-implicit-instantiation] let step = readPreviousThenableFromState(); while (step !== undefined) { if (step.done) { @@ -3704,7 +3706,7 @@ function renderChildrenArray( if (task.replay !== null) { replayFragment( request, - // $FlowFixMe: Refined. + // $FlowFixMe[incompatible-type]: Refined. task, children, childIndex, @@ -4097,7 +4099,7 @@ function renderNode( : null; const newTask = spawnNewSuspendedReplayTask( request, - // $FlowFixMe: Refined. + // $FlowFixMe[incompatible-type]: Refined. task, thenableState, ); @@ -4133,7 +4135,7 @@ function renderNode( : null; const newTask = spawnNewSuspendedReplayTask( request, - // $FlowFixMe: Refined. + // $FlowFixMe[incompatible-type]: Refined. task, thenableState, ); @@ -4198,7 +4200,7 @@ function renderNode( : null; const newTask = spawnNewSuspendedRenderTask( request, - // $FlowFixMe: Refined. + // $FlowFixMe[incompatible-type]: Refined. task, thenableState, ); @@ -4233,7 +4235,7 @@ function renderNode( : null; const newTask = spawnNewSuspendedRenderTask( request, - // $FlowFixMe: Refined. + // $FlowFixMe[incompatible-type]: Refined. task, thenableState, ); @@ -4944,13 +4946,13 @@ function retryTask(request: Request, task: Task): void { if (segment === null) { retryReplayTask( request, - // $FlowFixMe: Refined. + // $FlowFixMe[incompatible-type]: Refined. task, ); } else { retryRenderTask( request, - // $FlowFixMe: Refined. + // $FlowFixMe[incompatible-type]: Refined. task, segment, ); diff --git a/packages/react-server/src/ReactFlightActionServer.js b/packages/react-server/src/ReactFlightActionServer.js index 9062a6c03da..a1391083427 100644 --- a/packages/react-server/src/ReactFlightActionServer.js +++ b/packages/react-server/src/ReactFlightActionServer.js @@ -71,10 +71,12 @@ function decodeBoundActionMetaData( bound: null | Promise>, }>(actionResponse); // Force it to initialize - // $FlowFixMe + // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] refPromise.then(() => {}); if (refPromise.status !== 'fulfilled') { - // $FlowFixMe + // $FlowFixMe[incompatible-use] + // $FlowFixMe[prop-missing] throw refPromise.reason; } return refPromise.value; @@ -94,6 +96,7 @@ export function decodeAction( body.forEach((value: string | File, key: string) => { if (!key.startsWith('$ACTION_')) { // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] formData.append(key, value); return; } diff --git a/packages/react-server/src/ReactFlightReplyServer.js b/packages/react-server/src/ReactFlightReplyServer.js index 742cae6d201..3cab7f98516 100644 --- a/packages/react-server/src/ReactFlightReplyServer.js +++ b/packages/react-server/src/ReactFlightReplyServer.js @@ -318,6 +318,7 @@ function triggerErrorOnChunk( const streamChunk: InitializedStreamChunk = (chunk: any); const controller = streamChunk.reason; // $FlowFixMe[incompatible-call]: The error method should accept mixed. + // $FlowFixMe[incompatible-type] controller.error(error); return; } @@ -1178,6 +1179,7 @@ function parseReadableStream( error(error: mixed): void { if (previousBlockedChunk === null) { // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] controller.error(error); } else { const blockedChunk = previousBlockedChunk; @@ -1374,6 +1376,7 @@ function parseModelString( backingFormData.forEach((entry: File | string, entryKey: string) => { if (entryKey.startsWith(formPrefix)) { // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] data.append(entryKey.slice(formPrefix.length), entry); } }); diff --git a/packages/react-server/src/ReactFlightServer.js b/packages/react-server/src/ReactFlightServer.js index d5b534adb49..8559473d99e 100644 --- a/packages/react-server/src/ReactFlightServer.js +++ b/packages/react-server/src/ReactFlightServer.js @@ -394,6 +394,7 @@ function patchConsole(consoleInst: typeof console, methodName: string) { const originalMethod = descriptor.value; const originalName = Object.getOwnPropertyDescriptor( // $FlowFixMe[incompatible-call]: We should be able to get descriptors from any function. + // $FlowFixMe[incompatible-type] originalMethod, 'name', ); @@ -422,6 +423,7 @@ function patchConsole(consoleInst: typeof console, methodName: string) { emitConsoleChunk(request, methodName, owner, env, stack, args); } // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] return originalMethod.apply(this, arguments); }; if (originalName) { @@ -1142,7 +1144,7 @@ function serializeReadableStream( // receiving side. It also implies that different chunks can be split up or merged as opposed // to a readable stream that happens to have Uint8Array as the type which might expect it to be // received in the same slices. - // $FlowFixMe: This is a Node.js extension. + // $FlowFixMe[prop-missing]: This is a Node.js extension. let supportsBYOB: void | boolean = stream.supportsBYOB; if (supportsBYOB === undefined) { try { @@ -1220,7 +1222,6 @@ function serializeReadableStream( erroredTask(request, streamTask, reason); enqueueFlush(request); - // $FlowFixMe should be able to pass mixed reader.cancel(reason).then(error, error); } function abortStream() { @@ -1239,7 +1240,6 @@ function serializeReadableStream( erroredTask(request, streamTask, reason); enqueueFlush(request); } - // $FlowFixMe should be able to pass mixed reader.cancel(reason).then(error, error); } @@ -1353,7 +1353,8 @@ function serializeAsyncIterable( enqueueFlush(request); if (typeof (iterator: any).throw === 'function') { // The iterator protocol doesn't necessarily include this but a generator do. - // $FlowFixMe should be able to pass mixed + // $FlowFixMe[incompatible-call] should be able to pass mixed + // $FlowFixMe[prop-missing] iterator.throw(reason).then(error, error); } } @@ -1375,7 +1376,8 @@ function serializeAsyncIterable( } if (typeof (iterator: any).throw === 'function') { // The iterator protocol doesn't necessarily include this but a generator do. - // $FlowFixMe should be able to pass mixed + // $FlowFixMe[incompatible-call] should be able to pass mixed + // $FlowFixMe[prop-missing] iterator.throw(reason).then(error, error); } } @@ -1575,10 +1577,10 @@ function processServerComponentReturnValue( // tempting to try to return the value from a generator. if (iterator === iterableChild) { const isGeneratorComponent = - // $FlowIgnore[method-unbinding] + // $FlowFixMe[method-unbinding] Object.prototype.toString.call(Component) === '[object GeneratorFunction]' && - // $FlowIgnore[method-unbinding] + // $FlowFixMe[method-unbinding] Object.prototype.toString.call(iterableChild) === '[object Generator]'; if (!isGeneratorComponent) { @@ -1615,10 +1617,10 @@ function processServerComponentReturnValue( // tempting to try to return the value from a generator. if (iterator === iterableChild) { const isGeneratorComponent = - // $FlowIgnore[method-unbinding] + // $FlowFixMe[method-unbinding] Object.prototype.toString.call(Component) === '[object AsyncGeneratorFunction]' && - // $FlowIgnore[method-unbinding] + // $FlowFixMe[method-unbinding] Object.prototype.toString.call(iterableChild) === '[object AsyncGenerator]'; if (!isGeneratorComponent) { @@ -3222,16 +3224,17 @@ function serializeDebugBlob(request: Request, blob: Blob): string { // TODO: Emit the chunk early and refer to it later by dedupe. model.push(entry.value); // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] return reader.read().then(progress).catch(error); } function error(reason: mixed) { const digest = ''; emitErrorChunk(request, id, digest, reason, true, null); enqueueFlush(request); - // $FlowFixMe should be able to pass mixed reader.cancel(reason).then(noop, noop); } // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] reader.read().then(progress).catch(error); return '$B' + id.toString(16); } @@ -3270,6 +3273,7 @@ function serializeBlob(request: Request, blob: Blob): string { // TODO: Emit the chunk early and refer to it later by dedupe. model.push(entry.value); // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] return reader.read().then(progress).catch(error); } function error(reason: mixed) { @@ -3279,7 +3283,6 @@ function serializeBlob(request: Request, blob: Blob): string { request.cacheController.signal.removeEventListener('abort', abortBlob); erroredTask(request, newTask, reason); enqueueFlush(request); - // $FlowFixMe should be able to pass mixed reader.cancel(reason).then(error, error); } function abortBlob() { @@ -3298,13 +3301,13 @@ function serializeBlob(request: Request, blob: Blob): string { erroredTask(request, newTask, reason); enqueueFlush(request); } - // $FlowFixMe should be able to pass mixed reader.cancel(reason).then(error, error); } request.cacheController.signal.addEventListener('abort', abortBlob); // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] reader.read().then(progress).catch(error); return '$B' + newTask.id.toString(16); @@ -3889,6 +3892,7 @@ function renderModelDestructive( } // $FlowFixMe[incompatible-return] + // $FlowFixMe[incompatible-type] return value; } @@ -5018,6 +5022,7 @@ function renderDebugModel( } // $FlowFixMe[incompatible-return] + // $FlowFixMe[incompatible-type] return value; } @@ -5158,9 +5163,11 @@ function serializeDebugModel( debugNoOutline = model; try { // $FlowFixMe[incompatible-cast] stringify can return null + // $FlowFixMe[incompatible-type] return (stringify(model, replacer): string); } catch (x) { // $FlowFixMe[incompatible-cast] stringify can return null + // $FlowFixMe[incompatible-type] return (stringify( 'Unknown Value: React could not send it from the server.\n' + x.message, ): string); @@ -5222,9 +5229,11 @@ function emitOutlinedDebugModelChunk( let json: string; try { // $FlowFixMe[incompatible-cast] stringify can return null + // $FlowFixMe[incompatible-type] json = (stringify(model, replacer): string); } catch (x) { // $FlowFixMe[incompatible-cast] stringify can return null + // $FlowFixMe[incompatible-type] json = (stringify( 'Unknown Value: React could not send it from the server.\n' + x.message, ): string); diff --git a/packages/react-server/src/ReactFlightServerConfigDebugNode.js b/packages/react-server/src/ReactFlightServerConfigDebugNode.js index 9bb521be406..afd397b041e 100644 --- a/packages/react-server/src/ReactFlightServerConfigDebugNode.js +++ b/packages/react-server/src/ReactFlightServerConfigDebugNode.js @@ -237,7 +237,7 @@ export function initAsyncDebugInfo(): void { // If we begin before we resolve, that means that this is actually already resolved but // the promiseResolve hook is called at the end of the execution. So we track the time // in the before call instead. - // $FlowFixMe + // $FlowFixMe[incompatible-type] lastRanAwait = resolvePromiseOrAwaitNode(node, performance.now()); break; } diff --git a/packages/react-server/src/ReactServerConsoleConfigBrowser.js b/packages/react-server/src/ReactServerConsoleConfigBrowser.js index be8bf953467..19e03a14756 100644 --- a/packages/react-server/src/ReactServerConsoleConfigBrowser.js +++ b/packages/react-server/src/ReactServerConsoleConfigBrowser.js @@ -36,7 +36,7 @@ export function unbadgeConsole( case 'table': { // These methods cannot be colorized because they don't take a formatting string. // So we wouldn't have added any badge in the first place. - // $FlowFixMe + // $FlowFixMe[incompatible-type] return null; } case 'assert': { diff --git a/packages/react-server/src/ReactServerConsoleConfigPlain.js b/packages/react-server/src/ReactServerConsoleConfigPlain.js index d93e5f1a0dd..0208af4c975 100644 --- a/packages/react-server/src/ReactServerConsoleConfigPlain.js +++ b/packages/react-server/src/ReactServerConsoleConfigPlain.js @@ -27,7 +27,7 @@ export function unbadgeConsole( case 'table': { // These methods cannot be colorized because they don't take a formatting string. // So we wouldn't have added any badge in the first place. - // $FlowFixMe + // $FlowFixMe[incompatible-type] return null; } case 'assert': { diff --git a/packages/react-server/src/ReactServerConsoleConfigServer.js b/packages/react-server/src/ReactServerConsoleConfigServer.js index 7987b9b262f..bee6d7ad397 100644 --- a/packages/react-server/src/ReactServerConsoleConfigServer.js +++ b/packages/react-server/src/ReactServerConsoleConfigServer.js @@ -35,7 +35,7 @@ export function unbadgeConsole( case 'table': { // These methods cannot be colorized because they don't take a formatting string. // So we wouldn't have added any badge in the first place. - // $FlowFixMe + // $FlowFixMe[incompatible-type] return null; } case 'assert': { diff --git a/packages/react-server/src/ReactServerStreamConfigBrowser.js b/packages/react-server/src/ReactServerStreamConfigBrowser.js index 41d9aedd005..5fa325be5d4 100644 --- a/packages/react-server/src/ReactServerStreamConfigBrowser.js +++ b/packages/react-server/src/ReactServerStreamConfigBrowser.js @@ -179,6 +179,7 @@ export function closeWithError(destination: Destination, error: mixed): void { // $FlowFixMe[method-unbinding] if (typeof destination.error === 'function') { // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types. + // $FlowFixMe[incompatible-type] destination.error(error); } else { // Earlier implementations doesn't support this method. In that environment you're @@ -197,6 +198,7 @@ export function readAsDataURL(blob: Blob): Promise { return new Promise((resolve, reject) => { const reader = new FileReader(); // $FlowFixMe[incompatible-call]: We always expect a string result with readAsDataURL. + // $FlowFixMe[incompatible-type] reader.onloadend = () => resolve(reader.result); reader.onerror = reject; reader.readAsDataURL(blob); diff --git a/packages/react-server/src/ReactServerStreamConfigBun.js b/packages/react-server/src/ReactServerStreamConfigBun.js index a9079bee43a..06e419320c1 100644 --- a/packages/react-server/src/ReactServerStreamConfigBun.js +++ b/packages/react-server/src/ReactServerStreamConfigBun.js @@ -56,6 +56,7 @@ export function writeChunk( } // $FlowFixMe[incompatible-call]: write() is compatible with both types in Bun + // $FlowFixMe[incompatible-type] destination.write(chunk); } @@ -64,6 +65,7 @@ export function writeChunkAndReturn( chunk: PrecomputedChunk | Chunk | BinaryChunk, ): boolean { // $FlowFixMe[incompatible-call]: write() is compatible with both types in Bun + // $FlowFixMe[incompatible-type] return !!destination.write(chunk); } @@ -101,12 +103,14 @@ export function closeWithError(destination: Destination, error: mixed): void { // $FlowFixMe[method-unbinding] if (typeof destination.error === 'function') { // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types. + // $FlowFixMe[incompatible-type] destination.error(error); // $FlowFixMe[incompatible-use] // $FlowFixMe[method-unbinding] } else if (typeof destination.destroy === 'function') { // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types. + // $FlowFixMe[incompatible-type] destination.destroy(error); // $FlowFixMe[incompatible-use] diff --git a/packages/react-server/src/ReactServerStreamConfigEdge.js b/packages/react-server/src/ReactServerStreamConfigEdge.js index 90affdc6b8a..cdf4a372b8c 100644 --- a/packages/react-server/src/ReactServerStreamConfigEdge.js +++ b/packages/react-server/src/ReactServerStreamConfigEdge.js @@ -166,6 +166,7 @@ export function closeWithError(destination: Destination, error: mixed): void { // $FlowFixMe[method-unbinding] if (typeof destination.error === 'function') { // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types. + // $FlowFixMe[incompatible-type] destination.error(error); } else { // Earlier implementations doesn't support this method. In that environment you're diff --git a/packages/react-server/src/ReactServerStreamConfigNode.js b/packages/react-server/src/ReactServerStreamConfigNode.js index 90609da2c45..82396064e50 100644 --- a/packages/react-server/src/ReactServerStreamConfigNode.js +++ b/packages/react-server/src/ReactServerStreamConfigNode.js @@ -232,6 +232,7 @@ export function byteLengthOfBinaryChunk(chunk: BinaryChunk): number { export function closeWithError(destination: Destination, error: mixed): void { // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types. + // $FlowFixMe[incompatible-type] destination.destroy(error); } diff --git a/packages/react-server/src/ReactSharedInternalsServer.js b/packages/react-server/src/ReactSharedInternalsServer.js index efc3588a645..2dbb64c8d46 100644 --- a/packages/react-server/src/ReactSharedInternalsServer.js +++ b/packages/react-server/src/ReactSharedInternalsServer.js @@ -12,7 +12,9 @@ import type {SharedStateServer} from 'react/src/ReactSharedInternalsServer'; import * as React from 'react'; const ReactSharedInternalsServer: SharedStateServer = - // $FlowFixMe: It's defined in the one we resolve to. + // $FlowFixMe[prop-missing]: It's defined in the one we resolve to. + // $FlowFixMe[incompatible-type] + // $FlowFixMe[missing-export] React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; if (!ReactSharedInternalsServer) { diff --git a/packages/react-test-renderer/src/ReactTestRenderer.js b/packages/react-test-renderer/src/ReactTestRenderer.js index 08676503fa4..222c540e35c 100644 --- a/packages/react-test-renderer/src/ReactTestRenderer.js +++ b/packages/react-test-renderer/src/ReactTestRenderer.js @@ -67,6 +67,7 @@ import type {WorkTag} from 'react-reconciler/src/ReactWorkTags'; const defaultOnDefaultTransitionIndicator: () => void | (() => void) = noop; // $FlowFixMe[prop-missing]: This is only in the development export. +// $FlowFixMe[missing-export] const act = React.act; // TODO: Remove from public bundle @@ -179,7 +180,7 @@ function flatten(arr) { // $FlowFixMe[incompatible-use] n.i += 1; if (isArray(el)) { - // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] stack.push(n); stack.push({i: 0, array: el}); break; diff --git a/packages/react/src/ReactCacheClient.js b/packages/react/src/ReactCacheClient.js index ef1e8d6d1da..8b029e7e43f 100644 --- a/packages/react/src/ReactCacheClient.js +++ b/packages/react/src/ReactCacheClient.js @@ -28,6 +28,7 @@ function noopCache, T>(fn: (...A) => T): (...A) => T { // accidentally depend on those details. return function () { // $FlowFixMe[incompatible-call]: We don't want to use rest arguments since we transpile the code. + // $FlowFixMe[incompatible-type] return fn.apply(null, arguments); }; } diff --git a/packages/react/src/ReactCacheImpl.js b/packages/react/src/ReactCacheImpl.js index 2ff7431fc51..d6e0491b6c3 100644 --- a/packages/react/src/ReactCacheImpl.js +++ b/packages/react/src/ReactCacheImpl.js @@ -58,6 +58,7 @@ export function cache, T>(fn: (...A) => T): (...A) => T { if (!dispatcher) { // If there is no dispatcher, then we treat this as not being cached. // $FlowFixMe[incompatible-call]: We don't want to use rest arguments since we transpile the code. + // $FlowFixMe[incompatible-type] return fn.apply(null, arguments); } const fnMap: WeakMap> = dispatcher.getCacheForType( @@ -112,6 +113,7 @@ export function cache, T>(fn: (...A) => T): (...A) => T { } try { // $FlowFixMe[incompatible-call]: We don't want to use rest arguments since we transpile the code. + // $FlowFixMe[incompatible-type] const result = fn.apply(null, arguments); const terminatedNode: TerminatedCacheNode = (cacheNode: any); terminatedNode.s = TERMINATED; diff --git a/packages/react/src/ReactChildren.js b/packages/react/src/ReactChildren.js index d4c41d6669a..3969d410d65 100644 --- a/packages/react/src/ReactChildren.js +++ b/packages/react/src/ReactChildren.js @@ -369,7 +369,7 @@ function mapChildren( context: mixed, ): ?Array { if (children == null) { - // $FlowFixMe limitation refining abstract types in Flow + // $FlowFixMe[incompatible-type] limitation refining abstract types in Flow return children; } const result: Array = []; diff --git a/packages/react/src/ReactLazy.js b/packages/react/src/ReactLazy.js index 47f37afbae2..bf2a1262f84 100644 --- a/packages/react/src/ReactLazy.js +++ b/packages/react/src/ReactLazy.js @@ -112,9 +112,11 @@ function lazyInitializer(payload: Payload): T { const debugValue = moduleObject == null ? undefined : moduleObject.default; resolveDebugValue(debugValue); - // $FlowFixMe + // $FlowFixMe[incompatible-use] + // $FlowFixMe[prop-missing] ioInfo.value.status = 'fulfilled'; - // $FlowFixMe + // $FlowFixMe[incompatible-use] + // $FlowFixMe[prop-missing] ioInfo.value.value = debugValue; } // Make the thenable introspectable @@ -143,12 +145,15 @@ function lazyInitializer(payload: Payload): T { // $FlowFixMe[cannot-write] ioInfo.end = performance.now(); // Hide unhandled rejections. - // $FlowFixMe + // $FlowFixMe[incompatible-use] + // $FlowFixMe[prop-missing] ioInfo.value.then(noop, noop); rejectDebugValue(error); - // $FlowFixMe + // $FlowFixMe[incompatible-use] + // $FlowFixMe[prop-missing] ioInfo.value.status = 'rejected'; - // $FlowFixMe + // $FlowFixMe[incompatible-use] + // $FlowFixMe[prop-missing] ioInfo.value.reason = error; } // Make the thenable introspectable diff --git a/packages/scheduler/src/SchedulerMinHeap.js b/packages/scheduler/src/SchedulerMinHeap.js index da997bad357..c2e33d00564 100644 --- a/packages/scheduler/src/SchedulerMinHeap.js +++ b/packages/scheduler/src/SchedulerMinHeap.js @@ -34,6 +34,7 @@ export function pop(heap: Heap): T | null { // $FlowFixMe[incompatible-type] heap[0] = last; // $FlowFixMe[incompatible-call] + // $FlowFixMe[incompatible-type] siftDown(heap, last, 0); } return first; diff --git a/packages/scheduler/src/SchedulerProfiling.js b/packages/scheduler/src/SchedulerProfiling.js index 9fdd5906af6..b7cc640c34a 100644 --- a/packages/scheduler/src/SchedulerProfiling.js +++ b/packages/scheduler/src/SchedulerProfiling.js @@ -48,6 +48,7 @@ function logEvent(entries: Array) { } const newEventLog = new Int32Array(eventLogSize * 4); // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] newEventLog.set(eventLog); eventLogBuffer = newEventLog.buffer; eventLog = newEventLog; diff --git a/packages/scheduler/src/forks/Scheduler.js b/packages/scheduler/src/forks/Scheduler.js index 88239b71067..8afdb15b2b1 100644 --- a/packages/scheduler/src/forks/Scheduler.js +++ b/packages/scheduler/src/forks/Scheduler.js @@ -164,6 +164,7 @@ function flushWork(initialTime: number) { if (currentTask !== null) { const currentTime = getCurrentTime(); // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] markTaskErrored(currentTask, currentTime); // $FlowFixMe[incompatible-use] found when upgrading Flow currentTask.isQueued = false; @@ -207,6 +208,7 @@ function workLoop(initialTime: number) { const didUserCallbackTimeout = currentTask.expirationTime <= currentTime; if (enableProfiling) { // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] markTaskRun(currentTask, currentTime); } const continuationCallback = callback(didUserCallbackTimeout); @@ -218,6 +220,7 @@ function workLoop(initialTime: number) { currentTask.callback = continuationCallback; if (enableProfiling) { // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] markTaskYield(currentTask, currentTime); } advanceTimers(currentTime); @@ -225,6 +228,7 @@ function workLoop(initialTime: number) { } else { if (enableProfiling) { // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] markTaskCompleted(currentTask, currentTime); // $FlowFixMe[incompatible-use] found when upgrading Flow currentTask.isQueued = false; @@ -310,6 +314,7 @@ function unstable_next(eventHandler: () => T): T { function unstable_wrapCallback) => mixed>(callback: T): T { var parentPriorityLevel = currentPriorityLevel; // $FlowFixMe[incompatible-return] + // $FlowFixMe[incompatible-type] // $FlowFixMe[missing-this-annot] return function () { // This is a fork of runWithPriority, inlined for performance. diff --git a/packages/scheduler/src/forks/SchedulerMock.js b/packages/scheduler/src/forks/SchedulerMock.js index cf76126410e..e478700064f 100644 --- a/packages/scheduler/src/forks/SchedulerMock.js +++ b/packages/scheduler/src/forks/SchedulerMock.js @@ -164,6 +164,7 @@ function flushWork(hasTimeRemaining: boolean, initialTime: number) { if (currentTask !== null) { const currentTime = getCurrentTime(); // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] markTaskErrored(currentTask, currentTime); // $FlowFixMe[incompatible-use] found when upgrading Flow currentTask.isQueued = false; @@ -208,6 +209,7 @@ function workLoop(hasTimeRemaining: boolean, initialTime: number): boolean { const didUserCallbackTimeout = currentTask.expirationTime <= currentTime; if (enableProfiling) { // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] markTaskRun(currentTask, currentTime); } const continuationCallback = callback(didUserCallbackTimeout); @@ -219,6 +221,7 @@ function workLoop(hasTimeRemaining: boolean, initialTime: number): boolean { currentTask.callback = continuationCallback; if (enableProfiling) { // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] markTaskYield(currentTask, currentTime); } advanceTimers(currentTime); @@ -234,6 +237,7 @@ function workLoop(hasTimeRemaining: boolean, initialTime: number): boolean { } else { if (enableProfiling) { // $FlowFixMe[incompatible-call] found when upgrading Flow + // $FlowFixMe[incompatible-type] markTaskCompleted(currentTask, currentTime); // $FlowFixMe[incompatible-use] found when upgrading Flow currentTask.isQueued = false; @@ -313,6 +317,7 @@ function unstable_next(eventHandler: () => T): T { function unstable_wrapCallback) => mixed>(callback: T): T { var parentPriorityLevel = currentPriorityLevel; // $FlowFixMe[incompatible-return] + // $FlowFixMe[incompatible-type] // $FlowFixMe[missing-this-annot] return function () { // This is a fork of runWithPriority, inlined for performance. diff --git a/packages/shared/CheckStringCoercion.js b/packages/shared/CheckStringCoercion.js index a186d6755d9..b117b7acfe5 100644 --- a/packages/shared/CheckStringCoercion.js +++ b/packages/shared/CheckStringCoercion.js @@ -18,6 +18,7 @@ */ // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. +// $FlowFixMe[incompatible-type] function typeName(value: mixed): string { if (__DEV__) { // toStringTag is needed for namespaced types like Temporal.Instant @@ -27,11 +28,13 @@ function typeName(value: mixed): string { (value: any).constructor.name || 'Object'; // $FlowFixMe[incompatible-return] + // $FlowFixMe[incompatible-type] return type; } } // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. +// $FlowFixMe[incompatible-type] function willCoercionThrow(value: mixed): boolean { if (__DEV__) { try { diff --git a/yarn.lock b/yarn.lock index bfce9322918..4fb4cb244c6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9222,17 +9222,17 @@ flatted@^3.2.9: resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a" integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw== -flow-bin@^0.279.0: - version "0.279.0" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.279.0.tgz#06e502a51d735083d715ef769f43bdcb0fc2bb61" - integrity sha512-Xf0T82atOcEf5auHvJfUF+wWIxieBuUJZBu2hlAizdhAzwqSJic74ZLaL6N5SsE0SY9PxPf3Z/lBU7iRpRa9Lw== +flow-bin@^0.281.0: + version "0.281.0" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.281.0.tgz#be49afd6da986ba355e27d38775547b60b398e65" + integrity sha512-jgSKNLolqwtI4CZ/lTh/YKf0JAtFGTrf/8ETZkfxxyT5AYB9NfiO5KQttW0gtd63plppvw3ghyVFKLSK3TH6hg== -flow-remove-types@^2.279.0: - version "2.279.0" - resolved "https://registry.yarnpkg.com/flow-remove-types/-/flow-remove-types-2.279.0.tgz#3a3388d9158eba0f82c40d80d31d9640b883a3f5" - integrity sha512-bPFloMR/A2b/r/sIsf7Ix0LaMicCJNjwhXc4xEEQVzJCIz5u7C7XDaEOXOiqveKlCYK7DcBNn6R01Cbbc9gsYA== +flow-remove-types@^2.281.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== dependencies: - hermes-parser "0.29.1" + hermes-parser "0.32.0" pirates "^3.0.2" vlq "^0.2.1" @@ -10114,23 +10114,11 @@ hermes-estree@0.25.1: resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.25.1.tgz#6aeec17d1983b4eabf69721f3aa3eb705b17f480" integrity sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw== -hermes-estree@0.29.1: - version "0.29.1" - resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.29.1.tgz#043c7db076e0e8ef8c5f6ed23828d1ba463ebcc5" - integrity sha512-jl+x31n4/w+wEqm0I2r4CMimukLbLQEYpisys5oCre611CI5fc9TxhqkBBCJ1edDG4Kza0f7CgNz8xVMLZQOmQ== - hermes-estree@0.32.0: version "0.32.0" resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.32.0.tgz#bb7da6613ab8e67e334a1854ea1e209f487d307b" integrity sha512-KWn3BqnlDOl97Xe1Yviur6NbgIZ+IP+UVSpshlZWkq+EtoHg6/cwiDj/osP9PCEgFE15KBm1O55JRwbMEm5ejQ== -hermes-parser@0.29.1: - version "0.29.1" - resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.29.1.tgz#436b24bcd7bb1e71f92a04c396ccc0716c288d56" - integrity sha512-xBHWmUtRC5e/UL0tI7Ivt2riA/YBq9+SiYFU7C1oBa/j2jYGlIF9043oak1F47ihuDIxQ5nbsKueYJDRY02UgA== - dependencies: - hermes-estree "0.29.1" - hermes-parser@0.32.0, hermes-parser@^0.32.0: version "0.32.0" resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.32.0.tgz#7916984ef6fdce62e7415d354cf35392061cd303"