diff --git a/flow-typed/npm/react-dom_v17.x.x.js b/flow-typed/npm/react-dom_v17.x.x.js index cc2f334626fe..2aa09e1b8871 100644 --- a/flow-typed/npm/react-dom_v17.x.x.js +++ b/flow-typed/npm/react-dom_v17.x.x.js @@ -4,44 +4,44 @@ declare module 'react-dom' { declare var version: string; declare function findDOMNode( - componentOrElement: Element | ?Component + componentOrElement: Element | ?Component, ): null | Element | Text; declare function render( element: ExactReactElement_DEPRECATED, container: Element, - callback?: () => void + callback?: () => void, ): React.ElementRef; declare function hydrate( element: ExactReactElement_DEPRECATED, container: Element, - callback?: () => void + callback?: () => void, ): React.ElementRef; declare function createPortal( node: React.Node, - container: Element + container: Element, ): React.Portal; declare function unmountComponentAtNode(container: any): boolean; declare function unstable_batchedUpdates( - callback: (a: A, b: B, c: C, d: D, e: E) => mixed, + callback: (a: A, b: B, c: C, d: D, e: E) => unknown, a: A, b: B, c: C, d: D, - e: E + e: E, ): void; declare function unstable_renderSubtreeIntoContainer< - ElementType: React.ElementType + ElementType: React.ElementType, >( parentComponent: Component, nextElement: ExactReactElement_DEPRECATED, container: any, - callback?: () => void + callback?: () => void, ): React.ElementRef; } @@ -55,7 +55,7 @@ declare module 'react-dom/server' { declare function renderToNodeStream(element: React.Node): stream$Readable; declare function renderToStaticNodeStream( - element: React.Node + element: React.Node, ): stream$Readable; } @@ -63,77 +63,75 @@ declare module 'react-dom/test-utils' { import type {Component} from 'react'; declare interface Thenable { - then(resolve: () => mixed, reject?: () => mixed): mixed, + then(resolve: () => unknown, reject?: () => unknown): unknown; } declare var Simulate: { [eventName: string]: ( element: Element, - eventData?: { [key: string]: mixed, ... } + eventData?: {[key: string]: unknown, ...}, ) => void, ... }; declare function renderIntoDocument( - instance: React.MixedElement + instance: React.MixedElement, ): Component; declare function mockComponent( componentClass: React.ElementType, - mockTagName?: string - ): { [key: string]: mixed, ... }; + mockTagName?: string, + ): {[key: string]: unknown, ...}; declare function isElement(element: React.MixedElement): boolean; declare function isElementOfType( element: React.MixedElement, - componentClass: React.ElementType + componentClass: React.ElementType, ): boolean; declare function isDOMComponent(instance: any): boolean; - declare function isCompositeComponent( - instance: Component - ): boolean; + declare function isCompositeComponent(instance: Component): boolean; declare function isCompositeComponentWithType( instance: Component, - componentClass: React.ElementType + componentClass: React.ElementType, ): boolean; declare function findAllInRenderedTree( tree: Component, - test: (child: Component) => boolean + test: (child: Component) => boolean, ): Array>; declare function scryRenderedDOMComponentsWithClass( tree: Component, - className: string + className: string, ): Array; declare function findRenderedDOMComponentWithClass( tree: Component, - className: string + className: string, ): ?Element; declare function scryRenderedDOMComponentsWithTag( tree: Component, - tagName: string + tagName: string, ): Array; declare function findRenderedDOMComponentWithTag( tree: Component, - tagName: string + tagName: string, ): ?Element; declare function scryRenderedComponentsWithType( tree: Component, - componentClass: React.ElementType + componentClass: React.ElementType, ): Array>; declare function findRenderedComponentWithType( tree: Component, - componentClass: React.ElementType + componentClass: React.ElementType, ): ?Component; declare function act(callback: () => void | Thenable): Thenable; diff --git a/flow-typed/npm/react-test-renderer_v16.x.x.js b/flow-typed/npm/react-test-renderer_v16.x.x.js index e27d1a6d2114..067a36f54747 100644 --- a/flow-typed/npm/react-test-renderer_v16.x.x.js +++ b/flow-typed/npm/react-test-renderer_v16.x.x.js @@ -1,22 +1,25 @@ // Type definitions for react-test-renderer 16.x.x // Ported from: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-test-renderer -type TestRendererOptions = { createNodeMock(element: React.MixedElement): any, ... }; +type TestRendererOptions = { + createNodeMock(element: React.MixedElement): any, + ... +}; -declare module "react-test-renderer" { +declare module 'react-test-renderer' { import type {Component as ReactComponent} from 'react'; type ReactComponentInstance = ReactComponent; export type ReactTestRendererJSON = { type: string, - props: { [propName: string]: any, ... }, + props: {[propName: string]: any, ...}, children: null | ReactTestRendererJSON[], ... }; export type ReactTestRendererTree = ReactTestRendererJSON & { - nodeType: "component" | "host", + nodeType: 'component' | 'host', instance: ?ReactComponentInstance, rendered: null | ReactTestRendererTree, ... @@ -25,23 +28,23 @@ declare module "react-test-renderer" { export type ReactTestInstance = { instance: ?ReactComponentInstance, type: string, - props: { [propName: string]: any, ... }, + props: {[propName: string]: any, ...}, parent: null | ReactTestInstance, children: Array, find(predicate: (node: ReactTestInstance) => boolean): ReactTestInstance, findByType(type: React.ElementType): ReactTestInstance, - findByProps(props: { [propName: string]: any, ... }): ReactTestInstance, + findByProps(props: {[propName: string]: any, ...}): ReactTestInstance, findAll( predicate: (node: ReactTestInstance) => boolean, - options?: { deep: boolean, ... } + options?: {deep: boolean, ...}, ): ReactTestInstance[], findAllByType( type: React.ElementType, - options?: { deep: boolean, ... } + options?: {deep: boolean, ...}, ): ReactTestInstance[], findAllByProps( - props: { [propName: string]: any, ... }, - options?: { deep: boolean, ... } + props: {[propName: string]: any, ...}, + options?: {deep: boolean, ...}, ): ReactTestInstance[], ... }; @@ -56,17 +59,20 @@ declare module "react-test-renderer" { ... }; - declare type Thenable = { then(resolve: () => mixed, reject?: () => mixed): mixed, ... }; + declare type Thenable = { + then(resolve: () => unknown, reject?: () => unknown): unknown, + ... + }; declare function create( nextElement: React.MixedElement, - options?: TestRendererOptions + options?: TestRendererOptions, ): ReactTestRenderer; declare function act(callback: () => void | Promise): Thenable; } -declare module "react-test-renderer/shallow" { +declare module 'react-test-renderer/shallow' { import type {ReactTestInstance} from 'react-test-renderer'; declare export default class ShallowRenderer { diff --git a/flow-typed/npm/tinyglobby_v0.2.x.js b/flow-typed/npm/tinyglobby_v0.2.x.js index 6301f4bff5e5..96e77c27eb00 100644 --- a/flow-typed/npm/tinyglobby_v0.2.x.js +++ b/flow-typed/npm/tinyglobby_v0.2.x.js @@ -16,18 +16,27 @@ declare module 'tinyglobby' { followSymbolicLinks?: boolean, fs?: FileSystemAdapter, globstar?: boolean, - ignore?: string | $ReadOnlyArray, + ignore?: string | ReadonlyArray, onlyDirectories?: boolean, onlyFiles?: boolean, signal?: AbortSignal, }; declare type GlobModule = { - convertPathToPattern(path: string): string; - escapePath(path: string): string; - isDynamicPattern(pattern: string, options?: { caseSensitiveMatch: boolean }): boolean; - glob(patterns: string | $ReadOnlyArray, options?: GlobOptions): Promise; - globSync(patterns: string | $ReadOnlyArray, options?: GlobOptions): string[]; + convertPathToPattern(path: string): string, + escapePath(path: string): string, + isDynamicPattern( + pattern: string, + options?: {caseSensitiveMatch: boolean}, + ): boolean, + glob( + patterns: string | ReadonlyArray, + options?: GlobOptions, + ): Promise, + globSync( + patterns: string | ReadonlyArray, + options?: GlobOptions, + ): string[], }; declare module.exports: GlobModule; diff --git a/flow-typed/npm/yargs_v17.x.x.js b/flow-typed/npm/yargs_v17.x.x.js index 9f614e41f16f..6d0dcf8f6ae4 100644 --- a/flow-typed/npm/yargs_v17.x.x.js +++ b/flow-typed/npm/yargs_v17.x.x.js @@ -1,6 +1,6 @@ // flow-typed version: f7c859e705/yargs_v17.x.x/flow_>=v0.104.x -declare module "yargs" { +declare module 'yargs' { declare type Argv = { [key: string]: any, _: Array, @@ -12,13 +12,13 @@ declare module "yargs" { alias: string | Array, array: boolean, boolean: boolean, - choices: Array, - coerce: (arg: {[key: string]: any, ...} | any) => mixed, + choices: Array, + coerce: (arg: {[key: string]: any, ...} | any) => unknown, config: boolean, - configParser: (configPath: string) => { [key: string]: mixed, ... }, - conflicts: string | Array | { [key: string]: string, ... }, + configParser: (configPath: string) => {[key: string]: unknown, ...}, + conflicts: string | Array | {[key: string]: string, ...}, count: boolean, - default: mixed, + default: unknown, defaultDescription: string, demandOption: boolean | string, desc: string, @@ -27,7 +27,7 @@ declare module "yargs" { global: boolean, group: string, hidden: boolean, - implies: string | { [key: string]: string, ... }, + implies: string | {[key: string]: string, ...}, nargs: number, normalize: boolean, number: boolean, @@ -35,30 +35,32 @@ declare module "yargs" { requiresArg: boolean, skipValidation: boolean, string: boolean, - type: "array" | "boolean" | "count" | "number" | "string", + type: 'array' | 'boolean' | 'count' | 'number' | 'string', ... }>; declare type CommonModuleObject = {| command?: string | Array, aliases?: Array | string, - builder?: { [key: string]: Options, ... } | ((yargsInstance: Yargs) => mixed), - handler?: ((argv: Argv) => void) | ((argv: Argv) => Promise) + builder?: + | {[key: string]: Options, ...} + | ((yargsInstance: Yargs) => unknown), + handler?: ((argv: Argv) => void) | ((argv: Argv) => Promise), |}; declare type ModuleObjectDesc = {| ...CommonModuleObject, - desc?: string | false + desc?: string | false, |}; declare type ModuleObjectDescribe = {| ...CommonModuleObject, - describe?: string | false + describe?: string | false, |}; declare type ModuleObjectDescription = {| ...CommonModuleObject, - description?: string | false + description?: string | false, |}; declare type ModuleObject = @@ -66,9 +68,10 @@ declare module "yargs" { | ModuleObjectDescribe | ModuleObjectDescription; - declare type MiddleWareCallback = - | (argv: Argv, yargsInstance?: Yargs) => void - | (argv: Argv, yargsInstance?: Yargs) => Promise; + declare type MiddleWareCallback = ( + argv: Argv, + yargsInstance?: Yargs, + ) => void | ((argv: Argv, yargsInstance?: Yargs) => Promise); declare type Middleware = MiddleWareCallback | Array; @@ -76,29 +79,29 @@ declare module "yargs" { (args: Array): Yargs; alias(key: string, alias: string): this; - alias(alias: { [key: string]: string | Array, ... }): this; + alias(alias: {[key: string]: string | Array, ...}): this; argv: Argv | Promise; array(key: string | Array): this; boolean(parameter: string | Array): this; - check(fn: (argv: Argv, options: Array) => mixed): this; + check(fn: (argv: Argv, options: Array) => unknown): this; choices(key: string, allowed: Array): this; - choices(allowed: { [key: string]: Array, ... }): this; - coerce(key: string, fn: (value: any) => mixed): this; - coerce(object: { [key: string]: (value: any) => mixed, ... }): this; - coerce(keys: Array, fn: (value: any) => mixed): this; + choices(allowed: {[key: string]: Array, ...}): this; + coerce(key: string, fn: (value: any) => unknown): this; + coerce(object: {[key: string]: (value: any) => unknown, ...}): this; + coerce(keys: Array, fn: (value: any) => unknown): this; command( cmd: string | Array, desc: string | false, builder?: - | { [key: string]: Options, ... } - | ((yargsInstance: Yargs) => mixed), - handler?: Function + | {[key: string]: Options, ...} + | ((yargsInstance: Yargs) => unknown), + handler?: Function, ): this; command( cmd: string | Array, desc: string | false, - module: ModuleObject + module: ModuleObject, ): this; command(module: ModuleObject): this; @@ -106,14 +109,14 @@ declare module "yargs" { cmd: string | Array, desc: string | false, builder?: - | { [key: string]: Options, ... } - | ((yargsInstance: Yargs) => mixed), - handler?: Function + | {[key: string]: Options, ...} + | ((yargsInstance: Yargs) => unknown), + handler?: Function, ): this; commands( cmd: string | Array, desc: string | false, - module: ModuleObject + module: ModuleObject, ): this; commands(module: ModuleObject): this; @@ -131,36 +134,39 @@ declare module "yargs" { completion( cmd?: string, - description?: string | false | ( - current: string, - argv: Argv, - done: (compeltion: Array) => void - ) => ?(Array | Promise>), + description?: + | string + | false + | (( + current: string, + argv: Argv, + done: (compeltion: Array) => void, + ) => ?(Array | Promise>)), fn?: ( current: string, argv: Argv, - done: (completion: Array) => void - ) => ?(Array | Promise>) + done: (completion: Array) => void, + ) => ?(Array | Promise>), ): this; config( key?: string, description?: string, - parseFn?: (configPath: string) => { [key: string]: mixed, ... } + parseFn?: (configPath: string) => {[key: string]: unknown, ...}, ): this; config( key: string, - parseFn?: (configPath: string) => { [key: string]: mixed, ... } + parseFn?: (configPath: string) => {[key: string]: unknown, ...}, ): this; - config(config: { [key: string]: mixed, ... }): this; + config(config: {[key: string]: unknown, ...}): this; conflicts(key: string, value: string | Array): this; - conflicts(keys: { [key: string]: string | Array, ... }): this; + conflicts(keys: {[key: string]: string | Array, ...}): this; count(name: string): this; - default(key: string, value: mixed, description?: string): this; - default(defaults: { [key: string]: mixed, ... }): this; + default(key: string, value: unknown, description?: string): this; + default(defaults: {[key: string]: unknown, ...}): this; // Deprecated: use demandOption() and demandCommand() instead. demand(key: string, msg?: string | boolean): this; @@ -174,11 +180,11 @@ declare module "yargs" { min: number, max: number, minMsg?: string, - maxMsg?: string + maxMsg?: string, ): this; describe(key: string, description: string): this; - describe(describeObject: { [key: string]: string, ... }): this; + describe(describeObject: {[key: string]: string, ...}): this; detectLocale(shouldDetect: boolean): this; @@ -191,11 +197,15 @@ declare module "yargs" { exitProcess(enable: boolean): this; - fail(fn: false | (failureMessage: string, err: Error, yargs: Yargs) => mixed): this; + fail( + fn: + | false + | ((failureMessage: string, err: Error, yargs: Yargs) => unknown), + ): this; getCompletion( args: Array, - fn: (err: Error | null, completions: Array | void) => void + fn: (err: Error | null, completions: Array | void) => void, ): Promise | void>; global(globals: string | Array, isGlobal?: boolean): this; @@ -209,28 +219,29 @@ declare module "yargs" { hide(key: string): this; implies(key: string, value: string | Array): this; - implies(keys: { [key: string]: string | Array, ... }): this; + implies(keys: {[key: string]: string | Array, ...}): this; locale( - locale: | "de" - | "en" - | "es" - | "fr" - | "hi" - | "hu" - | "id" - | "it" - | "ja" - | "ko" - | "nb" - | "pirate" - | "pl" - | "pt" - | "pt_BR" - | "ru" - | "th" - | "tr" - | "zh_CN" + locale: + | 'de' + | 'en' + | 'es' + | 'fr' + | 'hi' + | 'hu' + | 'id' + | 'it' + | 'ja' + | 'ko' + | 'nb' + | 'pirate' + | 'pl' + | 'pt' + | 'pt_BR' + | 'ru' + | 'th' + | 'tr' + | 'zh_CN', ): this; locale(): string; @@ -246,39 +257,39 @@ declare module "yargs" { number(key: string | Array): this; option(key: string, options?: Options): this; - option(optionMap: { [key: string]: Options, ... }): this; + option(optionMap: {[key: string]: Options, ...}): this; options(key: string, options?: Options): this; - options(optionMap: { [key: string]: Options, ... }): this; + options(optionMap: {[key: string]: Options, ...}): this; parse( args?: string | Array, - context?: { [key: string]: any, ... }, - parseCallback?: (err: Error, argv: Argv, output?: string) => void + context?: {[key: string]: any, ...}, + parseCallback?: (err: Error, argv: Argv, output?: string) => void, ): Argv | Promise; parse( args?: string | Array, - parseCallback?: (err: Error, argv: Argv, output?: string) => void + parseCallback?: (err: Error, argv: Argv, output?: string) => void, ): Argv | Promise; parseAsync( args?: string | Array, - context?: { [key: string]: any, ... }, - parseCallback?: (err: Error, argv: Argv, output?: string) => void + context?: {[key: string]: any, ...}, + parseCallback?: (err: Error, argv: Argv, output?: string) => void, ): Promise; parseAsync( args?: string | Array, - parseCallback?: (err: Error, argv: Argv, output?: string) => void + parseCallback?: (err: Error, argv: Argv, output?: string) => void, ): Promise; parseSync( args?: string | Array, - context?: { [key: string]: any, ... }, - parseCallback?: (err: Error, argv: Argv, output?: string) => void + context?: {[key: string]: any, ...}, + parseCallback?: (err: Error, argv: Argv, output?: string) => void, ): Argv; parseSync( args?: string | Array, - parseCallback?: (err: Error, argv: Argv, output?: string) => void + parseCallback?: (err: Error, argv: Argv, output?: string) => void, ): Argv; parserConfiguration(configuration: {[key: string]: any, ...}): this; @@ -299,14 +310,14 @@ declare module "yargs" { showCompletionScript(): this; - showHelp(consoleLevel?: "error" | "warn" | "log"): this; + showHelp(consoleLevel?: 'error' | 'warn' | 'log'): this; showHelp(printCallback: (usageData: string) => void): this; showHelpOnFail(enable: boolean, message?: string): this; skipValidation(key: string): this; - showVersion(consoleLevel?: "error" | "warn" | "log"): this; + showVersion(consoleLevel?: 'error' | 'warn' | 'log'): this; showVersion(printCallback: (usageData: string) => void): this; strict(enabled?: boolean): this; @@ -319,11 +330,16 @@ declare module "yargs" { terminalWidth(): number; - updateLocale(obj: { [key: string]: string, ... }): this; - updateStrings(obj: { [key: string]: string, ... }): this; + updateLocale(obj: {[key: string]: string, ...}): this; + updateStrings(obj: {[key: string]: string, ...}): this; - usage(message: string, opts?: { [key: string]: Options, ... }): this; - usage(message: string, desc?: string, builder: CommonModuleObject["builder"], handler: CommonModuleObject["handler"]): this; + usage(message: string, opts?: {[key: string]: Options, ...}): this; + usage( + message: string, + desc?: string, + builder: CommonModuleObject['builder'], + handler: CommonModuleObject['handler'], + ): this; version(): this; version(version: string | false): this; @@ -331,7 +347,7 @@ declare module "yargs" { version( option: string | (() => string), description: string | (() => string), - version: string + version: string, ): this; wrap(columns: number | null): this; diff --git a/packages/react-native/Libraries/vendor/emitter/EventEmitter.js b/packages/react-native/Libraries/vendor/emitter/EventEmitter.js index 66bc3b61aa60..08d04a95f2c6 100644 --- a/packages/react-native/Libraries/vendor/emitter/EventEmitter.js +++ b/packages/react-native/Libraries/vendor/emitter/EventEmitter.js @@ -18,20 +18,20 @@ export interface EventSubscription { export interface IEventEmitter< TEventToArgsMap: Readonly>>, > { - addListener>( + addListener( eventType: TEvent, listener: (...args: TEventToArgsMap[TEvent]) => unknown, context?: unknown, ): EventSubscription; - emit>( + emit( eventType: TEvent, ...args: TEventToArgsMap[TEvent] ): void; - removeAllListeners>(eventType?: ?TEvent): void; + removeAllListeners(eventType?: ?TEvent): void; - listenerCount>(eventType: TEvent): number; + listenerCount(eventType: TEvent): number; } interface Registration { @@ -83,7 +83,7 @@ export default class EventEmitter< * Registers a listener that is called when the supplied event is emitted. * Returns a subscription that has a `remove` method to undo registration. */ - addListener>( + addListener( eventType: TEvent, listener: (...args: TEventToArgsMap[TEvent]) => unknown, context: unknown, @@ -95,7 +95,7 @@ export default class EventEmitter< } const registrations = allocate< TEventToArgsMap, - $Keys, + keyof TEventToArgsMap, TEventToArgsMap[TEvent], >(this.#registry, eventType); const registration: Registration = { @@ -116,7 +116,7 @@ export default class EventEmitter< * If a listener modifies the listeners registered for the same event, those * changes will not be reflected in the current invocation of `emit`. */ - emit>( + emit( eventType: TEvent, ...args: TEventToArgsMap[TEvent] ): void { @@ -134,9 +134,7 @@ export default class EventEmitter< /** * Removes all registered listeners. */ - removeAllListeners>( - eventType?: ?TEvent, - ): void { + removeAllListeners(eventType?: ?TEvent): void { if (eventType == null) { // $FlowFixMe[incompatible-type] this.#registry = {}; @@ -148,7 +146,7 @@ export default class EventEmitter< /** * Returns the number of registered listeners for the supplied event. */ - listenerCount>(eventType: TEvent): number { + listenerCount(eventType: TEvent): number { const registrations: ?Set> = this.#registry[eventType]; return registrations == null ? 0 : registrations.size; @@ -157,7 +155,7 @@ export default class EventEmitter< function allocate< TEventToArgsMap: Readonly>>, - TEvent: $Keys, + TEvent: keyof TEventToArgsMap, >( registry: Registry, eventType: TEvent,