Stop using prettier-plugin-hermes-parser for formatting (#57505)

Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57505

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D111190630

fbshipit-source-id: e7ed7ee6f05701fbdaad1c8fad58c47f48344487
This commit is contained in:
Sam Zhou authored and meta-codesync[bot] committed 2026-07-13 15:57:35 -07:00
1 parent fe511aba7c
commit 2235b8ec3f
70 files changed
+279 -579

No files matched your search

+1 -7
View File
@@ -7,11 +7,6 @@
* @format
*/
let plugins = ['prettier-plugin-hermes-parser'];
try {
plugins = require('./.prettier-plugins.fb.js');
} catch {}
module.exports = {
arrowParens: 'avoid',
bracketSameLine: true,
@@ -20,7 +15,6 @@ module.exports = {
singleQuote: true,
trailingComma: 'all',
endOfLine: 'lf',
plugins,
overrides: [
{
files: ['*.code-workspace'],
@@ -31,7 +25,7 @@ module.exports = {
{
files: ['*.js', '*.js.flow'],
options: {
parser: 'hermes',
parser: 'flow',
},
},
{
+15 -33
View File
@@ -457,8 +457,7 @@ declare class child_process$ChildProcessTyped<
TStdin extends stream$Writable | null,
TStdout extends stream$Readable | null,
TStderr extends stream$Readable | null,
> extends events$EventEmitter
{
> extends events$EventEmitter {
+stdin: TStdin;
+stdout: TStdout;
+stderr: TStderr;
@@ -578,8 +577,7 @@ declare module 'child_process' {
declare function execFile(
file: string,
argsOrCallback?:
| ReadonlyArray<string>
| child_process$execFileCallback<string>,
ReadonlyArray<string> | child_process$execFileCallback<string>,
callback?: child_process$execFileCallback<string>,
): child_process$ChildProcessTyped<
stream$Writable,
@@ -928,14 +926,7 @@ type crypto$key =
declare class crypto$KeyObject {
+asymmetricKeyType?:
| 'rsa'
| 'rsa-pss'
| 'dsa'
| 'ec'
| 'ed25519'
| 'ed448'
| 'x25519'
| 'x448';
'rsa' | 'rsa-pss' | 'dsa' | 'ec' | 'ed25519' | 'ed448' | 'x25519' | 'x448';
+asymmetricKeySize?: number;
+symmetricKeySize?: number;
+type: 'secret' | 'public' | 'private';
@@ -2560,9 +2551,9 @@ declare class http$Agent<+SocketT = net$Socket> {
sockets: {[name: string]: ReadonlyArray<SocketT>, ...};
}
declare class http$IncomingMessage<SocketT = net$Socket>
extends stream$Readable
{
declare class http$IncomingMessage<
SocketT = net$Socket,
> extends stream$Readable {
headers: Object;
rawHeaders: Array<string>;
httpVersion: string;
@@ -2578,9 +2569,9 @@ declare class http$IncomingMessage<SocketT = net$Socket>
rawTrailers: Array<string>;
}
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;
@@ -2878,10 +2869,7 @@ declare class net$Socket extends stream$Duplex {
destroyed: boolean;
end(
chunkOrEncodingOrCallback?:
| Buffer
| Uint8Array
| string
| ((data: any) => void),
Buffer | Uint8Array | string | ((data: any) => void),
encodingOrCallback?: string | ((data: any) => void),
callback?: (data: any) => void,
): this;
@@ -3211,9 +3199,9 @@ declare module 'perf_hooks' {
+detail?: T;
}
declare export class PerformanceMeasure<T = unknown>
extends PerformanceEntry
{
declare export class PerformanceMeasure<
T = unknown,
> extends PerformanceEntry {
+entryType: 'measure';
+detail?: T;
}
@@ -3398,11 +3386,7 @@ declare module 'querystring' {
*/
declare module 'node:sqlite' {
declare export type SupportedValueType =
| null
| number
| bigint
| string
| Uint8Array;
null | number | bigint | string | Uint8Array;
declare export type DatabaseSyncOptions = Readonly<{
open?: boolean,
@@ -5565,9 +5549,7 @@ declare module 'repl' {
writer?: (object: any, options?: util$InspectOptions) => string,
completer?: readline$InterfaceCompleter,
replMode?:
| $SymbolReplModeMagic
| $SymbolReplModeSloppy
| $SymbolReplModeStrict,
$SymbolReplModeMagic | $SymbolReplModeSloppy | $SymbolReplModeStrict,
breakEvalOnSigint?: boolean,
...
}): REPLServer;
+3 -15
View File
@@ -246,12 +246,7 @@ declare module '@babel/traverse' {
}
declare export type BindingKind =
| 'var'
| 'let'
| 'const'
| 'module'
| 'hoisted'
| 'unknown';
'var' | 'let' | 'const' | 'module' | 'hoisted' | 'unknown';
declare export class Binding {
constructor(opts: {
@@ -435,13 +430,7 @@ declare module '@babel/traverse' {
isBaseType(baseName: string, soft?: boolean): boolean;
couldBeBaseType(
name:
| 'string'
| 'number'
| 'boolean'
| 'any'
| 'mixed'
| 'empty'
| 'void',
'string' | 'number' | 'boolean' | 'any' | 'mixed' | 'empty' | 'void',
): boolean;
baseTypeStrictlyMatches(right: NodePath<>): ?boolean;
isGenericType(genericName: string): boolean;
@@ -1446,8 +1435,7 @@ declare module '@babel/traverse' {
}>;
declare export type VisitNode<-TNode extends BabelNode, TState> =
| VisitNodeFunction<TNode, TState>
| VisitNodeObject<TNode, TState>;
VisitNodeFunction<TNode, TState> | VisitNodeObject<TNode, TState>;
declare export type Visitor<TState = void> = Readonly<{
enter?: VisitNodeFunction<BabelNode, TState>,
+1 -2
View File
@@ -1293,8 +1293,7 @@ declare module '@babel/template' {
};
declare export type PublicReplacements =
| {[string]: ?BabelNode}
| Array<?BabelNode>;
{[string]: ?BabelNode} | Array<?BabelNode>;
declare export type TemplateBuilder<T> = {
// Build a new builder, merging the given options with the previous ones.
+2 -6
View File
@@ -15,8 +15,7 @@
declare module 'commander' {
declare type LiteralUnion<LiteralType, BaseType: string | number> =
| LiteralType
| {...BaseType, ...{[key: empty]: empty, ...}};
LiteralType | {...BaseType, ...{[key: empty]: empty, ...}};
declare export class CommanderError mixins Error {
code: string;
@@ -335,10 +334,7 @@ declare module 'commander' {
outputError?: (str: string, write: (str: string) => void) => void;
}
export type AddHelpTextPosition =
| 'beforeAll'
| 'before'
| 'after'
| 'afterAll';
'beforeAll' | 'before' | 'after' | 'afterAll';
export type HookEvent = 'preSubcommand' | 'preAction' | 'postAction';
export type OptionValueSource = LiteralUnion<
'default' | 'config' | 'env' | 'cli' | 'implied',
+2 -9
View File
@@ -49,21 +49,14 @@ declare module '@electron/packager' {
ProductName?: string,
InternalName?: string,
'requested-execution-level'?:
| 'asInvoker'
| 'highestAvailable'
| 'requireAdministrator',
'asInvoker' | 'highestAvailable' | 'requireAdministrator',
'application-manifest'?: string,
}>;
declare export type WindowsSignOptions = $FlowFixMe;
declare export type OfficialArch =
| 'ia32'
| 'x64'
| 'armv7l'
| 'arm64'
| 'mips64el'
| 'universal';
'ia32' | 'x64' | 'armv7l' | 'arm64' | 'mips64el' | 'universal';
declare export type OfficialPlatform = 'linux' | 'win32' | 'darwin' | 'mas';
+2 -8
View File
@@ -13,12 +13,7 @@
declare module 'execa' {
declare type StdIoOption =
| 'pipe'
| 'ipc'
| 'ignore'
| 'inherit'
| stream$Stream
| number;
'pipe' | 'ipc' | 'ignore' | 'inherit' | stream$Stream | number;
declare type CommonOptions = {
argv0?: string,
@@ -74,8 +69,7 @@ declare module 'execa' {
};
declare interface ExecaPromise
extends Promise<Result>,
child_process$ChildProcess {}
extends Promise<Result>, child_process$ChildProcess {}
declare interface ExecaError extends ErrnoError {
stdout: string;
+1 -4
View File
@@ -214,10 +214,7 @@ type FakeTimersConfig = {
*/
type JestStyledComponentsMatcherValue =
| string
| JestAsymmetricEqualityType
| RegExp
| void;
string | JestAsymmetricEqualityType | RegExp | void;
type JestStyledComponentsMatcherOptions = {
media?: string,
+1 -7
View File
@@ -155,13 +155,7 @@ declare module 'jsonc-parser' {
| 'InvalidCharacter'
| '<unknown ParseErrorCode>';
export type NodeType =
| 'object'
| 'array'
| 'property'
| 'string'
| 'number'
| 'boolean'
| 'null';
'object' | 'array' | 'property' | 'string' | 'number' | 'boolean' | 'null';
export type Node = {
type: NodeType,
value?: any,
+2 -12
View File
@@ -157,12 +157,7 @@ declare module 'node-fetch' {
}
declare type ResponseType =
| 'basic'
| 'cors'
| 'default'
| 'error'
| 'opaque'
| 'opaqueredirect';
'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect';
declare interface ResponseInit {
headers?: HeaderInit;
@@ -172,12 +167,7 @@ declare module 'node-fetch' {
declare type HeaderInit = Headers | Array<string>;
declare type BodyInit =
| string
| null
| Buffer
| Blob
| Readable
| URLSearchParams;
string | null | Buffer | Blob | Readable | URLSearchParams;
declare function fetch(
url: string | URL | Request,
+1 -3
View File
@@ -37,9 +37,7 @@ declare type PrettyFormatPlugin =
declare module 'pretty-format' {
declare export type CompareKeys =
| ((a: string, b: string) => number)
| null
| void;
((a: string, b: string) => number) | null | void;
declare export function format(
value: unknown,
options?: ?{
+11 -15
View File
@@ -9,11 +9,14 @@
declare interface rxjs$UnaryFunction<T, R> {
(source: T): R;
}
declare interface rxjs$OperatorFunction<T, R>
extends rxjs$UnaryFunction<rxjs$Observable<T>, rxjs$Observable<R>> {}
declare interface rxjs$OperatorFunction<T, R> extends rxjs$UnaryFunction<
rxjs$Observable<T>,
rxjs$Observable<R>,
> {}
declare type rxjs$FactoryOrValue<T> = T | (() => T);
declare interface rxjs$MonoTypeOperatorFunction<T>
extends rxjs$OperatorFunction<T, T> {}
declare interface rxjs$MonoTypeOperatorFunction<
T,
> extends rxjs$OperatorFunction<T, T> {}
declare interface rxjs$Timestamp<T> {
value: T;
timestamp: number;
@@ -47,9 +50,7 @@ declare interface rxjs$Subscribable<T> {
): rxjs$Unsubscribable;
}
declare type rxjs$ObservableInput<T> =
| rxjs$SubscribableOrPromise<T>
| Array<T>
| Iterable<T>;
rxjs$SubscribableOrPromise<T> | Array<T> | Iterable<T>;
declare type rxjs$InteropObservable<T> = {
[string | unknown]: () => rxjs$Subscribable<T>,
@@ -588,8 +589,7 @@ declare module 'rxjs' {
(<T>(...sources: rxjs$ObservableInput<T>[]) => rxjs$Observable<T[]>),
from<T>(
input:
| rxjs$ObservableInput<T>
| rxjs$ObservableInput<rxjs$ObservableInput<T>>,
rxjs$ObservableInput<T> | rxjs$ObservableInput<rxjs$ObservableInput<T>>,
scheduler?: rxjs$SchedulerLike,
): rxjs$Observable<T>,
ArgumentOutOfRangeError: ArgumentOutOfRangeError,
@@ -630,9 +630,7 @@ declare module 'rxjs' {
) => rxjs$Observable<T>) &
(<T, R>(
...observables: (
| rxjs$ObservableInput<any>
| rxjs$SchedulerLike
| number
rxjs$ObservableInput<any> | rxjs$SchedulerLike | number
)[]
) => rxjs$Observable<R>) &
(<T>(
@@ -3349,9 +3347,7 @@ declare module 'rxjs/webSocket' {
_output: rxjs$Subject<T>;
constructor(
urlConfigOrSource:
| string
| WebSocketSubjectConfig<T>
| rxjs$Observable<T>,
string | WebSocketSubjectConfig<T> | rxjs$Observable<T>,
destination?: rxjs$Observer<T>,
): void;
lift<R>(operator: rxjs$Operator<T, R>): WebSocketSubject<R>;
+1 -8
View File
@@ -48,14 +48,7 @@ declare type $npm$shelljs$GrepOpts = $npm$shelljs$OptionsPoly<'-l' | '-v'>;
declare type $npm$shelljs$SedOpts = $npm$shelljs$OptionsPoly<'-i'>;
declare type $npm$shelljs$SortOpts = $npm$shelljs$OptionsPoly<'-n' | '-r'>;
declare type $npm$shelljs$TestOpts =
| '-b'
| '-c'
| '-d'
| '-e'
| '-f'
| '-L'
| '-p'
| '-S';
'-b' | '-c' | '-d' | '-e' | '-f' | '-L' | '-p' | '-S';
declare type $npm$shelljs$TouchOpts = {
[key: '-a' | '-c' | '-m']: boolean,
'-d'?: string,
+1 -3
View File
@@ -101,9 +101,7 @@ declare module 'tinybench' {
// but we type it this way to avoid mistakes (we can make breaking changes
// in our definition that they can't).
export type Fn = () =>
| Promise<void | FnReturnedObject>
| void
| FnReturnedObject;
Promise<void | FnReturnedObject> | void | FnReturnedObject;
declare export class Bench extends EventTarget {
concurrency: null | 'task' | 'bench';
@@ -21,10 +21,7 @@ const debugCDPMessages = require('debug')('Metro:InspectorProxyCDPMessages');
const CDP_MESSAGES_BATCH_DEBUGGING_THROTTLE_MS = 5000;
export type CDPMessageDestination =
| 'DebuggerToProxy'
| 'ProxyToDebugger'
| 'DeviceToProxy'
| 'ProxyToDevice';
'DebuggerToProxy' | 'ProxyToDebugger' | 'DeviceToProxy' | 'ProxyToDevice';
function getCDPLogPrefix(destination: CDPMessageDestination): string {
return util.format(
@@ -107,16 +107,11 @@ export type GetPagesResponse = {
// Union type for all possible messages sent from device to Inspector Proxy.
export type MessageFromDevice =
| GetPagesResponse
| WrappedEventFromDevice
| DisconnectRequest;
GetPagesResponse | WrappedEventFromDevice | DisconnectRequest;
// Union type for all possible messages sent from Inspector Proxy to device.
export type MessageToDevice =
| GetPagesRequest
| WrappedEventToDevice
| ConnectRequest
| DisconnectRequest;
GetPagesRequest | WrappedEventToDevice | ConnectRequest | DisconnectRequest;
// Page description object that is sent in response to /json HTTP request from debugger.
export type PageDescription = Readonly<{
@@ -58,14 +58,12 @@ module.exports = {
}
const properties = args[0].properties;
properties.forEach(property => {
if (
!(
property.type === 'Property' &&
(property.value.type === 'Literal' ||
(property.value.type === 'CallExpression' &&
property.value.callee.name === 'PlatformColor'))
)
) {
if (!(
property.type === 'Property' &&
(property.value.type === 'Literal' ||
(property.value.type === 'CallExpression' &&
property.value.callee.name === 'PlatformColor'))
)) {
context.report({
node,
messageId: 'dynamicColorIOSValue',
+9 -13
View File
@@ -91,22 +91,18 @@ function isModuleRequire(node) {
}
const memberExpression = callExpression.callee;
if (
!(
memberExpression.object.type === 'Identifier' &&
memberExpression.object.name === 'TurboModuleRegistry'
)
) {
if (!(
memberExpression.object.type === 'Identifier' &&
memberExpression.object.name === 'TurboModuleRegistry'
)) {
return false;
}
if (
!(
memberExpression.property.type === 'Identifier' &&
(memberExpression.property.name === 'get' ||
memberExpression.property.name === 'getEnforcing')
)
) {
if (!(
memberExpression.property.type === 'Identifier' &&
(memberExpression.property.name === 'get' ||
memberExpression.property.name === 'getEnforcing')
)) {
return false;
}
return true;
+2 -3
View File
@@ -28,9 +28,8 @@ module.exports = {
resolver: require.resolve('./jest/resolver.js'),
transform: {
'^.+\\.(js|ts|tsx)$': 'babel-jest',
'^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$': require.resolve(
'./jest/assetFileTransformer.js',
),
'^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$':
require.resolve('./jest/assetFileTransformer.js'),
},
transformIgnorePatterns: [
'node_modules/(?!((jest-)?react-native|@react-native(-community)?)/)',
+4 -6
View File
@@ -85,12 +85,10 @@ export function getDefaultConfig(projectRoot: string): ConfigT {
transformer: {
allowOptionalDependencies: true,
assetRegistryPath: 'react-native/asset-registry',
asyncRequireModulePath: require.resolve(
'metro-runtime/src/modules/asyncRequire',
),
babelTransformerPath: require.resolve(
'@react-native/metro-babel-transformer',
),
asyncRequireModulePath:
require.resolve('metro-runtime/src/modules/asyncRequire'),
babelTransformerPath:
require.resolve('@react-native/metro-babel-transformer'),
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
+5 -10
View File
@@ -270,8 +270,7 @@ export type ReservedTypeAnnotation = Readonly<{
* NativeModule Types
*/
export type Nullable<out T extends NativeModuleTypeAnnotation> =
| NullableTypeAnnotation<T>
| T;
NullableTypeAnnotation<T> | T;
export type NullableTypeAnnotation<out T extends NativeModuleTypeAnnotation> =
Readonly<{
@@ -345,8 +344,7 @@ export type NativeModuleEnumMember = {
};
export type NativeModuleEnumMemberType =
| 'NumberTypeAnnotation'
| 'StringTypeAnnotation';
'NumberTypeAnnotation' | 'StringTypeAnnotation';
export type NativeModuleEnumDeclaration = Readonly<{
name: string,
@@ -436,12 +434,10 @@ export type NativeModuleBaseTypeAnnotation =
| NativeModuleMixedTypeAnnotation;
export type NativeModuleParamTypeAnnotation =
| NativeModuleBaseTypeAnnotation
| NativeModuleParamOnlyTypeAnnotation;
NativeModuleBaseTypeAnnotation | NativeModuleParamOnlyTypeAnnotation;
export type NativeModuleReturnTypeAnnotation =
| NativeModuleBaseTypeAnnotation
| NativeModuleReturnOnlyTypeAnnotation;
NativeModuleBaseTypeAnnotation | NativeModuleReturnOnlyTypeAnnotation;
export type NativeModuleTypeAnnotation =
| NativeModuleBaseTypeAnnotation
@@ -452,8 +448,7 @@ export type NativeModuleTypeAnnotation =
type NativeModuleParamOnlyTypeAnnotation = NativeModuleFunctionTypeAnnotation;
type NativeModuleReturnOnlyTypeAnnotation =
| NativeModulePromiseTypeAnnotation
| VoidTypeAnnotation;
NativeModulePromiseTypeAnnotation | VoidTypeAnnotation;
// Add the allowed component reserved types to the native module union
export type CompleteReservedTypeAnnotation =
@@ -49,14 +49,12 @@ function buildCommandSchema(
const firstParam = value.params[0].typeAnnotation;
if (
!(
firstParam.id != null &&
firstParam.id.type === 'QualifiedTypeIdentifier' &&
firstParam.id.qualification.name === 'React' &&
firstParam.id.id.name === 'ElementRef'
)
) {
if (!(
firstParam.id != null &&
firstParam.id.type === 'QualifiedTypeIdentifier' &&
firstParam.id.qualification.name === 'React' &&
firstParam.id.id.name === 'ElementRef'
)) {
throw new Error(
`The first argument of method ${name} must be of type React.ElementRef<>`,
);
@@ -33,15 +33,13 @@ function buildCommandSchemaInternal(
parser: Parser,
): NamedShape<CommandTypeAnnotation> {
const firstParam = parameters[0].typeAnnotation;
if (
!(
firstParam.typeAnnotation != null &&
firstParam.typeAnnotation.type === 'TSTypeReference' &&
firstParam.typeAnnotation.typeName.left?.name === 'React' &&
(firstParam.typeAnnotation.typeName.right?.name === 'ElementRef' ||
firstParam.typeAnnotation.typeName.right?.name === 'ComponentRef')
)
) {
if (!(
firstParam.typeAnnotation != null &&
firstParam.typeAnnotation.type === 'TSTypeReference' &&
firstParam.typeAnnotation.typeName.left?.name === 'React' &&
(firstParam.typeAnnotation.typeName.right?.name === 'ElementRef' ||
firstParam.typeAnnotation.typeName.right?.name === 'ComponentRef')
)) {
throw new Error(
`The first argument of method ${name} must be of type React.ElementRef<> or React.ComponentRef<>`,
);
@@ -354,8 +354,7 @@ function setDefaultValue(
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
* roll out. See https://fburl.com/workplace/5whu3i34. */
(defaultValue === null ? null : defaultValue ? defaultValue : 0) as
| number
| null;
number | null;
break;
case 'BooleanTypeAnnotation':
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
@@ -364,8 +363,7 @@ function setDefaultValue(
break;
case 'StringTypeAnnotation':
common.default = (defaultValue === undefined ? null : defaultValue) as
| string
| null;
string | null;
break;
}
}
+9 -13
View File
@@ -177,22 +177,18 @@ function isModuleRegistryCall(node: $FlowFixMe): boolean {
}
const memberExpression = callExpression.callee;
if (
!(
memberExpression.object.type === 'Identifier' &&
memberExpression.object.name === 'TurboModuleRegistry'
)
) {
if (!(
memberExpression.object.type === 'Identifier' &&
memberExpression.object.name === 'TurboModuleRegistry'
)) {
return false;
}
if (
!(
memberExpression.property.type === 'Identifier' &&
(memberExpression.property.name === 'get' ||
memberExpression.property.name === 'getEnforcing')
)
) {
if (!(
memberExpression.property.type === 'Identifier' &&
(memberExpression.property.name === 'get' ||
memberExpression.property.name === 'getEnforcing')
)) {
return false;
}
@@ -120,8 +120,7 @@ export type UnionMembersComparisonResult = {
}>,
};
export type MembersComparisonResult =
| EnumMembersComparisonResult
| UnionMembersComparisonResult;
EnumMembersComparisonResult | UnionMembersComparisonResult;
export type NullableComparisonResult = {
/* Four possible cases of change:
void goes to T? :: typeRefined !optionsReduced
@@ -87,9 +87,7 @@ type ExportableSchemaDiffers = {
};
export type SchemaDiffCategory = 'new' | 'deprecated' | SchemaDiffers;
type ExportableSchemaDiffCategory =
| 'new'
| 'deprecated'
| ExportableSchemaDiffers;
'new' | 'deprecated' | ExportableSchemaDiffers;
export type SchemaDiff = {
name: string,
framework: Framework,
+1 -4
View File
@@ -17,10 +17,7 @@ import {alertWithArgs} from './RCTAlertManager';
* @platform ios
*/
export type AlertType =
| 'default'
| 'plain-text'
| 'secure-text'
| 'login-password';
'default' | 'plain-text' | 'secure-text' | 'login-password';
/**
* @platform ios
+1 -3
View File
@@ -21,9 +21,7 @@ import AnimatedValueXY from './nodes/AnimatedValueXY';
import invariant from 'invariant';
export type Mapping =
| {[key: string]: Mapping, ...}
| AnimatedValue
| AnimatedValueXY;
{[key: string]: Mapping, ...} | AnimatedValue | AnimatedValueXY;
export type EventConfig<T> = {
listener?: ?(NativeSyntheticEvent<T>) => unknown,
useNativeDriver: boolean,
@@ -34,20 +34,19 @@ type Builtin = (...ReadonlyArray<empty>) => unknown | Date | Error | RegExp;
export type WithAnimatedValue<out T> = T extends Builtin | Nullable
? T
: T extends Primitive
?
| T
| AnimatedNode
| AnimatedAddition
| AnimatedSubtraction
| AnimatedDivision
| AnimatedMultiplication
| AnimatedModulo
| AnimatedDiffClamp
| AnimatedValue
| AnimatedInterpolation<number | string>
| AnimatedInterpolation<number>
| AnimatedInterpolation<string>
| AnimatedInterpolation<NativeColorValue>
? | T
| AnimatedNode
| AnimatedAddition
| AnimatedSubtraction
| AnimatedDivision
| AnimatedMultiplication
| AnimatedModulo
| AnimatedDiffClamp
| AnimatedValue
| AnimatedInterpolation<number | string>
| AnimatedInterpolation<number>
| AnimatedInterpolation<string>
| AnimatedInterpolation<NativeColorValue>
: T extends ReadonlyArray<infer P>
? ReadonlyArray<WithAnimatedValue<P>>
: T extends {...}
@@ -28,9 +28,7 @@ import invariant from 'invariant';
type ExtrapolateType = 'extend' | 'identity' | 'clamp';
export type InterpolationConfigSupportedOutputType =
| number
| string
| NativeColorValue;
number | string | NativeColorValue;
export type InterpolationConfigType<
OutputT extends InterpolationConfigSupportedOutputType,
+1 -5
View File
@@ -29,11 +29,7 @@ import NativeAppState from './NativeAppState';
* @platform ios `inactive`
*/
export type AppStateStatus =
| 'inactive'
| 'background'
| 'active'
| 'extension'
| 'unknown';
'inactive' | 'background' | 'active' | 'extension' | 'unknown';
/**
* Events emitted by `AppState`.
@@ -130,8 +130,7 @@ class MessageQueue {
}
flushedQueue():
| null
| [Array<number>, Array<number>, Array<unknown>, number] {
null | [Array<number>, Array<number>, Array<unknown>, number] {
this.__guard(() => {
this.__callReactNativeMicrotasks();
});
@@ -43,10 +43,7 @@ type AccessibilityEventDefinitions = {
};
type AccessibilityEventTypes =
| 'click'
| 'focus'
| 'viewHoverEnter'
| 'windowStateChange';
'click' | 'focus' | 'viewHoverEnter' | 'windowStateChange';
// Mapping of public event names to platform-specific event names.
const EventNames: Map<keyof AccessibilityEventDefinitions, string> =
+1 -2
View File
@@ -168,8 +168,7 @@ export type ButtonProps = Readonly<{
}>;
const NativeTouchable:
| typeof TouchableNativeFeedback
| typeof TouchableOpacity =
typeof TouchableNativeFeedback | typeof TouchableOpacity =
Platform.OS === 'android' ? TouchableNativeFeedback : TouchableOpacity;
export type ButtonInstance = React.ElementRef<typeof NativeTouchable>;
@@ -19,11 +19,7 @@ import NativeKeyboardObserver from './NativeKeyboardObserver';
export type KeyboardEventName = keyof KeyboardEventDefinitions;
export type KeyboardEventEasing =
| 'easeIn'
| 'easeInEaseOut'
| 'easeOut'
| 'linear'
| 'keyboard';
'easeIn' | 'easeInEaseOut' | 'easeOut' | 'linear' | 'keyboard';
export type KeyboardMetrics = Readonly<{
screenX: number,
@@ -142,8 +142,7 @@ type PressableBaseProps = Readonly<{
* the component is currently pressed and returns view styles.
*/
style?:
| ViewStyleProp
| ((state: PressableStateCallbackType) => ViewStyleProp),
ViewStyleProp | ((state: PressableStateCallbackType) => ViewStyleProp),
/**
* Identifier used to find this view in tests.
@@ -199,8 +199,7 @@ export type DecelerationRateType = 'fast' | 'normal' | number;
export type ScrollResponderType = ScrollViewImperativeMethods;
export interface ScrollViewInstance
extends HostInstance,
ScrollViewImperativeMethods {}
extends HostInstance, ScrollViewImperativeMethods {}
type InnerViewInstance = React.ElementRef<typeof View>;
@@ -394,10 +393,7 @@ export type ScrollViewPropsIOS = Readonly<{
* @platform ios
*/
contentInsetAdjustmentBehavior?: ?(
| 'automatic'
| 'scrollableAxes'
| 'never'
| 'always'
'automatic' | 'scrollableAxes' | 'never' | 'always'
),
}>;
@@ -569,9 +565,11 @@ type ScrollViewBaseProps = Readonly<{
*
* @default `'none'`
*/
keyboardDismissMode?: ?// default
// cross-platform
('none' | 'on-drag' | 'interactive'), // ios only
keyboardDismissMode?: ?(
// default
// cross-platform
'none' | 'on-drag' | 'interactive'
), // ios only
/**
* Determines when the keyboard should stay visible after a tap.
*
@@ -32,10 +32,7 @@ export type ScrollViewNativeProps = Readonly<{
centerContent?: ?boolean,
contentInset?: ?EdgeInsetsProp,
contentInsetAdjustmentBehavior?: ?(
| 'automatic'
| 'scrollableAxes'
| 'never'
| 'always'
'automatic' | 'scrollableAxes' | 'never' | 'always'
),
contentOffset?: ?PointProp,
decelerationRate?: ?('fast' | 'normal' | number),
@@ -171,36 +171,20 @@ export type KeyboardTypeIOS =
export type KeyboardTypeAndroid = 'visible-password';
export type KeyboardTypeOptions =
| KeyboardType
| KeyboardTypeIOS
| KeyboardTypeAndroid;
KeyboardType | KeyboardTypeIOS | KeyboardTypeAndroid;
export type InputModeOptions =
| 'none'
| 'text'
| 'decimal'
| 'numeric'
| 'tel'
| 'search'
| 'email'
| 'url';
'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';
export type ReturnKeyType = 'done' | 'go' | 'next' | 'search' | 'send';
export type ReturnKeyTypeIOS =
| 'default'
| 'emergency-call'
| 'google'
| 'join'
| 'route'
| 'yahoo';
'default' | 'emergency-call' | 'google' | 'join' | 'route' | 'yahoo';
export type ReturnKeyTypeAndroid = 'none' | 'previous';
export type ReturnKeyTypeOptions =
| ReturnKeyType
| ReturnKeyTypeIOS
| ReturnKeyTypeAndroid;
ReturnKeyType | ReturnKeyTypeIOS | ReturnKeyTypeAndroid;
export type SubmitBehavior = 'submit' | 'blurAndSubmit' | 'newline';
@@ -261,9 +245,7 @@ export type EnterKeyHintTypeIOS = 'enter';
export type EnterKeyHintType = 'done' | 'go' | 'next' | 'search' | 'send';
export type EnterKeyHintTypeOptions =
| EnterKeyHintType
| EnterKeyHintTypeAndroid
| EnterKeyHintTypeIOS;
EnterKeyHintType | EnterKeyHintTypeAndroid | EnterKeyHintTypeIOS;
type PasswordRules = string;
@@ -306,8 +288,7 @@ export type TextInputIOSProps = Readonly<{
* @platform ios
*/
dataDetectorTypes?:
| ?DataDetectorTypesType
| ReadonlyArray<DataDetectorTypesType>,
?DataDetectorTypesType | ReadonlyArray<DataDetectorTypesType>,
/**
* If `true`, the keyboard disables the return key when there is no text and
@@ -385,12 +366,7 @@ export type TextInputIOSProps = Readonly<{
* @platform ios
*/
lineBreakModeIOS?: ?(
| 'wordWrapping'
| 'char'
| 'clip'
| 'head'
| 'middle'
| 'tail'
'wordWrapping' | 'char' | 'clip' | 'head' | 'middle' | 'tail'
),
/**
@@ -447,11 +423,7 @@ export type TextInputAndroidProps = Readonly<{
* - `yesExcludeDescendants` - this view is important for autofill but its children aren't
*/
importantForAutofill?: ?(
| 'auto'
| 'no'
| 'noExcludeDescendants'
| 'yes'
| 'yesExcludeDescendants'
'auto' | 'no' | 'noExcludeDescendants' | 'yes' | 'yesExcludeDescendants'
),
/**
@@ -641,53 +641,54 @@ function InternalTextInput(props: TextInputProps): React.Node {
? selectionColor
: selectionHandleColor,
};
textInput = (
/* $FlowFixMe[prop-missing] the types for AndroidTextInput don't match up
* exactly with the props for TextInput. This will need to get fixed */
/* $FlowFixMe[incompatible-type] the types for AndroidTextInput don't
* match up exactly with the props for TextInput. This will need to get
* fixed */
/* $FlowFixMe[incompatible-type-arg] the types for AndroidTextInput don't
* match up exactly with the props for TextInput. This will need to get
* fixed */
<AndroidTextInput
// Figure out imperative + forward refs.
ref={ref as $FlowFixMe}
{...otherProps}
{...colorProps}
{...eventHandlers}
accessibilityLabel={_accessibilityLabel}
accessibilityLabelledBy={_accessibilityLabelledBy}
accessibilityState={_accessibilityState}
accessible={accessible}
acceptDragAndDropTypes={props.experimental_acceptDragAndDropTypes}
autoCapitalize={autoCapitalize}
submitBehavior={submitBehavior}
caretHidden={caretHidden}
children={children}
disableFullscreenUI={props.disableFullscreenUI}
focusable={tabIndex !== undefined ? !tabIndex : focusable}
importantForAccessibility={_importantForAccessibility}
mostRecentEventCount={mostRecentEventCount}
nativeID={id ?? props.nativeID}
numberOfLines={props.rows ?? props.numberOfLines}
onBlur={_onBlur}
onChange={_onChange}
onFocus={_onFocus}
/* $FlowFixMe[prop-missing] the types for AndroidTextInput don't match
* up exactly with the props for TextInput. This will need to get fixed
*/
/* $FlowFixMe[incompatible-type] the types for AndroidTextInput
* don't match up exactly with the props for TextInput. This will need
* to get fixed */
onScroll={_onScroll}
onSelectionChange={_onSelectionChange}
placeholder={placeholder}
style={_style}
text={text}
textBreakStrategy={props.textBreakStrategy}
/>
);
textInput =
(
/* $FlowFixMe[prop-missing] the types for AndroidTextInput don't match up
* exactly with the props for TextInput. This will need to get fixed */
/* $FlowFixMe[incompatible-type] the types for AndroidTextInput don't
* match up exactly with the props for TextInput. This will need to get
* fixed */
/* $FlowFixMe[incompatible-type-arg] the types for AndroidTextInput don't
* match up exactly with the props for TextInput. This will need to get
* fixed */
<AndroidTextInput
// Figure out imperative + forward refs.
ref={ref as $FlowFixMe}
{...otherProps}
{...colorProps}
{...eventHandlers}
accessibilityLabel={_accessibilityLabel}
accessibilityLabelledBy={_accessibilityLabelledBy}
accessibilityState={_accessibilityState}
accessible={accessible}
acceptDragAndDropTypes={props.experimental_acceptDragAndDropTypes}
autoCapitalize={autoCapitalize}
submitBehavior={submitBehavior}
caretHidden={caretHidden}
children={children}
disableFullscreenUI={props.disableFullscreenUI}
focusable={tabIndex !== undefined ? !tabIndex : focusable}
importantForAccessibility={_importantForAccessibility}
mostRecentEventCount={mostRecentEventCount}
nativeID={id ?? props.nativeID}
numberOfLines={props.rows ?? props.numberOfLines}
onBlur={_onBlur}
onChange={_onChange}
onFocus={_onFocus}
/* $FlowFixMe[prop-missing] the types for AndroidTextInput don't match
* up exactly with the props for TextInput. This will need to get fixed
*/
/* $FlowFixMe[incompatible-type] the types for AndroidTextInput
* don't match up exactly with the props for TextInput. This will need
* to get fixed */
onScroll={_onScroll}
onSelectionChange={_onSelectionChange}
placeholder={placeholder}
style={_style}
text={text}
textBreakStrategy={props.textBreakStrategy}
/>
);
}
return <TextAncestorContext value={true}>{textInput}</TextAncestorContext>;
}
@@ -694,7 +694,7 @@ const TouchableMixinImpl = {
curState +
'` for Touchable responder `' +
typeof this.state.touchable.responderID ===
'number'
'number'
? this.state.touchable.responderID
: 'host component' + '`',
);
@@ -707,7 +707,7 @@ const TouchableMixinImpl = {
signal +
'` for responder `' +
typeof this.state.touchable.responderID ===
'number'
'number'
? this.state.touchable.responderID
: '<<host component>>' + '`',
);
@@ -84,8 +84,7 @@ export type TouchableNativeFeedbackProps = Readonly<{
| Readonly<{
type: 'ThemeAttrAndroid',
attribute:
| 'selectableItemBackground'
| 'selectableItemBackgroundBorderless',
'selectableItemBackground' | 'selectableItemBackgroundBorderless',
rippleRadius: ?number,
}>
| Readonly<{
@@ -74,10 +74,7 @@ export type TouchableWithoutFeedbackProps = Readonly<
*/
id?: string,
importantForAccessibility?: ?(
| 'auto'
| 'yes'
| 'no'
| 'no-hide-descendants'
'auto' | 'yes' | 'no' | 'no-hide-descendants'
),
nativeID?: ?string,
onAccessibilityAction?: ?(event: AccessibilityActionEvent) => unknown,
@@ -62,8 +62,7 @@ export default class NativeEventEmitter<
TEventToArgsMap extends Readonly<
Record<string, ReadonlyArray<UnsafeNativeEventObject>>,
> = Readonly<Record<string, ReadonlyArray<UnsafeNativeEventObject>>>,
> implements IEventEmitter<TEventToArgsMap>
{
> implements IEventEmitter<TEventToArgsMap> {
_nativeModule: ?NativeModule;
/**
@@ -20,8 +20,7 @@ import RCTDeviceEventEmitter from '../RCTDeviceEventEmitter';
*/
export default class NativeEventEmitter<
TEventToArgsMap extends Readonly<Record<string, ReadonlyArray<unknown>>>,
> implements IEventEmitter<TEventToArgsMap>
{
> implements IEventEmitter<TEventToArgsMap> {
addListener<TEvent extends keyof TEventToArgsMap>(
eventType: TEvent,
listener: (...args: TEventToArgsMap[TEvent]) => unknown,
+1 -3
View File
@@ -85,9 +85,7 @@ export interface ImageURISource {
export type ImageRequireSource = number;
export type ImageSource =
| ImageRequireSource
| ImageURISource
| ReadonlyArray<ImageURISource>;
ImageRequireSource | ImageURISource | ReadonlyArray<ImageURISource>;
type ImageSourceProperties = {
body?: ?string,
+1 -4
View File
@@ -117,10 +117,7 @@ export type ModalPropsIOS = {
* @platform ios
*/
presentationStyle?: ?(
| 'fullScreen'
| 'pageSheet'
| 'formSheet'
| 'overFullScreen'
'fullScreen' | 'pageSheet' | 'formSheet' | 'overFullScreen'
),
/**
+6 -13
View File
@@ -34,12 +34,7 @@ const DEBUG_NETWORK_SEND_DELAY: false = false; // Set to a number of millisecond
export type NativeResponseType = 'base64' | 'blob' | 'text';
export type ResponseType =
| ''
| 'arraybuffer'
| 'blob'
| 'document'
| 'json'
| 'text';
'' | 'arraybuffer' | 'blob' | 'document' | 'json' | 'text';
export type Response = ?Object | string;
type XHRInterceptor = interface {
@@ -658,13 +653,11 @@ class XMLHttpRequest extends EventTarget {
}
// only call onreadystatechange if there is something to abort,
// below logic is per spec
if (
!(
this.readyState === this.UNSENT ||
(this.readyState === this.OPENED && !this._sent) ||
this.readyState === this.DONE
)
) {
if (!(
this.readyState === this.UNSENT ||
(this.readyState === this.OPENED && !this._sent) ||
this.readyState === this.DONE
)) {
this._reset();
this.setReadyState(this.DONE);
}
+3 -3
View File
@@ -19,9 +19,9 @@ let isEnabled = false;
if (Platform.OS === 'web') {
const canUseDOM = Boolean(
typeof window !== 'undefined' &&
window.document &&
// $FlowFixMe[method-unbinding]
window.document.createElement,
window.document &&
// $FlowFixMe[method-unbinding]
window.document.createElement,
);
if (canUseDOM) {
@@ -540,12 +540,7 @@ type ____LayoutStyle_Internal = Readonly<{
* for more details.
*/
alignSelf?:
| 'auto'
| 'flex-start'
| 'flex-end'
| 'center'
| 'stretch'
| 'baseline',
'auto' | 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline',
/** `alignContent` controls how rows align in the cross direction,
* overriding the `alignContent` of the parent.
@@ -736,10 +731,7 @@ type LinearGradientValue = {
};
type RadialExtent =
| 'closest-corner'
| 'closest-side'
| 'farthest-corner'
| 'farthest-side';
'closest-corner' | 'closest-side' | 'farthest-corner' | 'farthest-side';
export type RadialGradientPosition =
| {
top: number | string,
@@ -785,10 +777,7 @@ export type BackgroundSizeValue = {
};
export type BackgroundRepeatKeyword =
| 'repeat'
| 'space'
| 'round'
| 'no-repeat';
'repeat' | 'space' | 'round' | 'no-repeat';
export type BackgroundPositionValue =
| {
@@ -906,8 +895,7 @@ export type ____ViewStyle_InternalBase = Readonly<{
experimental_backgroundImage?: ReadonlyArray<BackgroundImageValue> | string,
experimental_backgroundSize?: ReadonlyArray<BackgroundSizeValue> | string,
experimental_backgroundPosition?:
| ReadonlyArray<BackgroundPositionValue>
| string,
ReadonlyArray<BackgroundPositionValue> | string,
experimental_backgroundRepeat?: ReadonlyArray<BackgroundRepeatValue> | string,
isolation?: 'auto' | 'isolate',
}>;
@@ -1032,20 +1020,11 @@ type ____TextStyle_InternalBase = Readonly<{
letterSpacing?: number,
lineHeight?: number,
textAlign?:
| 'auto'
| 'left'
| 'right'
| 'center'
| 'justify'
| 'start'
| 'end',
'auto' | 'left' | 'right' | 'center' | 'justify' | 'start' | 'end',
textAlignVertical?: 'auto' | 'top' | 'bottom' | 'center',
includeFontPadding?: boolean,
textDecorationLine?:
| 'none'
| 'underline'
| 'line-through'
| 'underline line-through',
'none' | 'underline' | 'line-through' | 'underline line-through',
textDecorationStyle?: 'solid' | 'double' | 'dotted' | 'dashed' | 'wavy',
textDecorationColor?: ____ColorValue_Internal,
textTransform?: 'none' | 'capitalize' | 'uppercase' | 'lowercase',
@@ -1093,12 +1072,7 @@ export type ____DangerouslyImpreciseStyle_Internal = Readonly<{
}>;
export type StyleProp<out T> =
| null
| void
| T
| false
| ''
| ReadonlyArray<StyleProp<T>>;
null | void | T | false | '' | ReadonlyArray<StyleProp<T>>;
export type ____DangerouslyImpreciseStyleProp_Internal = StyleProp<
Partial<____DangerouslyImpreciseStyle_Internal>,
@@ -74,8 +74,7 @@ export type ____TransformStyle_Internal = Readonly<{
// TODO: what is the actual type it expects?
| {
readonly matrix:
| ReadonlyArray<number | AnimatedNode>
| AnimatedNode,
ReadonlyArray<number | AnimatedNode> | AnimatedNode,
},
>,
>,
@@ -94,6 +93,5 @@ export type ____TransformStyle_Internal = Readonly<{
* E.g. transformOrigin: '30% 80% 15px'
*/
transformOrigin?:
| [string | number, string | number, string | number]
| string,
[string | number, string | number, string | number] | string,
}>;
@@ -39,8 +39,7 @@ const LINEAR_GRADIENT_DEFAULT_DIRECTION: LinearGradientDirection = {
};
type LinearGradientDirection =
| {type: 'angle', value: number}
| {type: 'keyword', value: string};
{type: 'angle', value: number} | {type: 'keyword', value: string};
type LinearGradientBackgroundImage = {
type: 'linear-gradient',
@@ -77,8 +76,7 @@ type ColorStopColor = ProcessedColorValue | null;
type ColorStopPosition = number | string | null;
type ParsedBackgroundImageValue =
| LinearGradientBackgroundImage
| RadialGradientBackgroundImage;
LinearGradientBackgroundImage | RadialGradientBackgroundImage;
export default function processBackgroundImage(
backgroundImage: ?(ReadonlyArray<BackgroundImageValue> | string),
+2 -11
View File
@@ -9,12 +9,7 @@
*/
export type PlatformOSType =
| 'ios'
| 'android'
| 'macos'
| 'windows'
| 'web'
| 'native';
'ios' | 'android' | 'macos' | 'windows' | 'web' | 'native';
type OptionalPlatformSelectSpec<T> = {
[key in PlatformOSType]?: T, // eslint-disable-line no-unused-vars
@@ -259,8 +254,4 @@ type WebPlatform = {
};
export type PlatformType =
| IOSPlatform
| AndroidPlatform
| WindowsPlatform
| MacOSPlatform
| WebPlatform;
IOSPlatform | AndroidPlatform | WindowsPlatform | MacOSPlatform | WebPlatform;
@@ -22,8 +22,7 @@ import {useEffect, useState} from 'react';
* @see https://reactnative.dev/docs/usewindowdimensions
*/
export default function useWindowDimensions():
| DisplayMetrics
| DisplayMetricsAndroid {
DisplayMetrics | DisplayMetricsAndroid {
const [dimensions, setDimensions] = useState(() => Dimensions.get('window'));
useEffect(() => {
function handleChange({
+2 -10
View File
@@ -81,7 +81,6 @@ declare var console: {
// Stack tagging
createTask(label: string): ConsoleTask,
...
};
@@ -515,9 +514,7 @@ declare class XMLHttpRequestEventTarget extends EventTarget {
// 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, ...};
Headers | Array<[string, string]> | {[key: string]: string, ...};
// TODO Heades and URLSearchParams are almost the same thing.
// Could it somehow be abstracted away?
@@ -599,12 +596,7 @@ type ReferrerPolicyType =
| 'unsafe-url';
type ResponseType =
| 'basic'
| 'cors'
| 'default'
| 'error'
| 'opaque'
| 'opaqueredirect';
'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect';
type BodyInit =
| string
+2 -10
View File
@@ -409,10 +409,7 @@ type AnimationPlayState = 'idle' | 'running' | 'paused' | 'finished';
type AnimationReplaceState = 'active' | 'removed' | 'persisted';
type FillMode = 'none' | 'forwards' | 'backwards' | 'both' | 'auto';
type PlaybackDirection =
| 'normal'
| 'reverse'
| 'alternate'
| 'alternate-reverse';
'normal' | 'reverse' | 'alternate' | 'alternate-reverse';
type IterationCompositeOperation = 'replace' | 'accumulate';
type CompositeOperation = 'replace' | 'add' | 'accumulate';
type CompositeOperationOrAuto = CompositeOperation | 'auto';
@@ -481,12 +478,7 @@ type PropertyIndexedKeyframes = {
easing?: string | string[],
offset?: number | (number | null)[],
[property: string]:
| string
| string[]
| number
| null
| (number | null)[]
| void,
string | string[] | number | null | (number | null)[] | void,
...
};
+21 -50
View File
@@ -172,68 +172,52 @@ type EventHandler = (event: Event) => unknown;
type EventListener = {handleEvent: EventHandler, ...} | EventHandler;
type MouseEventHandler = (event: MouseEvent) => unknown;
type MouseEventListener =
| {handleEvent: MouseEventHandler, ...}
| MouseEventHandler;
{handleEvent: MouseEventHandler, ...} | MouseEventHandler;
type FocusEventHandler = (event: FocusEvent) => unknown;
type FocusEventListener =
| {handleEvent: FocusEventHandler, ...}
| FocusEventHandler;
{handleEvent: FocusEventHandler, ...} | FocusEventHandler;
type KeyboardEventHandler = (event: KeyboardEvent) => unknown;
type KeyboardEventListener =
| {handleEvent: KeyboardEventHandler, ...}
| KeyboardEventHandler;
{handleEvent: KeyboardEventHandler, ...} | KeyboardEventHandler;
type InputEventHandler = (event: InputEvent) => unknown;
type InputEventListener =
| {handleEvent: InputEventHandler, ...}
| InputEventHandler;
{handleEvent: InputEventHandler, ...} | InputEventHandler;
type TouchEventHandler = (event: TouchEvent) => unknown;
type TouchEventListener =
| {handleEvent: TouchEventHandler, ...}
| TouchEventHandler;
{handleEvent: TouchEventHandler, ...} | TouchEventHandler;
type WheelEventHandler = (event: WheelEvent) => unknown;
type WheelEventListener =
| {handleEvent: WheelEventHandler, ...}
| WheelEventHandler;
{handleEvent: WheelEventHandler, ...} | WheelEventHandler;
type AbortProgressEventHandler = (event: ProgressEvent) => unknown;
type AbortProgressEventListener =
| {handleEvent: AbortProgressEventHandler, ...}
| AbortProgressEventHandler;
{handleEvent: AbortProgressEventHandler, ...} | AbortProgressEventHandler;
type ProgressEventHandler = (event: ProgressEvent) => unknown;
type ProgressEventListener =
| {handleEvent: ProgressEventHandler, ...}
| ProgressEventHandler;
{handleEvent: ProgressEventHandler, ...} | ProgressEventHandler;
type DragEventHandler = (event: DragEvent) => unknown;
type DragEventListener =
| {handleEvent: DragEventHandler, ...}
| DragEventHandler;
{handleEvent: DragEventHandler, ...} | DragEventHandler;
type PointerEventHandler = (event: PointerEvent) => unknown;
type PointerEventListener =
| {handleEvent: PointerEventHandler, ...}
| PointerEventHandler;
{handleEvent: PointerEventHandler, ...} | PointerEventHandler;
type AnimationEventHandler = (event: AnimationEvent) => unknown;
type AnimationEventListener =
| {handleEvent: AnimationEventHandler, ...}
| AnimationEventHandler;
{handleEvent: AnimationEventHandler, ...} | AnimationEventHandler;
type ClipboardEventHandler = (event: ClipboardEvent) => unknown;
type ClipboardEventListener =
| {handleEvent: ClipboardEventHandler, ...}
| ClipboardEventHandler;
{handleEvent: ClipboardEventHandler, ...} | ClipboardEventHandler;
type TransitionEventHandler = (event: TransitionEvent) => unknown;
type TransitionEventListener =
| {handleEvent: TransitionEventHandler, ...}
| TransitionEventHandler;
{handleEvent: TransitionEventHandler, ...} | TransitionEventHandler;
type MessageEventHandler = (event: MessageEvent) => unknown;
type MessageEventListener =
| {handleEvent: MessageEventHandler, ...}
| MessageEventHandler;
{handleEvent: MessageEventHandler, ...} | MessageEventHandler;
type BeforeUnloadEventHandler = (event: BeforeUnloadEvent) => unknown;
type BeforeUnloadEventListener =
| {handleEvent: BeforeUnloadEventHandler, ...}
| BeforeUnloadEventHandler;
{handleEvent: BeforeUnloadEventHandler, ...} | BeforeUnloadEventHandler;
type StorageEventHandler = (event: StorageEvent) => unknown;
type StorageEventListener =
| {handleEvent: StorageEventHandler, ...}
| StorageEventHandler;
{handleEvent: StorageEventHandler, ...} | StorageEventHandler;
type SecurityPolicyViolationEventHandler = (
event: SecurityPolicyViolationEvent,
) => unknown;
@@ -242,8 +226,7 @@ type SecurityPolicyViolationEventListener =
| SecurityPolicyViolationEventHandler;
type USBConnectionEventHandler = (event: USBConnectionEvent) => unknown;
type USBConnectionEventListener =
| {handleEvent: USBConnectionEventHandler, ...}
| USBConnectionEventHandler;
{handleEvent: USBConnectionEventHandler, ...} | USBConnectionEventHandler;
type MediaKeySessionType = 'temporary' | 'persistent-license';
type MediaKeyStatus =
@@ -272,13 +255,7 @@ type TouchEventTypes = 'touchstart' | 'touchmove' | 'touchend' | 'touchcancel';
type WheelEventTypes = 'wheel';
type AbortProgressEventTypes = 'abort';
type ProgressEventTypes =
| 'abort'
| 'error'
| 'load'
| 'loadend'
| 'loadstart'
| 'progress'
| 'timeout';
'abort' | 'error' | 'load' | 'loadend' | 'loadstart' | 'progress' | 'timeout';
type DragEventTypes =
| 'drag'
| 'dragend'
@@ -300,15 +277,10 @@ type PointerEventTypes =
| 'gotpointercapture'
| 'lostpointercapture';
type AnimationEventTypes =
| 'animationstart'
| 'animationend'
| 'animationiteration';
'animationstart' | 'animationend' | 'animationiteration';
type ClipboardEventTypes = 'clipboardchange' | 'cut' | 'copy' | 'paste';
type TransitionEventTypes =
| 'transitionrun'
| 'transitionstart'
| 'transitionend'
| 'transitioncancel';
'transitionrun' | 'transitionstart' | 'transitionend' | 'transitioncancel';
type MessageEventTypes = string;
type BeforeUnloadEventTypes = 'beforeunload';
type StorageEventTypes = 'storage';
@@ -6051,8 +6023,7 @@ type NodeFilterCallback = (
| typeof NodeFilter.FILTER_SKIP;
type NodeFilterInterface =
| NodeFilterCallback
| {acceptNode: NodeFilterCallback, ...};
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.
+1 -1
View File
@@ -16,7 +16,7 @@ const {composeSourceMaps} = require('metro-source-map');
const argv = process.argv.slice(2);
let outputPath;
for (let i = 0; i < argv.length; ) {
for (let i = 0; i < argv.length;) {
if (argv[i] === '-o') {
outputPath = argv[i + 1];
argv.splice(i, 2);
+1 -4
View File
@@ -23,10 +23,7 @@ export type FeatureFlagDefinitions = Readonly<{
* - stable: the value of the feature flag will be `expectedReleaseValue` on all releases.
*/
export type OSSReleaseStageValue =
| 'none'
| 'experimental'
| 'canary'
| 'stable';
'none' | 'experimental' | 'canary' | 'stable';
export type CommonFeatureFlagConfig<
TValue extends FeatureFlagValue = FeatureFlagValue,
@@ -25,7 +25,7 @@ export interface Spec extends TurboModule {
};
readonly findPseudoElementShadowNodeByTag: (
reactTag: number,
) => ?unknown /* Node */;
) => ?unknown; /* Node */
readonly waitForTransitionAnimation: (animationId: number) => void;
readonly transitionAnimationFinished: (animationId: number) => void;
}
@@ -19,9 +19,7 @@ export opaque type NativeElementReference = ShadowNode;
export opaque type NativeTextReference = ShadowNode;
export type NativeNodeReference =
| NativeElementReference
| NativeTextReference
| RootTag;
NativeElementReference | NativeTextReference | RootTag;
export type MeasureInWindowOnSuccessCallback = (
x: number,
@@ -58,16 +56,16 @@ export interface Spec extends TurboModule {
readonly getChildNodes: (
nativeNodeReference: unknown /* NativeNodeReference */,
) => ReadonlyArray<unknown> /* $ReadOnlyArray<InstanceHandle> */;
) => ReadonlyArray<unknown>; /* $ReadOnlyArray<InstanceHandle> */
readonly getElementById?: (
nativeNodeReference: unknown /* NativeNodeReference */,
id: string,
) => unknown /* ?InstanceHandle */;
) => unknown; /* ?InstanceHandle */
readonly getParentNode: (
nativeNodeReference: unknown /* NativeNodeReference */,
) => unknown /* ?InstanceHandle */;
) => unknown; /* ?InstanceHandle */
readonly isConnected: (
nativeNodeReference: unknown /* NativeNodeReference */,
@@ -79,24 +77,24 @@ export interface Spec extends TurboModule {
readonly getBorderWidth: (
nativeElementReference: unknown /* NativeElementReference */,
) => ReadonlyArray<number> /* [topWidth: number, rightWidth: number, bottomWidth: number, leftWidth: number] */;
) => ReadonlyArray<number>; /* [topWidth: number, rightWidth: number, bottomWidth: number, leftWidth: number] */
readonly getBoundingClientRect: (
nativeElementReference: unknown /* NativeElementReference */,
includeTransform: boolean,
) => ReadonlyArray<number> /* [x: number, y: number, width: number, height: number] */;
) => ReadonlyArray<number>; /* [x: number, y: number, width: number, height: number] */
readonly getInnerSize: (
nativeElementReference: unknown /* NativeElementReference */,
) => ReadonlyArray<number> /* [width: number, height: number] */;
) => ReadonlyArray<number>; /* [width: number, height: number] */
readonly getScrollPosition: (
nativeElementReference: unknown /* NativeElementReference */,
) => ReadonlyArray<number> /* [scrollLeft: number, scrollTop: number] */;
) => ReadonlyArray<number>; /* [scrollLeft: number, scrollTop: number] */
readonly getScrollSize: (
nativeElementReference: unknown /* NativeElementReference */,
) => ReadonlyArray<number> /* [scrollWidth: number, scrollHeight: number] */;
) => ReadonlyArray<number>; /* [scrollWidth: number, scrollHeight: number] */
readonly getTagName: (
nativeElementReference: unknown /* NativeElementReference */,
@@ -127,7 +125,7 @@ export interface Spec extends TurboModule {
readonly getOffset: (
nativeElementReference: unknown /* NativeElementReference */,
) => ReadonlyArray<unknown> /* [offsetParent: ?InstanceHandle, top: number, left: number] */;
) => ReadonlyArray<unknown>; /* [offsetParent: ?InstanceHandle, top: number, left: number] */
/*
* Special methods to handle the root node.
@@ -136,7 +134,7 @@ export interface Spec extends TurboModule {
readonly linkRootNode?: (
rootTag: number /* RootTag */,
instanceHandle: unknown /* InstanceHandle */,
) => unknown /* ?NativeElementReference */;
) => unknown; /* ?NativeElementReference */
/**
* Legacy layout APIs (for `ReactNativeElement`).
@@ -38,14 +38,12 @@ export function expectRectEquals(
expected: {x: number, y: number, width: number, height: number},
): boolean {
const {x, y, width, height} = expected;
if (
!(
rect.x === x &&
rect.y === y &&
rect.width === width &&
rect.height === height
)
) {
if (!(
rect.x === x &&
rect.y === y &&
rect.width === width &&
rect.height === height
)) {
const received = {
x: rect.x,
y: rect.y,
@@ -14,11 +14,7 @@ import {setPlatformObject} from '../webidl/PlatformObjects';
export type DOMHighResTimeStamp = number;
export type PerformanceEntryType =
| 'mark'
| 'measure'
| 'event'
| 'longtask'
| 'resource';
'mark' | 'measure' | 'event' | 'longtask' | 'resource';
export type PerformanceEntryJSON = {
name: string,
@@ -25,8 +25,7 @@ export type FailingPlatformTestAssertionResult = Readonly<{
}>;
export type PlatformTestAssertionResult =
| PassingPlatformTestAssertionResult
| FailingPlatformTestAssertionResult;
PassingPlatformTestAssertionResult | FailingPlatformTestAssertionResult;
export type PlatformTestResultStatus = 'PASS' | 'FAIL' | 'ERROR' | 'SKIPPED';
@@ -49,8 +49,7 @@ const TextInputForm = () => {
const CloseButton = (
props:
| {behavior: any, setModalOpen: any}
| {behavior: string, setModalOpen: any},
{behavior: any, setModalOpen: any} | {behavior: string, setModalOpen: any},
) => {
return (
<View
@@ -219,17 +219,15 @@ export function computeWindowedRenderLimits(
last++;
}
}
if (
!(
last >= first &&
first >= 0 &&
last < itemCount &&
first >= overscanFirst &&
last <= overscanLast &&
first <= visible.first &&
last >= visible.last
)
) {
if (!(
last >= first &&
first >= 0 &&
last < itemCount &&
first >= overscanFirst &&
last <= overscanLast &&
first <= visible.first &&
last >= visible.last
)) {
throw new Error(
'Bad window calculation ' +
JSON.stringify({
@@ -1973,9 +1973,9 @@ class VirtualizedList extends StateSafePureComponent<
// Keep a viewport's worth of content around the last focused cell to allow
// random navigation around it without any blanking. E.g. tabbing from one
// focused item out of viewport to another.
if (
!(this._lastFocusedCellKey && this._cellRefs[this._lastFocusedCellKey])
) {
if (!(
this._lastFocusedCellKey && this._cellRefs[this._lastFocusedCellKey]
)) {
return [];
}
@@ -131,10 +131,8 @@ type State = {childProps: VirtualizedListProps, ...};
*/
class VirtualizedSectionList<
ItemT,
SectionT extends SectionBase<
ItemT,
SectionT extends SectionBase<ItemT, DefaultVirtualizedSectionT> =
DefaultVirtualizedSectionT,
> = DefaultVirtualizedSectionT,
> extends React.PureComponent<
VirtualizedSectionListProps<ItemT, SectionT>,
State,
@@ -643,10 +641,8 @@ function ItemWithSeparator<ItemT>(
const VirtualizedSectionListComponent = VirtualizedSectionList as component<
ItemT,
SectionT extends SectionBase<
ItemT,
SectionT extends SectionBase<ItemT, DefaultVirtualizedSectionT> =
DefaultVirtualizedSectionT,
> = DefaultVirtualizedSectionT,
>(
ref?: React.RefSetter<
interface {
+1 -2
View File
@@ -61,8 +61,7 @@ type SuiteResults = Array<Readonly<TaskResult>>;
type TestWithArgName<TestArgType> = string | ((testArg: TestArgType) => string);
type TestWithArgOptions<TestArgType> =
| FnOptions
| ((testArg: TestArgType) => FnOptions);
FnOptions | ((testArg: TestArgType) => FnOptions);
interface ParameterizedTestFunction {
<TestArgType>(