mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Transform mixed to unknown in xplat/js (#54954)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54954 We are transforming the following utility types to be more consistent with typescript and better AI integration: * `$NonMaybeType` -> `NonNullable` * `$ReadOnly` -> `Readonly` * `$ReadOnlyArray` -> `ReadonlyArray` * `$ReadOnlyMap` -> `ReadonlyMap` * `$ReadOnlySet` -> `ReadonlySet` * `$Keys` -> `keyof` * `$Values` -> `Values` * `mixed` -> `unknown` See details in https://fb.workplace.com/groups/flowlang/permalink/1837907750148213/. drop-conflicts Reviewed By: SamChou19815 Differential Revision: D89581744 fbshipit-source-id: 58a6c246629bbe4fb5c0af447dc002c48e10c342
This commit is contained in:
1 parent
2624e2f52e
commit
894a1f16ef
131 files changed
+409
-409
No files matched your search
+1
-1
@@ -23,7 +23,7 @@ function indent(nice: string, spaces: number): string {
|
||||
if (line.length === 0 || index === 0) {
|
||||
return line;
|
||||
}
|
||||
const emptySpaces = new Array<mixed>(spaces + 1).join(' ');
|
||||
const emptySpaces = new Array<unknown>(spaces + 1).join(' ');
|
||||
return emptySpaces + line;
|
||||
})
|
||||
.join('\n');
|
||||
|
||||
@@ -131,7 +131,7 @@ function buildCommandSchema(
|
||||
};
|
||||
break;
|
||||
default:
|
||||
(type: mixed);
|
||||
(type: unknown);
|
||||
throw new Error(
|
||||
`Unsupported param type for method "${name}", param "${paramName}". Found ${type}`,
|
||||
);
|
||||
@@ -160,7 +160,7 @@ function buildCommandSchema(
|
||||
type Allowed = ComponentCommandArrayTypeAnnotation['elementType'];
|
||||
|
||||
function getCommandArrayElementTypeType(
|
||||
inputType: mixed,
|
||||
inputType: unknown,
|
||||
parser: Parser,
|
||||
): Allowed {
|
||||
// TODO: T172453752 support more complex type annotation for array element
|
||||
|
||||
+2
-2
@@ -102,7 +102,7 @@ function buildCommandSchemaInternal(
|
||||
};
|
||||
break;
|
||||
default:
|
||||
(type: mixed);
|
||||
(type: unknown);
|
||||
throw new Error(
|
||||
`Unsupported param type for method "${name}", param "${paramName}". Found ${type}`,
|
||||
);
|
||||
@@ -129,7 +129,7 @@ function buildCommandSchemaInternal(
|
||||
}
|
||||
|
||||
function getCommandArrayElementTypeType(
|
||||
inputType: mixed,
|
||||
inputType: unknown,
|
||||
parser: Parser,
|
||||
): ComponentCommandArrayTypeAnnotation['elementType'] {
|
||||
// TODO: T172453752 support more complex type annotation for array element
|
||||
|
||||
+1
-1
@@ -335,7 +335,7 @@ function getTypeAnnotationForArray<T>(
|
||||
type: 'FloatTypeAnnotation',
|
||||
};
|
||||
default:
|
||||
(type: mixed);
|
||||
(type: unknown);
|
||||
throw new Error(`Unknown prop type for "${name}": ${type}`);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ export type Props = $ReadOnly<{
|
||||
int: Int32,
|
||||
stringUnion: WithDefault<'foo' | 'bar', 'bar'>,
|
||||
intUnion: WithDefault<1 | 2, 1>,
|
||||
mixed: mixed,
|
||||
mixed: unknown,
|
||||
|
||||
backgroundColor?: WithDefault<string, 'transparent'>,
|
||||
height?: WithDefault<Int32, 100>,
|
||||
|
||||
@@ -88,47 +88,47 @@ export type PressabilityConfig = $ReadOnly<{
|
||||
/**
|
||||
* Called after the element loses focus.
|
||||
*/
|
||||
onBlur?: ?(event: BlurEvent) => mixed,
|
||||
onBlur?: ?(event: BlurEvent) => unknown,
|
||||
|
||||
/**
|
||||
* Called after the element is focused.
|
||||
*/
|
||||
onFocus?: ?(event: FocusEvent) => mixed,
|
||||
onFocus?: ?(event: FocusEvent) => unknown,
|
||||
|
||||
/**
|
||||
* Called when the hover is activated to provide visual feedback.
|
||||
*/
|
||||
onHoverIn?: ?(event: MouseEvent) => mixed,
|
||||
onHoverIn?: ?(event: MouseEvent) => unknown,
|
||||
|
||||
/**
|
||||
* Called when the hover is deactivated to undo visual feedback.
|
||||
*/
|
||||
onHoverOut?: ?(event: MouseEvent) => mixed,
|
||||
onHoverOut?: ?(event: MouseEvent) => unknown,
|
||||
|
||||
/**
|
||||
* Called when a long press gesture has been triggered.
|
||||
*/
|
||||
onLongPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
onLongPress?: ?(event: GestureResponderEvent) => unknown,
|
||||
|
||||
/**
|
||||
* Called when a press gesture has been triggered.
|
||||
*/
|
||||
onPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPress?: ?(event: GestureResponderEvent) => unknown,
|
||||
|
||||
/**
|
||||
* Called when the press is activated to provide visual feedback.
|
||||
*/
|
||||
onPressIn?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressIn?: ?(event: GestureResponderEvent) => unknown,
|
||||
|
||||
/**
|
||||
* Called when the press location moves. (This should rarely be used.)
|
||||
*/
|
||||
onPressMove?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressMove?: ?(event: GestureResponderEvent) => unknown,
|
||||
|
||||
/**
|
||||
* Called when the press is deactivated to undo visual feedback.
|
||||
*/
|
||||
onPressOut?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressOut?: ?(event: GestureResponderEvent) => unknown,
|
||||
|
||||
/**
|
||||
* Whether to prevent any other native components from becoming responder
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ const itif = (condition: boolean) => {
|
||||
};
|
||||
|
||||
// TODO: Move this util to a shared location.
|
||||
function getMock<TArguments: $ReadOnlyArray<mixed>, TReturn>(
|
||||
function getMock<TArguments: $ReadOnlyArray<unknown>, TReturn>(
|
||||
fn: (...args: TArguments) => TReturn,
|
||||
): JestMockFn<TArguments, TReturn> {
|
||||
if (!jest.isMockFunction(fn)) {
|
||||
|
||||
@@ -29,7 +29,7 @@ export type AppConfig = {
|
||||
...
|
||||
};
|
||||
export type AppParameters = {
|
||||
initialProps: $ReadOnly<{[string]: mixed, ...}>,
|
||||
initialProps: $ReadOnly<{[string]: unknown, ...}>,
|
||||
rootTag: RootTag,
|
||||
fabric?: boolean,
|
||||
};
|
||||
|
||||
@@ -265,7 +265,7 @@ const UIManagerJS: UIManagerJSInterface & {[string]: any} = {
|
||||
...UIManagerJSDeprecatedPlatformAPIs,
|
||||
...UIManagerJSPlatformAPIs,
|
||||
...UIManagerJSUnusedInNewArchAPIs,
|
||||
getViewManagerConfig: (viewManagerName: string): mixed => {
|
||||
getViewManagerConfig: (viewManagerName: string): unknown => {
|
||||
if (getUIManagerConstants) {
|
||||
const constants = getUIManagerConstantsCached();
|
||||
if (
|
||||
|
||||
@@ -71,7 +71,7 @@ export interface Spec {
|
||||
+dispatchCommand: (
|
||||
node: Node,
|
||||
commandName: string,
|
||||
args: Array<mixed>,
|
||||
args: Array<unknown>,
|
||||
) => void;
|
||||
+findNodeAtPoint: (
|
||||
node: Node,
|
||||
|
||||
@@ -121,7 +121,7 @@ function lazifyViewManagerConfig(viewName: string) {
|
||||
defineLazyObjectProperty(viewConfig, 'Constants', {
|
||||
get: () => {
|
||||
const viewManager = NativeModules[viewConfig.Manager];
|
||||
const constants: {[string]: mixed} = {};
|
||||
const constants: {[string]: unknown} = {};
|
||||
viewManager &&
|
||||
Object.keys(viewManager).forEach(key => {
|
||||
const value = viewManager[key];
|
||||
|
||||
Vendored
+1
-1
@@ -27,7 +27,7 @@ import ReactNativeElement from '../../../src/private/webapis/dom/nodes/ReactNati
|
||||
import ReadOnlyText from '../../../src/private/webapis/dom/nodes/ReadOnlyText';
|
||||
import * as RendererProxy from '../../ReactNative/RendererProxy';
|
||||
|
||||
export opaque type PublicRootInstance = mixed;
|
||||
export opaque type PublicRootInstance = unknown;
|
||||
|
||||
export function createPublicRootInstance(rootTag: RootTag): PublicRootInstance {
|
||||
// $FlowExpectedError[incompatible-return]
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
* In that case `nativeFabricUIManager` isn't defined and `ReactFabric` throws.
|
||||
*/
|
||||
|
||||
export function isPublicInstance(maybeInstance: mixed): boolean {
|
||||
export function isPublicInstance(maybeInstance: unknown): boolean {
|
||||
return (
|
||||
maybeInstance != null &&
|
||||
// TODO: implement a better check when the instance is defined in the React Native repository.
|
||||
@@ -26,7 +26,7 @@ export function isPublicInstance(maybeInstance: mixed): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
function isLegacyFabricInstance(maybeInstance: mixed): boolean {
|
||||
function isLegacyFabricInstance(maybeInstance: unknown): boolean {
|
||||
/* eslint-disable dot-notation */
|
||||
return (
|
||||
maybeInstance != null &&
|
||||
|
||||
packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js
Vendored
+1
-1
@@ -34,7 +34,7 @@ const deepDifferOptions = {
|
||||
unsafelyIgnoreFunctions: true,
|
||||
};
|
||||
|
||||
function defaultDiffer(prevProp: mixed, nextProp: mixed): boolean {
|
||||
function defaultDiffer(prevProp: unknown, nextProp: unknown): boolean {
|
||||
if (typeof nextProp !== 'object' || nextProp === null) {
|
||||
// Scalars have already been checked for equality
|
||||
return true;
|
||||
|
||||
@@ -114,7 +114,7 @@ let cachedPaperDispatchCommand;
|
||||
export function dispatchCommand(
|
||||
handle: HostInstance,
|
||||
command: string,
|
||||
args: Array<mixed>,
|
||||
args: Array<unknown>,
|
||||
): void {
|
||||
if (global.RN$Bridgeless === true) {
|
||||
// Note: this function has the same implementation in the legacy and new renderer.
|
||||
|
||||
+1
-1
@@ -69,7 +69,7 @@ function getNativeComponentAttributes(uiViewClassName: string): any {
|
||||
}
|
||||
}
|
||||
|
||||
const validAttributes: {[string]: mixed} = {};
|
||||
const validAttributes: {[string]: unknown} = {};
|
||||
|
||||
for (const key in nativeProps) {
|
||||
const typeName = nativeProps[key];
|
||||
|
||||
+1
-2
@@ -39,7 +39,6 @@ import typeof Platform from '../Utilities/Platform';
|
||||
// Expose these types to the React renderer
|
||||
export type {
|
||||
HostInstance as PublicInstance,
|
||||
|
||||
// These types are only necessary for Paper
|
||||
NativeMethods as LegacyPublicInstance,
|
||||
MeasureOnSuccessCallback,
|
||||
@@ -79,7 +78,7 @@ module.exports = {
|
||||
return require('../Utilities/differ/deepDiffer').default;
|
||||
},
|
||||
get deepFreezeAndThrowOnMutationInDev(): deepFreezeAndThrowOnMutationInDev<
|
||||
{...} | Array<mixed>,
|
||||
{...} | Array<unknown>,
|
||||
> {
|
||||
return require('../Utilities/deepFreezeAndThrowOnMutationInDev').default;
|
||||
},
|
||||
|
||||
@@ -22,7 +22,7 @@ const Settings = {
|
||||
_settings: (NativeSettingsManager &&
|
||||
NativeSettingsManager.getConstants().settings: any),
|
||||
|
||||
get(key: string): mixed {
|
||||
get(key: string): unknown {
|
||||
// $FlowFixMe[object-this-reference]
|
||||
return this._settings[key];
|
||||
},
|
||||
|
||||
@@ -159,7 +159,7 @@ export default {
|
||||
*/
|
||||
setStyleAttributePreprocessor(
|
||||
property: string,
|
||||
process: (nextProp: mixed) => mixed,
|
||||
process: (nextProp: unknown) => unknown,
|
||||
) {
|
||||
let value;
|
||||
|
||||
|
||||
@@ -1104,22 +1104,20 @@ export type ____Styles_Internal = {
|
||||
// ____FlattenStyleProp_Helper should be considered internal.
|
||||
type FlattenDepthLimiter = [void, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
||||
type ____FlattenStyleProp_Helper<
|
||||
+TStyleProp: StyleProp<mixed>,
|
||||
+TStyleProp: StyleProp<unknown>,
|
||||
Depth: $Values<FlattenDepthLimiter> = 9,
|
||||
> = Depth extends 0
|
||||
? empty
|
||||
: TStyleProp extends null | void | false | ''
|
||||
? empty
|
||||
: // When TStyleProp is an array, recurse with decremented Depth
|
||||
TStyleProp extends $ReadOnlyArray<infer V>
|
||||
? empty // When TStyleProp is an array, recurse with decremented Depth
|
||||
: TStyleProp extends $ReadOnlyArray<infer V>
|
||||
? ____FlattenStyleProp_Helper<
|
||||
V,
|
||||
Depth extends number ? FlattenDepthLimiter[Depth] : 0,
|
||||
>
|
||||
: TStyleProp;
|
||||
|
||||
export type ____FlattenStyleProp_Internal<+TStyleProp: StyleProp<mixed>> =
|
||||
____FlattenStyleProp_Helper<TStyleProp> extends empty
|
||||
? // $FlowFixMe[unclear-type]
|
||||
any
|
||||
export type ____FlattenStyleProp_Internal<+TStyleProp: StyleProp<unknown>> =
|
||||
____FlattenStyleProp_Helper<TStyleProp> extends empty // $FlowFixMe[unclear-type]
|
||||
? any
|
||||
: ____FlattenStyleProp_Helper<TStyleProp>;
|
||||
@@ -115,7 +115,7 @@ export default function processFilter(
|
||||
return result;
|
||||
}
|
||||
|
||||
function _getFilterAmount(filterName: string, filterArgs: mixed): ?number {
|
||||
function _getFilterAmount(filterName: string, filterArgs: unknown): ?number {
|
||||
let filterArgAsNumber: number;
|
||||
let unit: string;
|
||||
if (typeof filterArgs === 'string') {
|
||||
|
||||
+4
-4
@@ -668,10 +668,10 @@ const TextImpl: component(
|
||||
TextImpl.displayName = 'Text';
|
||||
|
||||
type TextPressabilityProps = $ReadOnly<{
|
||||
onLongPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressIn?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressOut?: ?(event: GestureResponderEvent) => mixed,
|
||||
onLongPress?: ?(event: GestureResponderEvent) => unknown,
|
||||
onPress?: ?(event: GestureResponderEvent) => unknown,
|
||||
onPressIn?: ?(event: GestureResponderEvent) => unknown,
|
||||
onPressOut?: ?(event: GestureResponderEvent) => unknown,
|
||||
onResponderGrant?: ?(event: GestureResponderEvent) => void,
|
||||
onResponderMove?: ?(event: GestureResponderEvent) => void,
|
||||
onResponderRelease?: ?(event: GestureResponderEvent) => void,
|
||||
|
||||
@@ -21,7 +21,7 @@ export type NativeTextProps = $ReadOnly<{
|
||||
...TextProps,
|
||||
isHighlighted?: ?boolean,
|
||||
selectionColor?: ?ProcessedColorValue,
|
||||
onClick?: ?(event: GestureResponderEvent) => mixed,
|
||||
onClick?: ?(event: GestureResponderEvent) => unknown,
|
||||
// This is only needed for platforms that optimize text hit testing, e.g.,
|
||||
// react-native-windows. It can be used to only hit test virtual text spans
|
||||
// that have pressable events attached to them.
|
||||
|
||||
+7
-7
@@ -122,7 +122,7 @@ export type TextPropsAndroid = {
|
||||
};
|
||||
|
||||
type TextBaseProps = $ReadOnly<{
|
||||
onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed,
|
||||
onAccessibilityAction?: ?(event: AccessibilityActionEvent) => unknown,
|
||||
|
||||
/**
|
||||
* Whether fonts should scale to respect Text Size accessibility settings.
|
||||
@@ -204,7 +204,7 @@ type TextBaseProps = $ReadOnly<{
|
||||
*
|
||||
* See https://reactnative.dev/docs/text#onlayout
|
||||
*/
|
||||
onLayout?: ?(event: LayoutChangeEvent) => mixed,
|
||||
onLayout?: ?(event: LayoutChangeEvent) => unknown,
|
||||
|
||||
/**
|
||||
* This function is called on long press.
|
||||
@@ -212,7 +212,7 @@ type TextBaseProps = $ReadOnly<{
|
||||
*
|
||||
* See https://reactnative.dev/docs/text#onlongpress
|
||||
*/
|
||||
onLongPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
onLongPress?: ?(event: GestureResponderEvent) => unknown,
|
||||
|
||||
/**
|
||||
* This function is called on press.
|
||||
@@ -220,9 +220,9 @@ type TextBaseProps = $ReadOnly<{
|
||||
*
|
||||
* See https://reactnative.dev/docs/text#onpress
|
||||
*/
|
||||
onPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressIn?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressOut?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPress?: ?(event: GestureResponderEvent) => unknown,
|
||||
onPressIn?: ?(event: GestureResponderEvent) => unknown,
|
||||
onPressOut?: ?(event: GestureResponderEvent) => unknown,
|
||||
onResponderGrant?: ?(event: GestureResponderEvent) => void,
|
||||
onResponderMove?: ?(event: GestureResponderEvent) => void,
|
||||
onResponderRelease?: ?(event: GestureResponderEvent) => void,
|
||||
@@ -230,7 +230,7 @@ type TextBaseProps = $ReadOnly<{
|
||||
onResponderTerminationRequest?: ?() => boolean,
|
||||
onStartShouldSetResponder?: ?() => boolean,
|
||||
onMoveShouldSetResponder?: ?() => boolean,
|
||||
onTextLayout?: ?(event: TextLayoutEvent) => mixed,
|
||||
onTextLayout?: ?(event: TextLayoutEvent) => unknown,
|
||||
|
||||
/**
|
||||
* Defines how far your touch may move off of the button, before
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ export type Float = number;
|
||||
export type Int32 = number;
|
||||
/* $FlowFixMe[unclear-type] Object is forbidden in strict mode */
|
||||
export type UnsafeObject = Object;
|
||||
export type UnsafeMixed = mixed;
|
||||
export type UnsafeMixed = unknown;
|
||||
|
||||
type DefaultTypes = number | boolean | string | $ReadOnlyArray<string>;
|
||||
// Default handling, ignore the unused value
|
||||
|
||||
@@ -32,7 +32,7 @@ export type ReactDevToolsAgentEvents = {
|
||||
};
|
||||
|
||||
export type ReactDevToolsAgent = {
|
||||
selectNode(node: mixed): void,
|
||||
selectNode(node: unknown): void,
|
||||
stopInspectingNative(value: boolean): void,
|
||||
addListener<Event: $Keys<ReactDevToolsAgentEvents>>(
|
||||
event: Event,
|
||||
@@ -48,6 +48,6 @@ export type ReactDevToolsGlobalHook = {
|
||||
on: (eventName: string, (agent: ReactDevToolsAgent) => void) => void,
|
||||
off: (eventName: string, (agent: ReactDevToolsAgent) => void) => void,
|
||||
reactDevtoolsAgent?: ReactDevToolsAgent,
|
||||
resolveRNStyle?: mixed,
|
||||
resolveRNStyle?: unknown,
|
||||
nativeStyleEditorValidAttributes?: Array<string>,
|
||||
};
|
||||
@@ -24,7 +24,7 @@ let DevSettings: {
|
||||
* @param title - The title of the menu item. Is internally used as id and should therefore be unique.
|
||||
* @param handler - The callback invoked when pressing the menu item.
|
||||
*/
|
||||
addMenuItem(title: string, handler: () => mixed): void,
|
||||
addMenuItem(title: string, handler: () => unknown): void,
|
||||
/**
|
||||
* Reload the application.
|
||||
*
|
||||
@@ -33,7 +33,7 @@ let DevSettings: {
|
||||
reload(reason?: string): void,
|
||||
onFastRefresh(): void,
|
||||
} = {
|
||||
addMenuItem(title: string, handler: () => mixed): void {},
|
||||
addMenuItem(title: string, handler: () => unknown): void {},
|
||||
reload(reason?: string): void {},
|
||||
onFastRefresh(): void {},
|
||||
};
|
||||
@@ -51,7 +51,7 @@ if (__DEV__) {
|
||||
const subscriptions = new Map<string, EventSubscription>();
|
||||
|
||||
DevSettings = {
|
||||
addMenuItem(title: string, handler: () => mixed): void {
|
||||
addMenuItem(title: string, handler: () => unknown): void {
|
||||
// Make sure items are not added multiple times. This can
|
||||
// happen when hot reloading the module that registers the
|
||||
// menu items. The title is used as the id which means we
|
||||
|
||||
+3
-3
@@ -26,7 +26,7 @@ let hmrUnavailableReason: string | null = null;
|
||||
let hmrOrigin: string | null = null;
|
||||
let currentCompileErrorMessage: string | null = null;
|
||||
let didConnect: boolean = false;
|
||||
let pendingLogs: Array<[LogLevel, $ReadOnlyArray<mixed>]> = [];
|
||||
let pendingLogs: Array<[LogLevel, $ReadOnlyArray<unknown>]> = [];
|
||||
|
||||
type LogLevel =
|
||||
| 'trace'
|
||||
@@ -43,7 +43,7 @@ export type HMRClientNativeInterface = {
|
||||
enable(): void,
|
||||
disable(): void,
|
||||
registerBundle(requestUrl: string): void,
|
||||
log(level: LogLevel, data: $ReadOnlyArray<mixed>): void,
|
||||
log(level: LogLevel, data: $ReadOnlyArray<unknown>): void,
|
||||
setup(
|
||||
platform: string,
|
||||
bundleEntry: string,
|
||||
@@ -113,7 +113,7 @@ const HMRClient: HMRClientNativeInterface = {
|
||||
registerBundleEntryPoints(hmrClient);
|
||||
},
|
||||
|
||||
log(level: LogLevel, data: $ReadOnlyArray<mixed>) {
|
||||
log(level: LogLevel, data: $ReadOnlyArray<unknown>) {
|
||||
if (!hmrClient) {
|
||||
// Catch a reasonable number of early logs
|
||||
// in case hmrClient gets initialized later.
|
||||
|
||||
+3
-3
@@ -20,11 +20,11 @@ const levelsMap = {
|
||||
fatal: 'error',
|
||||
};
|
||||
|
||||
let warningHandler: ?(...Array<mixed>) => void = null;
|
||||
let warningHandler: ?(...Array<unknown>) => void = null;
|
||||
|
||||
const RCTLog = {
|
||||
// level one of log, info, warn, error, mustfix
|
||||
logIfNoNativeHook(level: string, ...args: Array<mixed>): void {
|
||||
logIfNoNativeHook(level: string, ...args: Array<unknown>): void {
|
||||
// We already printed in the native console, so only log here if using a js debugger
|
||||
if (typeof global.nativeLoggingHook === 'undefined') {
|
||||
RCTLog.logToConsole(level, ...args);
|
||||
@@ -37,7 +37,7 @@ const RCTLog = {
|
||||
},
|
||||
|
||||
// Log to console regardless of nativeLoggingHook
|
||||
logToConsole(level: string, ...args: Array<mixed>): void {
|
||||
logToConsole(level: string, ...args: Array<unknown>): void {
|
||||
// $FlowFixMe[invalid-computed-prop]
|
||||
const logFn = levelsMap[level];
|
||||
invariant(
|
||||
|
||||
@@ -124,7 +124,7 @@ function expectNoConsoleError() {
|
||||
async function expectRendersMatchingSnapshot(
|
||||
name: string,
|
||||
ComponentProvider: () => React.MixedElement,
|
||||
unmockComponent: () => mixed,
|
||||
unmockComponent: () => unknown,
|
||||
) {
|
||||
let instance;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
export type Scene = {name: string, [string]: mixed, ...};
|
||||
export type Scene = {name: string, [string]: unknown, ...};
|
||||
|
||||
let _listeners: Array<(scene: Scene) => void> = [];
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ type NativeCommandsOptions<T = string> = $ReadOnly<{
|
||||
function codegenNativeCommands<T: interface {}>(
|
||||
options: NativeCommandsOptions<$Keys<T>>,
|
||||
): T {
|
||||
const commandObj: {[$Keys<T>]: (...$ReadOnlyArray<mixed>) => void} = {};
|
||||
const commandObj: {[$Keys<T>]: (...$ReadOnlyArray<unknown>) => void} = {};
|
||||
|
||||
options.supportedCommands.forEach(command => {
|
||||
// $FlowFixMe[missing-local-annot]
|
||||
|
||||
+3
-3
@@ -27,7 +27,7 @@
|
||||
* Freezing the object and adding the throw mechanism is expensive and will
|
||||
* only be used in DEV.
|
||||
*/
|
||||
function deepFreezeAndThrowOnMutationInDev<T: {...} | Array<mixed>>(
|
||||
function deepFreezeAndThrowOnMutationInDev<T: {...} | Array<unknown>>(
|
||||
object: T,
|
||||
): T {
|
||||
if (__DEV__) {
|
||||
@@ -43,7 +43,7 @@ function deepFreezeAndThrowOnMutationInDev<T: {...} | Array<mixed>>(
|
||||
}
|
||||
|
||||
// $FlowFixMe[not-an-object] `object` can be an array, but Object.keys works with arrays too
|
||||
const keys = Object.keys((object: {...} | Array<mixed>));
|
||||
const keys = Object.keys((object: {...} | Array<unknown>));
|
||||
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
@@ -85,7 +85,7 @@ function throwOnImmutableMutation(key: empty, value) {
|
||||
);
|
||||
}
|
||||
|
||||
function identity(value: mixed) {
|
||||
function identity(value: unknown) {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
* `console.error` as a failure callback - it's not properly bound. If passes an
|
||||
* `Error` object, it will print the message and stack.
|
||||
*/
|
||||
const logError = function (...args: $ReadOnlyArray<mixed>) {
|
||||
const logError = function (...args: $ReadOnlyArray<unknown>) {
|
||||
if (args.length === 1 && args[0] instanceof Error) {
|
||||
const err = args[0];
|
||||
console.error('Error: "' + err.message + '". Stack:\n' + err.stack);
|
||||
|
||||
@@ -19,17 +19,17 @@ export function createStringifySafeWithLimits(limits: {
|
||||
maxStringLimit?: number,
|
||||
maxArrayLimit?: number,
|
||||
maxObjectKeysLimit?: number,
|
||||
}): mixed => string {
|
||||
}): unknown => string {
|
||||
const {
|
||||
maxDepth = Number.POSITIVE_INFINITY,
|
||||
maxStringLimit = Number.POSITIVE_INFINITY,
|
||||
maxArrayLimit = Number.POSITIVE_INFINITY,
|
||||
maxObjectKeysLimit = Number.POSITIVE_INFINITY,
|
||||
} = limits;
|
||||
const stack: Array<mixed> = [];
|
||||
const stack: Array<unknown> = [];
|
||||
/* $FlowFixMe[missing-this-annot] The 'this' type annotation(s) required by
|
||||
* Flow's LTI update could not be added via codemod */
|
||||
function replacer(key: string, value: mixed): mixed {
|
||||
function replacer(key: string, value: unknown): unknown {
|
||||
while (stack.length && this !== stack[0]) {
|
||||
stack.shift();
|
||||
}
|
||||
@@ -45,7 +45,7 @@ export function createStringifySafeWithLimits(limits: {
|
||||
return value;
|
||||
}
|
||||
|
||||
let retval: mixed = value;
|
||||
let retval: unknown = value;
|
||||
if (Array.isArray(value)) {
|
||||
if (stack.length >= maxDepth) {
|
||||
retval = `[ ... array with ${value.length} values ... ]`;
|
||||
@@ -64,7 +64,7 @@ export function createStringifySafeWithLimits(limits: {
|
||||
retval = `{ ... object with ${keys.length} keys ... }`;
|
||||
} else if (keys.length > maxObjectKeysLimit) {
|
||||
// Return a sample of the keys.
|
||||
retval = ({}: {[string]: mixed});
|
||||
retval = ({}: {[string]: unknown});
|
||||
for (let k of keys.slice(0, maxObjectKeysLimit)) {
|
||||
retval[k] = value[k];
|
||||
}
|
||||
@@ -76,7 +76,7 @@ export function createStringifySafeWithLimits(limits: {
|
||||
return retval;
|
||||
}
|
||||
|
||||
return function stringifySafe(arg: mixed): string {
|
||||
return function stringifySafe(arg: unknown): string {
|
||||
if (arg === undefined) {
|
||||
return 'undefined';
|
||||
} else if (arg === null) {
|
||||
@@ -111,7 +111,7 @@ export function createStringifySafeWithLimits(limits: {
|
||||
};
|
||||
}
|
||||
|
||||
const stringifySafe: mixed => string = createStringifySafeWithLimits({
|
||||
const stringifySafe: unknown => string = createStringifySafeWithLimits({
|
||||
maxDepth: 10,
|
||||
maxStringLimit: 100,
|
||||
maxArrayLimit: 50,
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
import {useCallback, useRef} from 'react';
|
||||
|
||||
type CallbackRef<T> = T => mixed;
|
||||
type CallbackRef<T> = T => unknown;
|
||||
|
||||
/**
|
||||
* Constructs a callback ref that provides similar semantics as `useEffect`. The
|
||||
|
||||
+10
-10
@@ -9,30 +9,30 @@
|
||||
*/
|
||||
|
||||
// From @react-native/js-polyfills
|
||||
type ErrorHandler = (error: mixed, isFatal: boolean) => void;
|
||||
type Fn<Args: $ReadOnlyArray<mixed>, Return> = (...Args) => Return;
|
||||
type ErrorHandler = (error: unknown, isFatal: boolean) => void;
|
||||
type Fn<Args: $ReadOnlyArray<unknown>, Return> = (...Args) => Return;
|
||||
export type ErrorUtils = {
|
||||
applyWithGuard<TArgs: $ReadOnlyArray<mixed>, TOut>(
|
||||
applyWithGuard<TArgs: $ReadOnlyArray<unknown>, TOut>(
|
||||
fun: Fn<TArgs, TOut>,
|
||||
context?: mixed,
|
||||
context?: unknown,
|
||||
args?: ?TArgs,
|
||||
unused_onError?: null,
|
||||
unused_name?: ?string,
|
||||
): ?TOut,
|
||||
applyWithGuardIfNeeded<TArgs: $ReadOnlyArray<mixed>, TOut>(
|
||||
applyWithGuardIfNeeded<TArgs: $ReadOnlyArray<unknown>, TOut>(
|
||||
fun: Fn<TArgs, TOut>,
|
||||
context?: mixed,
|
||||
context?: unknown,
|
||||
args?: ?TArgs,
|
||||
): ?TOut,
|
||||
getGlobalHandler(): ErrorHandler,
|
||||
guard<TArgs: $ReadOnlyArray<mixed>, TOut>(
|
||||
guard<TArgs: $ReadOnlyArray<unknown>, TOut>(
|
||||
fun: Fn<TArgs, TOut>,
|
||||
name?: ?string,
|
||||
context?: mixed,
|
||||
context?: unknown,
|
||||
): ?(...TArgs) => ?TOut,
|
||||
inGuard(): boolean,
|
||||
reportError(error: mixed): void,
|
||||
reportFatalError(error: mixed): void,
|
||||
reportError(error: unknown): void,
|
||||
reportFatalError(error: unknown): void,
|
||||
setGlobalHandler(fun: ErrorHandler): void,
|
||||
};
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ export interface IEventEmitter<
|
||||
> {
|
||||
addListener<TEvent: $Keys<TEventToArgsMap>>(
|
||||
eventType: TEvent,
|
||||
listener: (...args: TEventToArgsMap[TEvent]) => mixed,
|
||||
context?: mixed,
|
||||
listener: (...args: TEventToArgsMap[TEvent]) => unknown,
|
||||
context?: unknown,
|
||||
): EventSubscription;
|
||||
|
||||
emit<TEvent: $Keys<TEventToArgsMap>>(
|
||||
@@ -35,8 +35,8 @@ export interface IEventEmitter<
|
||||
}
|
||||
|
||||
interface Registration<TArgs> {
|
||||
+context: mixed;
|
||||
+listener: (...args: TArgs) => mixed;
|
||||
+context: unknown;
|
||||
+listener: (...args: TArgs) => unknown;
|
||||
+remove: () => void;
|
||||
}
|
||||
|
||||
@@ -85,8 +85,8 @@ export default class EventEmitter<
|
||||
*/
|
||||
addListener<TEvent: $Keys<TEventToArgsMap>>(
|
||||
eventType: TEvent,
|
||||
listener: (...args: TEventToArgsMap[TEvent]) => mixed,
|
||||
context: mixed,
|
||||
listener: (...args: TEventToArgsMap[TEvent]) => unknown,
|
||||
context: unknown,
|
||||
): EventSubscription {
|
||||
if (typeof listener !== 'function') {
|
||||
throw new TypeError(
|
||||
|
||||
+7
-7
@@ -106,27 +106,27 @@ describe('listeners', () => {
|
||||
}).not.toThrow();
|
||||
|
||||
expect(() => {
|
||||
// $FlowExpectedError[incompatible-type]
|
||||
// $FlowExpectedError[incompatible-type]
|
||||
emitter.addListener('A', null);
|
||||
}).toThrow();
|
||||
|
||||
expect(() => {
|
||||
// $FlowExpectedError[incompatible-type]
|
||||
// $FlowExpectedError[incompatible-type]
|
||||
emitter.addListener('A', undefined);
|
||||
}).toThrow();
|
||||
|
||||
expect(() => {
|
||||
// $FlowExpectedError[incompatible-type]
|
||||
// $FlowExpectedError[incompatible-type]
|
||||
emitter.addListener('A', 'abc');
|
||||
}).toThrow();
|
||||
|
||||
expect(() => {
|
||||
// $FlowExpectedError[incompatible-type]
|
||||
// $FlowExpectedError[incompatible-type]
|
||||
emitter.addListener('A', 123);
|
||||
}).toThrow();
|
||||
|
||||
expect(() => {
|
||||
// $FlowExpectedError[incompatible-type]
|
||||
// $FlowExpectedError[incompatible-type]
|
||||
emitter.addListener('A', 123);
|
||||
}).toThrow();
|
||||
});
|
||||
@@ -155,7 +155,7 @@ describe('arguments and context', () => {
|
||||
|
||||
const context = {};
|
||||
let that;
|
||||
const listener = jest.fn(function (this: mixed) {
|
||||
const listener = jest.fn(function (this: unknown) {
|
||||
that = this;
|
||||
});
|
||||
emitter.addListener('A', listener, context);
|
||||
@@ -341,7 +341,7 @@ describe('event emission', () => {
|
||||
const listenerA = jest.fn(() => {
|
||||
results.push('A');
|
||||
});
|
||||
const listenerB: JestMockFn<Array<mixed>, void> = jest.fn(() => {
|
||||
const listenerB: JestMockFn<Array<unknown>, void> = jest.fn(() => {
|
||||
results.push('B');
|
||||
subscriptionB.remove();
|
||||
});
|
||||
|
||||
+6
-6
@@ -59,7 +59,7 @@ declare type $HermesInternalType = {
|
||||
+getRuntimeProperties?: () => {
|
||||
'OSS Release Version': string,
|
||||
Build: string,
|
||||
[string]: mixed,
|
||||
[string]: unknown,
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -93,10 +93,10 @@ declare type $HermesInternalType = {
|
||||
*/
|
||||
+enablePromiseRejectionTracker?: (
|
||||
options: ?{
|
||||
whitelist?: ?Array<mixed>,
|
||||
whitelist?: ?Array<unknown>,
|
||||
allRejections?: ?boolean,
|
||||
onUnhandled?: ?(number, mixed) => void,
|
||||
onHandled?: ?(number, mixed) => void,
|
||||
onUnhandled?: ?(number, unknown) => void,
|
||||
onHandled?: ?(number, unknown) => void,
|
||||
},
|
||||
) => void,
|
||||
|
||||
@@ -108,7 +108,7 @@ declare type $HermesInternalType = {
|
||||
/**
|
||||
* Enqueue a JavaScript callback function as a Job into the engine Job queue.
|
||||
*/
|
||||
+enqueueJob?: <TArguments: Array<mixed>>(
|
||||
jobCallback: (...args: TArguments) => mixed,
|
||||
+enqueueJob?: <TArguments: Array<unknown>>(
|
||||
jobCallback: (...args: TArguments) => unknown,
|
||||
) => void,
|
||||
};
|
||||
@@ -32,31 +32,31 @@ declare interface ConsoleTask {
|
||||
// $FlowExpectedError[libdef-override] Flow core definitions are incomplete.
|
||||
declare var console: {
|
||||
// Logging
|
||||
log(...data: $ReadOnlyArray<mixed>): void,
|
||||
trace(...data: $ReadOnlyArray<mixed>): void,
|
||||
debug(...data: $ReadOnlyArray<mixed>): void,
|
||||
info(...data: $ReadOnlyArray<mixed>): void,
|
||||
warn(...data: $ReadOnlyArray<mixed>): void,
|
||||
error(...data: $ReadOnlyArray<mixed>): void,
|
||||
log(...data: $ReadOnlyArray<unknown>): void,
|
||||
trace(...data: $ReadOnlyArray<unknown>): void,
|
||||
debug(...data: $ReadOnlyArray<unknown>): void,
|
||||
info(...data: $ReadOnlyArray<unknown>): void,
|
||||
warn(...data: $ReadOnlyArray<unknown>): void,
|
||||
error(...data: $ReadOnlyArray<unknown>): void,
|
||||
|
||||
// Grouping
|
||||
group(...data: $ReadOnlyArray<mixed>): void,
|
||||
groupCollapsed(...data: $ReadOnlyArray<mixed>): void,
|
||||
group(...data: $ReadOnlyArray<unknown>): void,
|
||||
groupCollapsed(...data: $ReadOnlyArray<unknown>): void,
|
||||
groupEnd(): void,
|
||||
|
||||
// Printing
|
||||
table(
|
||||
tabularData:
|
||||
| $ReadOnly<{[key: string]: mixed, ...}>
|
||||
| $ReadOnlyArray<$ReadOnly<{[key: string]: mixed, ...}>>
|
||||
| $ReadOnlyArray<$ReadOnlyArray<mixed>>,
|
||||
| $ReadOnly<{[key: string]: unknown, ...}>
|
||||
| $ReadOnlyArray<$ReadOnly<{[key: string]: unknown, ...}>>
|
||||
| $ReadOnlyArray<$ReadOnlyArray<unknown>>,
|
||||
): void,
|
||||
dir(...data: $ReadOnlyArray<mixed>): void,
|
||||
dirxml(...data: $ReadOnlyArray<mixed>): void,
|
||||
dir(...data: $ReadOnlyArray<unknown>): void,
|
||||
dirxml(...data: $ReadOnlyArray<unknown>): void,
|
||||
clear(): void,
|
||||
|
||||
// Utilities
|
||||
assert(condition: mixed, ...data: $ReadOnlyArray<mixed>): void,
|
||||
assert(condition: unknown, ...data: $ReadOnlyArray<unknown>): void,
|
||||
|
||||
// Profiling
|
||||
profile(name?: string): void,
|
||||
@@ -76,7 +76,7 @@ declare var console: {
|
||||
trackName?: string,
|
||||
trackGroup?: string,
|
||||
color?: DevToolsColor,
|
||||
detail?: {[string]: mixed},
|
||||
detail?: {[string]: unknown},
|
||||
): void,
|
||||
|
||||
// Stack tagging
|
||||
@@ -114,12 +114,12 @@ declare class PerformanceEntry {
|
||||
// https://w3c.github.io/user-timing/#performancemark
|
||||
declare class PerformanceMark extends PerformanceEntry {
|
||||
constructor(name: string, markOptions?: PerformanceMarkOptions): void;
|
||||
+detail: mixed;
|
||||
+detail: unknown;
|
||||
}
|
||||
|
||||
// https://w3c.github.io/user-timing/#performancemeasure
|
||||
declare class PerformanceMeasure extends PerformanceEntry {
|
||||
+detail: mixed;
|
||||
+detail: unknown;
|
||||
}
|
||||
|
||||
// https://w3c.github.io/server-timing/#the-performanceservertiming-interface
|
||||
@@ -177,12 +177,12 @@ declare class PerformanceLongTaskTiming extends PerformanceEntry {
|
||||
|
||||
// https://www.w3.org/TR/user-timing/#extensions-performance-interface
|
||||
declare type PerformanceMarkOptions = {
|
||||
detail?: mixed,
|
||||
detail?: unknown,
|
||||
startTime?: number,
|
||||
};
|
||||
|
||||
declare type PerformanceMeasureOptions = {
|
||||
detail?: mixed,
|
||||
detail?: unknown,
|
||||
duration?: number,
|
||||
end?: number | string,
|
||||
start?: number | string,
|
||||
@@ -249,7 +249,7 @@ declare class PerformanceObserver {
|
||||
callback: (
|
||||
entries: PerformanceObserverEntryList,
|
||||
observer: PerformanceObserver,
|
||||
) => mixed,
|
||||
) => unknown,
|
||||
): void;
|
||||
|
||||
disconnect(): void;
|
||||
@@ -345,10 +345,10 @@ declare class WebSocket extends EventTarget {
|
||||
CONNECTING: 0;
|
||||
constructor(url: string, protocols?: string | Array<string>): void;
|
||||
extensions: string;
|
||||
onclose: (ev: CloseEvent) => mixed;
|
||||
onerror: (ev: $FlowFixMe) => mixed;
|
||||
onmessage: (ev: MessageEvent) => mixed;
|
||||
onopen: (ev: $FlowFixMe) => mixed;
|
||||
onclose: (ev: CloseEvent) => unknown;
|
||||
onerror: (ev: $FlowFixMe) => unknown;
|
||||
onmessage: (ev: MessageEvent) => unknown;
|
||||
onopen: (ev: $FlowFixMe) => unknown;
|
||||
static OPEN: 1;
|
||||
OPEN: 1;
|
||||
protocol: string;
|
||||
@@ -378,7 +378,7 @@ declare class XMLHttpRequest extends EventTarget {
|
||||
onloadend: ProgressEventHandler;
|
||||
onloadstart: ProgressEventHandler;
|
||||
onprogress: ProgressEventHandler;
|
||||
onreadystatechange: (ev: $FlowFixMe) => mixed;
|
||||
onreadystatechange: (ev: $FlowFixMe) => unknown;
|
||||
ontimeout: ProgressEventHandler;
|
||||
open(
|
||||
method: string,
|
||||
@@ -441,7 +441,7 @@ declare class Headers {
|
||||
value: string,
|
||||
name: string,
|
||||
headers: Headers,
|
||||
) => mixed,
|
||||
) => unknown,
|
||||
thisArg: This,
|
||||
): void;
|
||||
get(name: string): null | string;
|
||||
@@ -471,7 +471,7 @@ declare class URLSearchParams {
|
||||
value: string,
|
||||
name: string,
|
||||
params: URLSearchParams,
|
||||
) => mixed,
|
||||
) => unknown,
|
||||
thisArg: This,
|
||||
): void;
|
||||
get(name: string): null | string;
|
||||
@@ -611,7 +611,7 @@ declare class AbortController {
|
||||
declare class AbortSignal extends EventTarget {
|
||||
abort(reason?: $FlowFixMe): AbortSignal;
|
||||
+aborted: boolean;
|
||||
onabort: (event: Event) => mixed;
|
||||
onabort: (event: Event) => unknown;
|
||||
+reason: $FlowFixMe;
|
||||
throwIfAborted(): void;
|
||||
timeout(time: number): AbortSignal;
|
||||
|
||||
@@ -524,9 +524,9 @@ declare class Animation extends EventTarget {
|
||||
finish(): void;
|
||||
+finished: Promise<Animation>;
|
||||
id: string;
|
||||
oncancel: ?(ev: AnimationPlaybackEvent) => mixed;
|
||||
onfinish: ?(ev: AnimationPlaybackEvent) => mixed;
|
||||
onremove: ?(ev: AnimationPlaybackEvent) => mixed;
|
||||
oncancel: ?(ev: AnimationPlaybackEvent) => unknown;
|
||||
onfinish: ?(ev: AnimationPlaybackEvent) => unknown;
|
||||
onremove: ?(ev: AnimationPlaybackEvent) => unknown;
|
||||
pause(): void;
|
||||
+pending: boolean;
|
||||
persist(): void;
|
||||
|
||||
@@ -101,7 +101,7 @@ declare class DataTransferItemList {
|
||||
declare class DataTransferItem {
|
||||
kind: string; // readonly
|
||||
type: string; // readonly
|
||||
getAsString(_callback: ?(data: string) => mixed): void;
|
||||
getAsString(_callback: ?(data: string) => unknown): void;
|
||||
getAsFile(): ?File;
|
||||
/*
|
||||
* This is not supported by all browsers, please have a fallback plan for it.
|
||||
@@ -168,79 +168,79 @@ declare type ScrollToOptions = {
|
||||
...
|
||||
};
|
||||
|
||||
type EventHandler = (event: Event) => mixed;
|
||||
type EventHandler = (event: Event) => unknown;
|
||||
type EventListener = {handleEvent: EventHandler, ...} | EventHandler;
|
||||
type MouseEventHandler = (event: MouseEvent) => mixed;
|
||||
type MouseEventHandler = (event: MouseEvent) => unknown;
|
||||
type MouseEventListener =
|
||||
| {handleEvent: MouseEventHandler, ...}
|
||||
| MouseEventHandler;
|
||||
type FocusEventHandler = (event: FocusEvent) => mixed;
|
||||
type FocusEventHandler = (event: FocusEvent) => unknown;
|
||||
type FocusEventListener =
|
||||
| {handleEvent: FocusEventHandler, ...}
|
||||
| FocusEventHandler;
|
||||
type KeyboardEventHandler = (event: KeyboardEvent) => mixed;
|
||||
type KeyboardEventHandler = (event: KeyboardEvent) => unknown;
|
||||
type KeyboardEventListener =
|
||||
| {handleEvent: KeyboardEventHandler, ...}
|
||||
| KeyboardEventHandler;
|
||||
type InputEventHandler = (event: InputEvent) => mixed;
|
||||
type InputEventHandler = (event: InputEvent) => unknown;
|
||||
type InputEventListener =
|
||||
| {handleEvent: InputEventHandler, ...}
|
||||
| InputEventHandler;
|
||||
type TouchEventHandler = (event: TouchEvent) => mixed;
|
||||
type TouchEventHandler = (event: TouchEvent) => unknown;
|
||||
type TouchEventListener =
|
||||
| {handleEvent: TouchEventHandler, ...}
|
||||
| TouchEventHandler;
|
||||
type WheelEventHandler = (event: WheelEvent) => mixed;
|
||||
type WheelEventHandler = (event: WheelEvent) => unknown;
|
||||
type WheelEventListener =
|
||||
| {handleEvent: WheelEventHandler, ...}
|
||||
| WheelEventHandler;
|
||||
type AbortProgressEventHandler = (event: ProgressEvent) => mixed;
|
||||
type AbortProgressEventHandler = (event: ProgressEvent) => unknown;
|
||||
type AbortProgressEventListener =
|
||||
| {handleEvent: AbortProgressEventHandler, ...}
|
||||
| AbortProgressEventHandler;
|
||||
type ProgressEventHandler = (event: ProgressEvent) => mixed;
|
||||
type ProgressEventHandler = (event: ProgressEvent) => unknown;
|
||||
type ProgressEventListener =
|
||||
| {handleEvent: ProgressEventHandler, ...}
|
||||
| ProgressEventHandler;
|
||||
type DragEventHandler = (event: DragEvent) => mixed;
|
||||
type DragEventHandler = (event: DragEvent) => unknown;
|
||||
type DragEventListener =
|
||||
| {handleEvent: DragEventHandler, ...}
|
||||
| DragEventHandler;
|
||||
type PointerEventHandler = (event: PointerEvent) => mixed;
|
||||
type PointerEventHandler = (event: PointerEvent) => unknown;
|
||||
type PointerEventListener =
|
||||
| {handleEvent: PointerEventHandler, ...}
|
||||
| PointerEventHandler;
|
||||
type AnimationEventHandler = (event: AnimationEvent) => mixed;
|
||||
type AnimationEventHandler = (event: AnimationEvent) => unknown;
|
||||
type AnimationEventListener =
|
||||
| {handleEvent: AnimationEventHandler, ...}
|
||||
| AnimationEventHandler;
|
||||
type ClipboardEventHandler = (event: ClipboardEvent) => mixed;
|
||||
type ClipboardEventHandler = (event: ClipboardEvent) => unknown;
|
||||
type ClipboardEventListener =
|
||||
| {handleEvent: ClipboardEventHandler, ...}
|
||||
| ClipboardEventHandler;
|
||||
type TransitionEventHandler = (event: TransitionEvent) => mixed;
|
||||
type TransitionEventHandler = (event: TransitionEvent) => unknown;
|
||||
type TransitionEventListener =
|
||||
| {handleEvent: TransitionEventHandler, ...}
|
||||
| TransitionEventHandler;
|
||||
type MessageEventHandler = (event: MessageEvent) => mixed;
|
||||
type MessageEventHandler = (event: MessageEvent) => unknown;
|
||||
type MessageEventListener =
|
||||
| {handleEvent: MessageEventHandler, ...}
|
||||
| MessageEventHandler;
|
||||
type BeforeUnloadEventHandler = (event: BeforeUnloadEvent) => mixed;
|
||||
type BeforeUnloadEventHandler = (event: BeforeUnloadEvent) => unknown;
|
||||
type BeforeUnloadEventListener =
|
||||
| {handleEvent: BeforeUnloadEventHandler, ...}
|
||||
| BeforeUnloadEventHandler;
|
||||
type StorageEventHandler = (event: StorageEvent) => mixed;
|
||||
type StorageEventHandler = (event: StorageEvent) => unknown;
|
||||
type StorageEventListener =
|
||||
| {handleEvent: StorageEventHandler, ...}
|
||||
| StorageEventHandler;
|
||||
type SecurityPolicyViolationEventHandler = (
|
||||
event: SecurityPolicyViolationEvent,
|
||||
) => mixed;
|
||||
) => unknown;
|
||||
type SecurityPolicyViolationEventListener =
|
||||
| {handleEvent: SecurityPolicyViolationEventHandler, ...}
|
||||
| SecurityPolicyViolationEventHandler;
|
||||
type USBConnectionEventHandler = (event: USBConnectionEvent) => mixed;
|
||||
type USBConnectionEventHandler = (event: USBConnectionEvent) => unknown;
|
||||
type USBConnectionEventListener =
|
||||
| {handleEvent: USBConnectionEventHandler, ...}
|
||||
| USBConnectionEventHandler;
|
||||
@@ -917,7 +917,7 @@ declare class PageTransitionEvent extends Event {
|
||||
// and
|
||||
// https://html.spec.whatwg.org/multipage/comms.html#the-messageevent-interfaces
|
||||
declare class MessageEvent extends Event {
|
||||
data: mixed;
|
||||
data: unknown;
|
||||
origin: string;
|
||||
lastEventId: string;
|
||||
source: WindowProxy;
|
||||
@@ -1158,7 +1158,7 @@ declare class BroadcastChannel extends EventTarget {
|
||||
onmessageerror: ?(event: MessageEvent) => void;
|
||||
|
||||
constructor(name: string): void;
|
||||
postMessage(msg: mixed): void;
|
||||
postMessage(msg: unknown): void;
|
||||
close(): void;
|
||||
}
|
||||
|
||||
@@ -1394,30 +1394,30 @@ 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,
|
||||
+createdCallback?: () => unknown,
|
||||
+attachedCallback?: () => unknown,
|
||||
+detachedCallback?: () => unknown,
|
||||
+attributeChangedCallback?: ((
|
||||
// attribute is set
|
||||
attributeLocalName: string,
|
||||
oldAttributeValue: null,
|
||||
newAttributeValue: string,
|
||||
attributeNamespace: string,
|
||||
) => mixed) &
|
||||
) => unknown) &
|
||||
// attribute is changed
|
||||
((
|
||||
attributeLocalName: string,
|
||||
oldAttributeValue: string,
|
||||
newAttributeValue: string,
|
||||
attributeNamespace: string,
|
||||
) => mixed) &
|
||||
) => unknown) &
|
||||
// attribute is removed
|
||||
((
|
||||
attributeLocalName: string,
|
||||
oldAttributeValue: string,
|
||||
newAttributeValue: null,
|
||||
attributeNamespace: string,
|
||||
) => mixed),
|
||||
) => unknown),
|
||||
...
|
||||
},
|
||||
+extends?: string,
|
||||
@@ -6245,13 +6245,13 @@ declare class Notification extends EventTarget {
|
||||
constructor(title: string, options?: NotificationOptions): void;
|
||||
static +permission: NotificationPermission;
|
||||
static requestPermission(
|
||||
callback?: (perm: NotificationPermission) => mixed,
|
||||
callback?: (perm: NotificationPermission) => unknown,
|
||||
): Promise<NotificationPermission>;
|
||||
static +maxActions: number;
|
||||
onclick: ?(evt: Event) => mixed;
|
||||
onclose: ?(evt: Event) => mixed;
|
||||
onerror: ?(evt: Event) => mixed;
|
||||
onshow: ?(evt: Event) => mixed;
|
||||
onclick: ?(evt: Event) => unknown;
|
||||
onclose: ?(evt: Event) => unknown;
|
||||
onerror: ?(evt: Event) => unknown;
|
||||
onshow: ?(evt: Event) => unknown;
|
||||
+title: string;
|
||||
+dir: NotificationDirection;
|
||||
+lang: string;
|
||||
|
||||
Vendored
+2
-2
@@ -16,7 +16,7 @@
|
||||
* If `factoryRef` is provided, it is expected to reference a module that
|
||||
* exports the same type signature as the module referenced by `moduleRef`.
|
||||
*/
|
||||
export default function mock<TModuleRef: $Flow$ModuleRef<mixed>>(
|
||||
export default function mock<TModuleRef: $Flow$ModuleRef<unknown>>(
|
||||
moduleRef: TModuleRef,
|
||||
factoryRef?: NoInfer<TModuleRef>,
|
||||
): void {
|
||||
@@ -33,7 +33,7 @@ export default function mock<TModuleRef: $Flow$ModuleRef<mixed>>(
|
||||
}
|
||||
}
|
||||
|
||||
function deref(ref: $Flow$ModuleRef<mixed>): string {
|
||||
function deref(ref: $Flow$ModuleRef<unknown>): string {
|
||||
// $FlowFixMe[incompatible-type]
|
||||
return (ref as string).substring(2);
|
||||
}
|
||||
Vendored
+1
-1
@@ -51,7 +51,7 @@ Object.defineProperties(global, {
|
||||
regeneratorRuntime: {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
value: jest.requireActual<mixed>('regenerator-runtime/runtime'),
|
||||
value: jest.requireActual<unknown>('regenerator-runtime/runtime'),
|
||||
writable: true,
|
||||
},
|
||||
requestAnimationFrame: {
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@ function createExpirationChecker(
|
||||
|
||||
export function createShadowNodeReferenceCountingRef(): [
|
||||
() => number,
|
||||
React.RefSetter<mixed>,
|
||||
React.RefSetter<unknown>,
|
||||
] {
|
||||
let getReferenceCount: ?() => number;
|
||||
|
||||
@@ -45,7 +45,7 @@ export function createShadowNodeReferenceCountingRef(): [
|
||||
return getReferenceCount();
|
||||
}
|
||||
|
||||
function ref(instance: mixed | null) {
|
||||
function ref(instance: unknown | null) {
|
||||
if (instance == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ function createShadowNodeRevisionGetter(
|
||||
|
||||
export function createShadowNodeReferenceGetterRef(): [
|
||||
() => ?number,
|
||||
React.RefSetter<mixed>,
|
||||
React.RefSetter<unknown>,
|
||||
] {
|
||||
let getRevision: ?() => ?number;
|
||||
|
||||
@@ -34,7 +34,7 @@ export function createShadowNodeReferenceGetterRef(): [
|
||||
return getRevision();
|
||||
}
|
||||
|
||||
function ref(instance: mixed | null) {
|
||||
function ref(instance: unknown | null) {
|
||||
if (instance == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
export default function ensureInstance<T>(value: mixed, Class: Class<T>): T {
|
||||
export default function ensureInstance<T>(value: unknown, Class: Class<T>): T {
|
||||
if (!(value instanceof Class)) {
|
||||
// $FlowFixMe[incompatible-use]
|
||||
const className = Class.name;
|
||||
|
||||
@@ -51,7 +51,7 @@ let nativeEventEmitter;
|
||||
const waitingForQueuedOperations = new Set<string>();
|
||||
let queueOperations = false;
|
||||
const queue: Array<() => void> = [];
|
||||
const singleOpQueue: Array<mixed> = [];
|
||||
const singleOpQueue: Array<unknown> = [];
|
||||
|
||||
const isSingleOpBatching =
|
||||
Platform.OS === 'android' &&
|
||||
@@ -103,7 +103,7 @@ function createNativeOperations(): NonNullable<typeof NativeAnimatedModule> {
|
||||
methodNames.push('connectAnimatedNodeToShadowNodeFamily');
|
||||
}
|
||||
const nativeOperations: {
|
||||
[$Values<typeof methodNames>]: (...$ReadOnlyArray<mixed>) => void,
|
||||
[$Values<typeof methodNames>]: (...$ReadOnlyArray<unknown>) => void,
|
||||
} = {};
|
||||
if (isSingleOpBatching) {
|
||||
for (let ii = 0, length = methodNames.length; ii < length; ii++) {
|
||||
@@ -406,7 +406,7 @@ function assertNativeAnimatedModule(): void {
|
||||
let _warnedMissingNativeAnimated = false;
|
||||
|
||||
function shouldUseNativeDriver(
|
||||
config: $ReadOnly<{...AnimationConfig, ...}> | EventConfig<mixed>,
|
||||
config: $ReadOnly<{...AnimationConfig, ...}> | EventConfig<unknown>,
|
||||
): boolean {
|
||||
if (config.useNativeDriver == null) {
|
||||
console.warn(
|
||||
|
||||
+6
-6
@@ -18,8 +18,8 @@ describe('useAnimatedProps', () => {
|
||||
const useAnimatedProps = createAnimatedPropsHook(null);
|
||||
|
||||
const refs = [];
|
||||
function Sentinel(props: {[string]: mixed}): React.Node {
|
||||
const [, ref] = useAnimatedProps<{[string]: mixed}, mixed>(props);
|
||||
function Sentinel(props: {[string]: unknown}): React.Node {
|
||||
const [, ref] = useAnimatedProps<{[string]: unknown}, unknown>(props);
|
||||
useLayoutEffect(() => {
|
||||
refs.push(ref);
|
||||
}, [ref]);
|
||||
@@ -38,8 +38,8 @@ describe('useAnimatedProps', () => {
|
||||
const useAnimatedProps = createAnimatedPropsHook(null);
|
||||
|
||||
const refs = [];
|
||||
function Sentinel(props: {[string]: mixed}): React.Node {
|
||||
const [, ref] = useAnimatedProps<{[string]: mixed}, mixed>(props);
|
||||
function Sentinel(props: {[string]: unknown}): React.Node {
|
||||
const [, ref] = useAnimatedProps<{[string]: unknown}, unknown>(props);
|
||||
useLayoutEffect(() => {
|
||||
refs.push(ref);
|
||||
}, [ref]);
|
||||
@@ -60,8 +60,8 @@ describe('useAnimatedProps', () => {
|
||||
const useAnimatedProps = createAnimatedPropsHook(null);
|
||||
|
||||
const refs = [];
|
||||
function Sentinel(props: {[string]: mixed}): React.Node {
|
||||
const [, ref] = useAnimatedProps<{[string]: mixed}, mixed>(props);
|
||||
function Sentinel(props: {[string]: unknown}): React.Node {
|
||||
const [, ref] = useAnimatedProps<{[string]: unknown}, unknown>(props);
|
||||
useLayoutEffect(() => {
|
||||
refs.push(ref);
|
||||
}, [ref]);
|
||||
|
||||
@@ -34,7 +34,7 @@ type ReducedProps<TProps> = {
|
||||
collapsable: boolean,
|
||||
...
|
||||
};
|
||||
type CallbackRef<T> = T => mixed;
|
||||
type CallbackRef<T> = T => unknown;
|
||||
|
||||
export type AnimatedPropsHook = <TProps: {...}, TInstance>(
|
||||
props: TProps,
|
||||
|
||||
+10
-10
@@ -24,8 +24,8 @@ type CompositeKey = {
|
||||
[string]:
|
||||
| CompositeKeyComponent
|
||||
| AnimatedEvent
|
||||
| $ReadOnlyArray<mixed>
|
||||
| $ReadOnly<{[string]: mixed}>,
|
||||
| $ReadOnlyArray<unknown>
|
||||
| $ReadOnly<{[string]: unknown}>,
|
||||
};
|
||||
|
||||
type CompositeKeyComponent =
|
||||
@@ -38,8 +38,8 @@ type $ReadOnlyCompositeKey = $ReadOnly<{
|
||||
[string]:
|
||||
| $ReadOnlyCompositeKeyComponent
|
||||
| AnimatedEvent
|
||||
| $ReadOnlyArray<mixed>
|
||||
| $ReadOnly<{[string]: mixed}>,
|
||||
| $ReadOnlyArray<unknown>
|
||||
| $ReadOnly<{[string]: unknown}>,
|
||||
}>;
|
||||
|
||||
type $ReadOnlyCompositeKeyComponent =
|
||||
@@ -49,7 +49,7 @@ type $ReadOnlyCompositeKeyComponent =
|
||||
|
||||
type AnimatedPropsMemoHook = (
|
||||
() => AnimatedProps,
|
||||
props: $ReadOnly<{[string]: mixed}>,
|
||||
props: $ReadOnly<{[string]: unknown}>,
|
||||
) => AnimatedProps;
|
||||
|
||||
/**
|
||||
@@ -62,7 +62,7 @@ export function createAnimatedPropsMemoHook(
|
||||
): AnimatedPropsMemoHook {
|
||||
return function useAnimatedPropsMemo(
|
||||
create: () => AnimatedProps,
|
||||
props: $ReadOnly<{[string]: mixed}>,
|
||||
props: $ReadOnly<{[string]: unknown}>,
|
||||
): AnimatedProps {
|
||||
const compositeKey = useMemo(
|
||||
() => createCompositeKeyForProps(props, allowlist),
|
||||
@@ -107,7 +107,7 @@ export function createAnimatedPropsMemoHook(
|
||||
* returns null.
|
||||
*/
|
||||
export function createCompositeKeyForProps(
|
||||
props: $ReadOnly<{[string]: mixed}>,
|
||||
props: $ReadOnly<{[string]: unknown}>,
|
||||
allowlist: ?AnimatedPropsAllowlist,
|
||||
): $ReadOnlyCompositeKey | null {
|
||||
let compositeKey: CompositeKey | null = null;
|
||||
@@ -122,7 +122,7 @@ export function createCompositeKeyForProps(
|
||||
if (key === 'style') {
|
||||
// $FlowFixMe[incompatible-call] - `style` is a valid argument.
|
||||
// $FlowFixMe[incompatible-type] - `flattenStyle` returns an object.
|
||||
const flatStyle: ?{[string]: mixed} = flattenStyle(value);
|
||||
const flatStyle: ?{[string]: unknown} = flattenStyle(value);
|
||||
if (flatStyle != null) {
|
||||
compositeKeyComponent = createCompositeKeyForObject(
|
||||
flatStyle,
|
||||
@@ -160,7 +160,7 @@ export function createCompositeKeyForProps(
|
||||
* If `array` contains no `AnimatedNode` instances, this returns null.
|
||||
*/
|
||||
function createCompositeKeyForArray(
|
||||
array: $ReadOnlyArray<mixed>,
|
||||
array: $ReadOnlyArray<unknown>,
|
||||
): $ReadOnlyArray<$ReadOnlyCompositeKeyComponent | null> | null {
|
||||
let compositeKey: Array<$ReadOnlyCompositeKeyComponent | null> | null = null;
|
||||
|
||||
@@ -200,7 +200,7 @@ function createCompositeKeyForArray(
|
||||
* If `object` contains no `AnimatedNode` instances, this returns null.
|
||||
*/
|
||||
function createCompositeKeyForObject(
|
||||
object: $ReadOnly<{[string]: mixed}>,
|
||||
object: $ReadOnly<{[string]: unknown}>,
|
||||
allowlist?: ?AnimatedStyleAllowlist,
|
||||
): $ReadOnly<{[string]: $ReadOnlyCompositeKeyComponent}> | null {
|
||||
let compositeKey: {[string]: $ReadOnlyCompositeKeyComponent} | null = null;
|
||||
|
||||
+2
-2
@@ -297,7 +297,7 @@ describe('memory management', () => {
|
||||
* Helper to reduce duplication of the mock event payload.
|
||||
*/
|
||||
export function dispatchModeChangeEvent(
|
||||
instance: mixed,
|
||||
instance: unknown,
|
||||
mode: VirtualViewMode,
|
||||
): void {
|
||||
const targetRect = {
|
||||
@@ -373,7 +373,7 @@ function createWeakRefCallback<T: interface {} = interface {}>(): $ReadOnly<{
|
||||
/**
|
||||
* Gets the shadow node via `instance.__internalInstanceHandle.stateNode.node`.
|
||||
*/
|
||||
function getNodeAsObjectFromPublicInstance(instance: mixed): interface {} {
|
||||
function getNodeAsObjectFromPublicInstance(instance: unknown): interface {} {
|
||||
const node = getNodeFromPublicInstance(
|
||||
ensureInstance(instance, ReactNativeElement),
|
||||
);
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ type Props = $ReadOnly<{
|
||||
style?: ?ViewStyleProp,
|
||||
frame?: ?Object,
|
||||
selection?: ?number,
|
||||
setSelection?: number => mixed,
|
||||
setSelection?: number => unknown,
|
||||
}>;
|
||||
|
||||
class ElementProperties extends React.Component<Props> {
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ type Props = $ReadOnly<{
|
||||
setTouchTargeting: (val: boolean) => void,
|
||||
hierarchy?: ?ElementsHierarchy,
|
||||
selection?: ?number,
|
||||
setSelection: number => mixed,
|
||||
setSelection: number => unknown,
|
||||
inspected?: ?InspectedElement,
|
||||
}>;
|
||||
|
||||
|
||||
+7
-7
@@ -27,7 +27,7 @@ describe('Event Dispatching', () => {
|
||||
|
||||
let onPointerUpPriority;
|
||||
|
||||
const onPointerUp = jest.fn((event: mixed) => {
|
||||
const onPointerUp = jest.fn((event: unknown) => {
|
||||
onPointerUpPriority = UIManager.unstable_getCurrentEventPriority();
|
||||
});
|
||||
|
||||
@@ -57,7 +57,7 @@ describe('Event Dispatching', () => {
|
||||
|
||||
let onPointerMovePriority;
|
||||
|
||||
const onPointerMove = jest.fn((event: mixed) => {
|
||||
const onPointerMove = jest.fn((event: unknown) => {
|
||||
onPointerMovePriority = UIManager.unstable_getCurrentEventPriority();
|
||||
});
|
||||
|
||||
@@ -89,7 +89,7 @@ describe('Event Dispatching', () => {
|
||||
|
||||
let onPointerMovePriority;
|
||||
|
||||
const onPointerMove = jest.fn((event: mixed) => {
|
||||
const onPointerMove = jest.fn((event: unknown) => {
|
||||
onPointerMovePriority = UIManager.unstable_getCurrentEventPriority();
|
||||
});
|
||||
|
||||
@@ -123,10 +123,10 @@ describe('Event Dispatching', () => {
|
||||
let onPointerEnterPriority;
|
||||
let onPointerLeavePriority;
|
||||
|
||||
const onPointerEnter = jest.fn((event: mixed) => {
|
||||
const onPointerEnter = jest.fn((event: unknown) => {
|
||||
onPointerEnterPriority = UIManager.unstable_getCurrentEventPriority();
|
||||
});
|
||||
const onPointerLeave = jest.fn((event: mixed) => {
|
||||
const onPointerLeave = jest.fn((event: unknown) => {
|
||||
onPointerLeavePriority = UIManager.unstable_getCurrentEventPriority();
|
||||
});
|
||||
|
||||
@@ -180,7 +180,7 @@ describe('Event Dispatching', () => {
|
||||
const ref = React.createRef<React.ElementRef<typeof View>>();
|
||||
|
||||
let onPointerMovePriority;
|
||||
const onPointerMove = jest.fn((event: mixed) => {
|
||||
const onPointerMove = jest.fn((event: unknown) => {
|
||||
onPointerMovePriority = UIManager.unstable_getCurrentEventPriority();
|
||||
});
|
||||
|
||||
@@ -261,7 +261,7 @@ describe('Event Dispatching', () => {
|
||||
const ref = React.createRef<React.ElementRef<typeof View>>();
|
||||
|
||||
let onPointerMovePriority;
|
||||
const onPointerMove = jest.fn((event: mixed) => {
|
||||
const onPointerMove = jest.fn((event: unknown) => {
|
||||
onPointerMovePriority = UIManager.unstable_getCurrentEventPriority();
|
||||
});
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ type ErrorInfo = {
|
||||
};
|
||||
|
||||
function getExtendedError(
|
||||
errorValue: mixed,
|
||||
errorValue: unknown,
|
||||
errorInfo: ErrorInfo,
|
||||
): ExtendedError {
|
||||
let error;
|
||||
@@ -56,14 +56,17 @@ function getExtendedError(
|
||||
return error;
|
||||
}
|
||||
|
||||
export function onUncaughtError(errorValue: mixed, errorInfo: ErrorInfo): void {
|
||||
export function onUncaughtError(
|
||||
errorValue: unknown,
|
||||
errorInfo: ErrorInfo,
|
||||
): void {
|
||||
const error = getExtendedError(errorValue, errorInfo);
|
||||
|
||||
// Uncaught errors are fatal.
|
||||
ExceptionsManager.handleException(error, true);
|
||||
}
|
||||
|
||||
export function onCaughtError(errorValue: mixed, errorInfo: ErrorInfo): void {
|
||||
export function onCaughtError(errorValue: unknown, errorInfo: ErrorInfo): void {
|
||||
const error = getExtendedError(errorValue, errorInfo);
|
||||
|
||||
// Caught errors are not fatal.
|
||||
@@ -71,7 +74,7 @@ export function onCaughtError(errorValue: mixed, errorInfo: ErrorInfo): void {
|
||||
}
|
||||
|
||||
export function onRecoverableError(
|
||||
errorValue: mixed,
|
||||
errorValue: unknown,
|
||||
errorInfo: ErrorInfo,
|
||||
): void {
|
||||
const error = getExtendedError(errorValue, errorInfo);
|
||||
|
||||
@@ -83,29 +83,29 @@ interface Spec extends TurboModule {
|
||||
) => RootTag;
|
||||
stopSurface: (surfaceId: RootTag) => void;
|
||||
enqueueNativeEvent: (
|
||||
shadowNode: mixed /* ShadowNode */,
|
||||
shadowNode: unknown /* ShadowNode */,
|
||||
type: string,
|
||||
payload?: mixed,
|
||||
payload?: unknown,
|
||||
category?: NativeEventCategory,
|
||||
isUnique?: boolean,
|
||||
) => void;
|
||||
enqueueScrollEvent: (
|
||||
shadowNode: mixed /* ShadowNode */,
|
||||
shadowNode: unknown /* ShadowNode */,
|
||||
options: ScrollOptions,
|
||||
) => void;
|
||||
enqueueModalSizeUpdate: (
|
||||
shadowNode: mixed /* ShadowNode */,
|
||||
shadowNode: unknown /* ShadowNode */,
|
||||
height: number,
|
||||
width: number,
|
||||
) => void;
|
||||
takeMountingManagerLogs: (surfaceId: RootTag) => Array<string>;
|
||||
getDirectManipulationProps: (
|
||||
shadowNode: mixed /* ShadowNode */,
|
||||
shadowNode: unknown /* ShadowNode */,
|
||||
) => $ReadOnly<{
|
||||
[string]: mixed,
|
||||
[string]: unknown,
|
||||
}>;
|
||||
getFabricUpdateProps: (shadowNode: mixed /* ShadowNode */) => $ReadOnly<{
|
||||
[string]: mixed,
|
||||
getFabricUpdateProps: (shadowNode: unknown /* ShadowNode */) => $ReadOnly<{
|
||||
[string]: unknown,
|
||||
}>;
|
||||
flushMessageQueue: () => void;
|
||||
flushEventQueue: () => void;
|
||||
@@ -117,10 +117,10 @@ interface Spec extends TurboModule {
|
||||
) => string;
|
||||
reportTestSuiteResultsJSON: (results: string) => void;
|
||||
createShadowNodeReferenceCounter(
|
||||
shadowNode: mixed /* ShadowNode */,
|
||||
shadowNode: unknown /* ShadowNode */,
|
||||
): () => number;
|
||||
createShadowNodeRevisionGetter(
|
||||
shadowNode: mixed /* ShadowNode */,
|
||||
shadowNode: unknown /* ShadowNode */,
|
||||
): () => ?number;
|
||||
saveJSMemoryHeapSnapshot: (filePath: string) => void;
|
||||
forceHighResTimeStamp: (timeStamp: ?number) => void;
|
||||
|
||||
@@ -20,11 +20,11 @@ import type {EventInit} from './Event';
|
||||
import Event from './Event';
|
||||
|
||||
export interface CustomEventInit extends EventInit {
|
||||
+detail?: mixed;
|
||||
+detail?: unknown;
|
||||
}
|
||||
|
||||
export default class CustomEvent extends Event {
|
||||
_detail: mixed;
|
||||
_detail: unknown;
|
||||
|
||||
constructor(type: string, options?: ?CustomEventInit) {
|
||||
super(type, options);
|
||||
@@ -32,7 +32,7 @@ export default class CustomEvent extends Event {
|
||||
this._detail = options?.detail;
|
||||
}
|
||||
|
||||
get detail(): mixed {
|
||||
get detail(): unknown {
|
||||
return this._detail;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -28,7 +28,7 @@ import ReadOnlyNode from 'react-native/src/private/webapis/dom/nodes/ReadOnlyNod
|
||||
import HTMLCollection from 'react-native/src/private/webapis/dom/oldstylecollections/HTMLCollection';
|
||||
import NodeList from 'react-native/src/private/webapis/dom/oldstylecollections/NodeList';
|
||||
|
||||
function ensureReactNativeElement(value: mixed): ReactNativeElement {
|
||||
function ensureReactNativeElement(value: unknown): ReactNativeElement {
|
||||
return ensureInstance(value, ReactNativeElement);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -22,15 +22,15 @@ import ReactNativeElement from 'react-native/src/private/webapis/dom/nodes/React
|
||||
import ReadOnlyNode from 'react-native/src/private/webapis/dom/nodes/ReadOnlyNode';
|
||||
import ReadOnlyText from 'react-native/src/private/webapis/dom/nodes/ReadOnlyText';
|
||||
|
||||
function ensureReadOnlyText(value: mixed): ReadOnlyText {
|
||||
function ensureReadOnlyText(value: unknown): ReadOnlyText {
|
||||
return ensureInstance(value, ReadOnlyText);
|
||||
}
|
||||
|
||||
function ensureReadOnlyNode(value: mixed): ReadOnlyNode {
|
||||
function ensureReadOnlyNode(value: unknown): ReadOnlyNode {
|
||||
return ensureInstance(value, ReadOnlyNode);
|
||||
}
|
||||
|
||||
function ensureReactNativeElement(value: mixed): ReactNativeElement {
|
||||
function ensureReactNativeElement(value: unknown): ReactNativeElement {
|
||||
return ensureInstance(value, ReactNativeElement);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ export function setPublicInstanceForReactNativeDocumentElementInstanceHandle(
|
||||
}
|
||||
|
||||
export function isReactNativeDocumentElementInstanceHandle(
|
||||
instanceHandle: mixed,
|
||||
instanceHandle: unknown,
|
||||
): instanceHandle is ReactNativeDocumentElementInstanceHandle {
|
||||
return instanceHandle instanceof ReactNativeDocumentElementInstanceHandleImpl;
|
||||
}
|
||||
Vendored
+1
-1
@@ -36,7 +36,7 @@ export function getPublicInstanceFromReactNativeDocumentInstanceHandle(
|
||||
}
|
||||
|
||||
export function isReactNativeDocumentInstanceHandle(
|
||||
instanceHandle: mixed,
|
||||
instanceHandle: unknown,
|
||||
// $FlowExpectedError[incompatible-type-guard]
|
||||
): instanceHandle is ReactNativeDocumentInstanceHandle {
|
||||
// $FlowFixMe[incompatible-type-guard]
|
||||
|
||||
@@ -52,25 +52,25 @@ export interface Spec extends TurboModule {
|
||||
*/
|
||||
|
||||
+compareDocumentPosition: (
|
||||
nativeNodeReference: mixed /* NativeNodeReference */,
|
||||
otherNativeNodeReference: mixed /* NativeNodeReference */,
|
||||
nativeNodeReference: unknown /* NativeNodeReference */,
|
||||
otherNativeNodeReference: unknown /* NativeNodeReference */,
|
||||
) => number;
|
||||
|
||||
+getChildNodes: (
|
||||
nativeNodeReference: mixed /* NativeNodeReference */,
|
||||
) => $ReadOnlyArray<mixed> /* $ReadOnlyArray<InstanceHandle> */;
|
||||
nativeNodeReference: unknown /* NativeNodeReference */,
|
||||
) => $ReadOnlyArray<unknown> /* $ReadOnlyArray<InstanceHandle> */;
|
||||
|
||||
+getElementById?: (
|
||||
nativeNodeReference: mixed /* NativeNodeReference */,
|
||||
nativeNodeReference: unknown /* NativeNodeReference */,
|
||||
id: string,
|
||||
) => mixed /* ?InstanceHandle */;
|
||||
) => unknown /* ?InstanceHandle */;
|
||||
|
||||
+getParentNode: (
|
||||
nativeNodeReference: mixed /* NativeNodeReference */,
|
||||
) => mixed /* ?InstanceHandle */;
|
||||
nativeNodeReference: unknown /* NativeNodeReference */,
|
||||
) => unknown /* ?InstanceHandle */;
|
||||
|
||||
+isConnected: (
|
||||
nativeNodeReference: mixed /* NativeNodeReference */,
|
||||
nativeNodeReference: unknown /* NativeNodeReference */,
|
||||
) => boolean;
|
||||
|
||||
/*
|
||||
@@ -78,46 +78,46 @@ export interface Spec extends TurboModule {
|
||||
*/
|
||||
|
||||
+getBorderWidth: (
|
||||
nativeElementReference: mixed /* NativeElementReference */,
|
||||
nativeElementReference: unknown /* NativeElementReference */,
|
||||
) => $ReadOnlyArray<number> /* [topWidth: number, rightWidth: number, bottomWidth: number, leftWidth: number] */;
|
||||
|
||||
+getBoundingClientRect: (
|
||||
nativeElementReference: mixed /* NativeElementReference */,
|
||||
nativeElementReference: unknown /* NativeElementReference */,
|
||||
includeTransform: boolean,
|
||||
) => $ReadOnlyArray<number> /* [x: number, y: number, width: number, height: number] */;
|
||||
|
||||
+getInnerSize: (
|
||||
nativeElementReference: mixed /* NativeElementReference */,
|
||||
nativeElementReference: unknown /* NativeElementReference */,
|
||||
) => $ReadOnlyArray<number> /* [width: number, height: number] */;
|
||||
|
||||
+getScrollPosition: (
|
||||
nativeElementReference: mixed /* NativeElementReference */,
|
||||
nativeElementReference: unknown /* NativeElementReference */,
|
||||
) => $ReadOnlyArray<number> /* [scrollLeft: number, scrollTop: number] */;
|
||||
|
||||
+getScrollSize: (
|
||||
nativeElementReference: mixed /* NativeElementReference */,
|
||||
nativeElementReference: unknown /* NativeElementReference */,
|
||||
) => $ReadOnlyArray<number> /* [scrollWidth: number, scrollHeight: number] */;
|
||||
|
||||
+getTagName: (
|
||||
nativeElementReference: mixed /* NativeElementReference */,
|
||||
nativeElementReference: unknown /* NativeElementReference */,
|
||||
) => string;
|
||||
|
||||
+getTextContent: (
|
||||
nativeElementReference: mixed /* NativeElementReference */,
|
||||
nativeElementReference: unknown /* NativeElementReference */,
|
||||
) => string;
|
||||
|
||||
+hasPointerCapture: (
|
||||
nativeElementReference: mixed /* NativeElementReference */,
|
||||
nativeElementReference: unknown /* NativeElementReference */,
|
||||
pointerId: number,
|
||||
) => boolean;
|
||||
|
||||
+releasePointerCapture: (
|
||||
nativeElementReference: mixed /* NativeElementReference */,
|
||||
nativeElementReference: unknown /* NativeElementReference */,
|
||||
pointerId: number,
|
||||
) => void;
|
||||
|
||||
+setPointerCapture: (
|
||||
nativeElementReference: mixed /* NativeElementReference */,
|
||||
nativeElementReference: unknown /* NativeElementReference */,
|
||||
pointerId: number,
|
||||
) => void;
|
||||
|
||||
@@ -126,8 +126,8 @@ export interface Spec extends TurboModule {
|
||||
*/
|
||||
|
||||
+getOffset: (
|
||||
nativeElementReference: mixed /* NativeElementReference */,
|
||||
) => $ReadOnlyArray<mixed> /* [offsetParent: ?InstanceHandle, top: number, left: number] */;
|
||||
nativeElementReference: unknown /* NativeElementReference */,
|
||||
) => $ReadOnlyArray<unknown> /* [offsetParent: ?InstanceHandle, top: number, left: number] */;
|
||||
|
||||
/*
|
||||
* Special methods to handle the root node.
|
||||
@@ -135,26 +135,26 @@ export interface Spec extends TurboModule {
|
||||
|
||||
+linkRootNode?: (
|
||||
rootTag: number /* RootTag */,
|
||||
instanceHandle: mixed /* InstanceHandle */,
|
||||
) => mixed /* ?NativeElementReference */;
|
||||
instanceHandle: unknown /* InstanceHandle */,
|
||||
) => unknown /* ?NativeElementReference */;
|
||||
|
||||
/**
|
||||
* Legacy layout APIs (for `ReactNativeElement`).
|
||||
*/
|
||||
|
||||
+measure: (
|
||||
nativeElementReference: mixed,
|
||||
nativeElementReference: unknown,
|
||||
callback: MeasureOnSuccessCallback,
|
||||
) => void;
|
||||
|
||||
+measureInWindow: (
|
||||
nativeElementReference: mixed,
|
||||
nativeElementReference: unknown,
|
||||
callback: MeasureInWindowOnSuccessCallback,
|
||||
) => void;
|
||||
|
||||
+measureLayout: (
|
||||
nativeElementReference: mixed,
|
||||
relativeNode: mixed,
|
||||
nativeElementReference: unknown,
|
||||
relativeNode: unknown,
|
||||
onFail: () => void,
|
||||
onSuccess: MeasureLayoutOnSuccessCallback,
|
||||
) => void;
|
||||
@@ -164,8 +164,8 @@ export interface Spec extends TurboModule {
|
||||
*/
|
||||
|
||||
+setNativeProps: (
|
||||
nativeElementReference: mixed,
|
||||
updatePayload: mixed,
|
||||
nativeElementReference: unknown,
|
||||
updatePayload: unknown,
|
||||
) => void;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import {setPlatformObject} from '../../webidl/PlatformObjects';
|
||||
// IMPORTANT: The type definition for this module is defined in `HTMLCollection.js.flow`
|
||||
// because Flow only supports indexers in classes in declaration files.
|
||||
|
||||
const REUSABLE_PROPERTY_DESCRIPTOR: {...PropertyDescriptor<mixed>, ...} = {
|
||||
const REUSABLE_PROPERTY_DESCRIPTOR: {...PropertyDescriptor<unknown>, ...} = {
|
||||
value: {},
|
||||
enumerable: true,
|
||||
configurable: false,
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ import {setPlatformObject} from '../../webidl/PlatformObjects';
|
||||
// IMPORTANT: The Flow type definition for this module is defined in `NodeList.js.flow`
|
||||
// because Flow only supports indexers in classes in declaration files.
|
||||
|
||||
const REUSABLE_PROPERTY_DESCRIPTOR: {...PropertyDescriptor<mixed>, ...} = {
|
||||
const REUSABLE_PROPERTY_DESCRIPTOR: {...PropertyDescriptor<unknown>, ...} = {
|
||||
value: {},
|
||||
writable: false,
|
||||
};
|
||||
@@ -66,7 +66,7 @@ export default class NodeList<T> implements Iterable<T>, ArrayLike<T> {
|
||||
}
|
||||
|
||||
forEach<ThisType>(
|
||||
callbackFn: (value: T, index: number, array: NodeList<T>) => mixed,
|
||||
callbackFn: (value: T, index: number, array: NodeList<T>) => unknown,
|
||||
thisArg?: ThisType,
|
||||
): void {
|
||||
// assigning to the interface allows us to access the indexer property in a
|
||||
|
||||
@@ -21,7 +21,7 @@ declare export default class NodeList<+T> implements Iterable<T>, ArrayLike<T> {
|
||||
// $FlowFixMe[incompatible-variance]
|
||||
entries(): Iterator<[number, T]>;
|
||||
forEach<ThisType>(
|
||||
callbackFn: (value: T, index: number, array: NodeList<T>) => mixed,
|
||||
callbackFn: (value: T, index: number, array: NodeList<T>) => unknown,
|
||||
thisArg?: ThisType,
|
||||
): void;
|
||||
keys(): Iterator<number>;
|
||||
|
||||
Vendored
+2
-2
@@ -134,7 +134,7 @@ describe('NodeList', () => {
|
||||
const collection = createNodeList(['a', 'b', 'c']);
|
||||
|
||||
let i = 0;
|
||||
collection.forEach(function (this: mixed, value, index, list) {
|
||||
collection.forEach(function (this: unknown, value, index, list) {
|
||||
expect(value).toBe(collection[i]);
|
||||
expect(index).toBe(i);
|
||||
expect(list).toBe(collection);
|
||||
@@ -148,7 +148,7 @@ describe('NodeList', () => {
|
||||
|
||||
let i = 0;
|
||||
const explicitThis = {id: 'foo'};
|
||||
collection.forEach(function (this: mixed, value, index, list) {
|
||||
collection.forEach(function (this: unknown, value, index, list) {
|
||||
expect(value).toBe(collection[i]);
|
||||
expect(index).toBe(i);
|
||||
expect(list).toBe(collection);
|
||||
|
||||
@@ -25,7 +25,7 @@ export interface DOMRectInit {
|
||||
height?: ?number;
|
||||
}
|
||||
|
||||
function castToNumber(value: mixed): number {
|
||||
function castToNumber(value: unknown): number {
|
||||
return value ? Number(value) : 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import type {EventInit} from '../../dom/events/Event';
|
||||
import Event from '../../dom/events/Event';
|
||||
|
||||
export interface MessageEventInit extends EventInit {
|
||||
+data?: mixed;
|
||||
+data?: unknown;
|
||||
+origin?: string;
|
||||
+lastEventId?: string;
|
||||
// Unsupported
|
||||
@@ -30,7 +30,7 @@ export interface MessageEventInit extends EventInit {
|
||||
}
|
||||
|
||||
export default class MessageEvent extends Event {
|
||||
_data: mixed;
|
||||
_data: unknown;
|
||||
_origin: string;
|
||||
_lastEventId: string;
|
||||
|
||||
@@ -42,7 +42,7 @@ export default class MessageEvent extends Event {
|
||||
this._lastEventId = String(options?.lastEventId ?? '');
|
||||
}
|
||||
|
||||
get data(): mixed {
|
||||
get data(): unknown {
|
||||
return this._data;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -12,7 +12,7 @@ import type {TurboModule} from '../../../../../Libraries/TurboModule/RCTExport';
|
||||
|
||||
import * as TurboModuleRegistry from '../../../../../Libraries/TurboModule/TurboModuleRegistry';
|
||||
|
||||
export opaque type IdleCallbackID = mixed;
|
||||
export opaque type IdleCallbackID = unknown;
|
||||
|
||||
export type RequestIdleCallbackOptions = {
|
||||
timeout?: number,
|
||||
@@ -20,12 +20,12 @@ export type RequestIdleCallbackOptions = {
|
||||
|
||||
export type IdleDeadline = {
|
||||
didTimeout: boolean,
|
||||
timeRemaining: () => mixed,
|
||||
timeRemaining: () => unknown,
|
||||
};
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
+requestIdleCallback: (
|
||||
callback: (idleDeadline: IdleDeadline) => mixed,
|
||||
callback: (idleDeadline: IdleDeadline) => unknown,
|
||||
options?: RequestIdleCallbackOptions,
|
||||
) => IdleCallbackID;
|
||||
+cancelIdleCallback: (handle: IdleCallbackID) => void;
|
||||
|
||||
+5
-5
@@ -20,7 +20,7 @@ import * as IntersectionObserverManager from './internals/IntersectionObserverMa
|
||||
export type IntersectionObserverCallback = (
|
||||
entries: Array<IntersectionObserverEntry>,
|
||||
observer: IntersectionObserver,
|
||||
) => mixed;
|
||||
) => unknown;
|
||||
|
||||
export interface IntersectionObserverInit {
|
||||
root?: ?ReactNativeElement;
|
||||
@@ -315,7 +315,7 @@ setPlatformObject(IntersectionObserver);
|
||||
* normalizeThresholds([], true); // → []
|
||||
*/
|
||||
function normalizeThreshold(
|
||||
threshold: mixed,
|
||||
threshold: unknown,
|
||||
defaultEmpty: boolean = false,
|
||||
): $ReadOnlyArray<number> {
|
||||
if (Array.isArray(threshold)) {
|
||||
@@ -353,7 +353,7 @@ function normalizeThreshold(
|
||||
* normalizeRootThresholds([null, null]); // → null
|
||||
*/
|
||||
function normalizeRootThreshold(
|
||||
rootThreshold: mixed,
|
||||
rootThreshold: unknown,
|
||||
): null | $ReadOnlyArray<number> {
|
||||
if (Array.isArray(rootThreshold)) {
|
||||
const normalizedArr = rootThreshold
|
||||
@@ -368,7 +368,7 @@ function normalizeRootThreshold(
|
||||
}
|
||||
|
||||
function normalizeThresholdValue(
|
||||
threshold: mixed,
|
||||
threshold: unknown,
|
||||
property: string,
|
||||
): null | number {
|
||||
if (threshold == null) {
|
||||
@@ -399,7 +399,7 @@ function normalizeThresholdValue(
|
||||
* Per W3C spec, rootMargin must be specified in pixels or percent.
|
||||
* This implementation validates the basic format.
|
||||
*/
|
||||
function normalizeRootMargin(rootMargin: mixed): string {
|
||||
function normalizeRootMargin(rootMargin: unknown): string {
|
||||
if (rootMargin == null || rootMargin === '') {
|
||||
return '0px 0px 0px 0px';
|
||||
}
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ declare const IntersectionObserver: Class<IntersectionObserverType>;
|
||||
|
||||
setUpIntersectionObserver();
|
||||
|
||||
function ensureReactNativeElement(value: mixed): ReactNativeElement {
|
||||
function ensureReactNativeElement(value: unknown): ReactNativeElement {
|
||||
return ensureInstance(value, ReactNativeElement);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -53,7 +53,7 @@ const instanceHandleToTargetMap: WeakMap<interface {}, ReactNativeElement> =
|
||||
new WeakMap();
|
||||
|
||||
function getTargetFromInstanceHandle(
|
||||
instanceHandle: mixed,
|
||||
instanceHandle: unknown,
|
||||
): ?ReactNativeElement {
|
||||
// $FlowExpectedError[incompatible-type] instanceHandle is typed as mixed but we know it's an object and we need it to be to use it as a key in a WeakMap.
|
||||
const key: interface {} = instanceHandle;
|
||||
@@ -61,7 +61,7 @@ function getTargetFromInstanceHandle(
|
||||
}
|
||||
|
||||
function setTargetForInstanceHandle(
|
||||
instanceHandle: mixed,
|
||||
instanceHandle: unknown,
|
||||
target: ReactNativeElement,
|
||||
): void {
|
||||
// $FlowExpectedError[incompatible-type] instanceHandle is typed as mixed but we know it's an object and we need it to be to use it as a key in a WeakMap.
|
||||
|
||||
Vendored
+4
-4
@@ -14,7 +14,7 @@ import * as TurboModuleRegistry from '../../../../../Libraries/TurboModule/Turbo
|
||||
|
||||
export type NativeIntersectionObserverEntry = {
|
||||
intersectionObserverId: number,
|
||||
targetInstanceHandle: mixed,
|
||||
targetInstanceHandle: unknown,
|
||||
targetRect: $ReadOnlyArray<number>, // It's actually a tuple with x, y, width and height
|
||||
rootRect: $ReadOnlyArray<number>, // It's actually a tuple with x, y, width and height
|
||||
// TODO(T209328432) - Remove optionality of intersectionRect when native changes are released
|
||||
@@ -25,14 +25,14 @@ export type NativeIntersectionObserverEntry = {
|
||||
|
||||
export type NativeIntersectionObserverObserveOptions = {
|
||||
intersectionObserverId: number,
|
||||
rootShadowNode?: ?mixed,
|
||||
targetShadowNode: mixed,
|
||||
rootShadowNode?: ?unknown,
|
||||
targetShadowNode: unknown,
|
||||
thresholds: $ReadOnlyArray<number>,
|
||||
rootThresholds?: ?$ReadOnlyArray<number>,
|
||||
rootMargin?: ?string,
|
||||
};
|
||||
|
||||
export opaque type NativeIntersectionObserverToken = mixed;
|
||||
export opaque type NativeIntersectionObserverToken = unknown;
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
+observeV2?: (
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import type {TurboModule} from '../../../../../Libraries/TurboModule/RCTExport';
|
||||
import * as TurboModuleRegistry from '../../../../../Libraries/TurboModule/TurboModuleRegistry';
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
+queueMicrotask: (callback: () => mixed) => void;
|
||||
+queueMicrotask: (callback: () => unknown) => void;
|
||||
}
|
||||
|
||||
export default (TurboModuleRegistry.getEnforcing<Spec>(
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ import * as MutationObserverManager from './internals/MutationObserverManager';
|
||||
export type MutationObserverCallback = (
|
||||
mutationRecords: $ReadOnlyArray<MutationRecord>,
|
||||
observer: MutationObserver,
|
||||
) => mixed;
|
||||
) => unknown;
|
||||
|
||||
export interface MutationObserverInit {
|
||||
+subtree?: boolean;
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ export default class MutationRecord {
|
||||
return null;
|
||||
}
|
||||
|
||||
get oldValue(): mixed | null {
|
||||
get oldValue(): unknown | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+4
-4
@@ -29,14 +29,14 @@ declare const MutationRecord: Class<MutationRecordType>;
|
||||
|
||||
setUpMutationObserver();
|
||||
|
||||
function ensureReactNativeElement(value: mixed): ReactNativeElement {
|
||||
function ensureReactNativeElement(value: unknown): ReactNativeElement {
|
||||
return ensureInstance(value, ReactNativeElement);
|
||||
}
|
||||
|
||||
function ensureMutationRecordArray(
|
||||
value: mixed,
|
||||
value: unknown,
|
||||
): $ReadOnlyArray<MutationRecord> {
|
||||
return ensureInstance(value, Array).map((element: mixed) =>
|
||||
return ensureInstance(value, Array).map((element: unknown) =>
|
||||
ensureInstance(element, MutationRecord),
|
||||
);
|
||||
}
|
||||
@@ -239,7 +239,7 @@ describe('MutationObserver', () => {
|
||||
const node = ensureReactNativeElement(nodeRef.current);
|
||||
|
||||
const observerCallbackCallArgs = [];
|
||||
const observerCallback = (...args: $ReadOnlyArray<mixed>) => {
|
||||
const observerCallback = (...args: $ReadOnlyArray<unknown>) => {
|
||||
observerCallbackCallArgs.push(args);
|
||||
};
|
||||
const observer = new MutationObserver(observerCallback);
|
||||
|
||||
+4
-4
@@ -15,10 +15,10 @@ import * as TurboModuleRegistry from '../../../../../Libraries/TurboModule/Turbo
|
||||
export type MutationObserverId = number;
|
||||
|
||||
// These types are not supported by the codegen.
|
||||
type ShadowNode = mixed;
|
||||
type InstanceHandle = mixed;
|
||||
type ReactNativeElement = mixed;
|
||||
type ReadOnlyNode = mixed;
|
||||
type ShadowNode = unknown;
|
||||
type InstanceHandle = unknown;
|
||||
type ReactNativeElement = unknown;
|
||||
type ReadOnlyNode = unknown;
|
||||
|
||||
export type NativeMutationRecord = {
|
||||
mutationObserverId: MutationObserverId,
|
||||
|
||||
@@ -240,7 +240,7 @@ export default class Performance {
|
||||
let resolvedMeasureName: string;
|
||||
let resolvedStartTime: number;
|
||||
let resolvedDuration: number;
|
||||
let resolvedDetail: mixed;
|
||||
let resolvedDetail: unknown;
|
||||
|
||||
if (measureName === undefined) {
|
||||
throw new TypeError(
|
||||
|
||||
@@ -22,7 +22,7 @@ import {getCurrentTimeStamp} from './internals/Utilities';
|
||||
import {PerformanceEntry} from './PerformanceEntry';
|
||||
|
||||
export type DetailType =
|
||||
| mixed
|
||||
| unknown
|
||||
// This will effectively ignored by Flow (mixed | anything = mixed)
|
||||
// but we'll use it as documentation for how to use the extensibility API.
|
||||
| {devtools?: ExtensionMarkerPayload | ExtensionTrackEntryPayload, ...};
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ function sleep(ms: number) {
|
||||
while (performance.now() < end) {}
|
||||
}
|
||||
|
||||
function ensurePerformanceEventTiming(value: mixed): PerformanceEventTiming {
|
||||
function ensurePerformanceEventTiming(value: unknown): PerformanceEventTiming {
|
||||
if (!(value instanceof PerformanceEventTiming)) {
|
||||
throw new Error(
|
||||
`Expected instance of PerformanceEventTiming but got ${String(value)}`,
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ import type {PerformanceObserverCallbackOptions} from '../PerformanceObserver';
|
||||
import * as Fantom from '@react-native/fantom';
|
||||
|
||||
function ensurePerformanceLongTaskTiming(
|
||||
value: mixed,
|
||||
value: unknown,
|
||||
): PerformanceLongTaskTiming {
|
||||
if (!(value instanceof PerformanceLongTaskTiming)) {
|
||||
throw new Error(
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@ import ensureInstance from '../../../__tests__/utilities/ensureInstance';
|
||||
import DOMException from '../../errors/DOMException';
|
||||
import * as Fantom from '@react-native/fantom';
|
||||
|
||||
function getThrownError(fn: () => mixed): mixed {
|
||||
function getThrownError(fn: () => unknown): unknown {
|
||||
try {
|
||||
fn();
|
||||
} catch (e) {
|
||||
@@ -23,7 +23,7 @@ function getThrownError(fn: () => mixed): mixed {
|
||||
throw new Error('Expected function to throw');
|
||||
}
|
||||
|
||||
function toJSON(entries: PerformanceEntryList): Array<mixed> {
|
||||
function toJSON(entries: PerformanceEntryList): Array<unknown> {
|
||||
return entries.map(entry => entry.toJSON());
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -42,7 +42,7 @@ export type RawPerformanceEntry = {
|
||||
decodedBodySize?: number,
|
||||
};
|
||||
|
||||
export opaque type OpaqueNativeObserverHandle = mixed;
|
||||
export opaque type OpaqueNativeObserverHandle = unknown;
|
||||
|
||||
export type NativeBatchedObserverCallback = () => void;
|
||||
export type NativePerformanceMarkResult = number;
|
||||
@@ -59,12 +59,12 @@ export interface Spec extends TurboModule {
|
||||
+now: () => number;
|
||||
+timeOrigin?: () => number;
|
||||
|
||||
+reportMark: (name: string, startTime: number, entry: mixed) => void;
|
||||
+reportMark: (name: string, startTime: number, entry: unknown) => void;
|
||||
+reportMeasure: (
|
||||
name: string,
|
||||
startTime: number,
|
||||
duration: number,
|
||||
entry: mixed,
|
||||
entry: unknown,
|
||||
) => void;
|
||||
+getMarkTime: (name: string) => ?number;
|
||||
+clearMarks: (entryName?: string) => void;
|
||||
|
||||
Vendored
+4
-4
@@ -30,7 +30,7 @@ import structuredClone from 'react-native/src/private/webapis/structuredClone/st
|
||||
setUpIntersectionObserver();
|
||||
setUpMutationObserver();
|
||||
|
||||
function expectDataCloneError(fn: () => mixed) {
|
||||
function expectDataCloneError(fn: () => unknown) {
|
||||
try {
|
||||
fn();
|
||||
} catch (error) {
|
||||
@@ -284,7 +284,7 @@ describe('structuredClone', () => {
|
||||
});
|
||||
|
||||
it('handles circular references', () => {
|
||||
const obj: {arr: Array<mixed>} = {arr: []};
|
||||
const obj: {arr: Array<unknown>} = {arr: []};
|
||||
obj.arr.push(obj);
|
||||
const map = new Map<string, interface {}>();
|
||||
map.set('key', map);
|
||||
@@ -389,7 +389,7 @@ describe('structuredClone', () => {
|
||||
});
|
||||
expect(ref.current).not.toBe(null);
|
||||
|
||||
const entries: Array<mixed> = [];
|
||||
const entries: Array<unknown> = [];
|
||||
Fantom.runTask(() => {
|
||||
const observer = new IntersectionObserver((e, self) => {
|
||||
entries.push(...e);
|
||||
@@ -418,7 +418,7 @@ describe('structuredClone', () => {
|
||||
});
|
||||
expect(ref.current).not.toBe(null);
|
||||
|
||||
const records: Array<mixed> = [];
|
||||
const records: Array<unknown> = [];
|
||||
Fantom.runTask(() => {
|
||||
const observer = new MutationObserver(e => {
|
||||
records.push(...e);
|
||||
|
||||
+3
-3
@@ -33,7 +33,7 @@ const ObjectPrototype = Object.prototype;
|
||||
// and avoid allocating a new one in every call to `structuredClone`.
|
||||
// This is safe because we don't invoke user code in `structuredClone`, so at
|
||||
// any given point we only have one memory object alive anyway.
|
||||
const memory: Map<mixed, mixed> = new Map();
|
||||
const memory: Map<unknown, unknown> = new Map();
|
||||
|
||||
function structuredCloneInternal<T>(value: T): T {
|
||||
// Handles `null` and `undefined`.
|
||||
@@ -105,7 +105,7 @@ function structuredCloneInternal<T>(value: T): T {
|
||||
}
|
||||
|
||||
if (value instanceof Map) {
|
||||
const result = new Map<mixed, mixed>();
|
||||
const result = new Map<unknown, unknown>();
|
||||
memory.set(value, result);
|
||||
|
||||
for (const [innerKey, innerValue] of value) {
|
||||
@@ -120,7 +120,7 @@ function structuredCloneInternal<T>(value: T): T {
|
||||
}
|
||||
|
||||
if (value instanceof Set) {
|
||||
const result = new Set<mixed>();
|
||||
const result = new Set<unknown>();
|
||||
memory.set(value, result);
|
||||
|
||||
for (const innerValue of value) {
|
||||
|
||||
@@ -24,7 +24,7 @@ type SnapshotReadyEvent = NativeSyntheticEvent<
|
||||
|
||||
type NativeProps = $ReadOnly<{
|
||||
...ViewProps,
|
||||
onSnapshotReady?: ?(event: SnapshotReadyEvent) => mixed,
|
||||
onSnapshotReady?: ?(event: SnapshotReadyEvent) => unknown,
|
||||
testIdentifier?: ?string,
|
||||
}>;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import {Pressable, StyleSheet, Text, View} from 'react-native';
|
||||
type Props = $ReadOnly<{
|
||||
testID?: ?string,
|
||||
label: string,
|
||||
onPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPress?: ?(event: GestureResponderEvent) => unknown,
|
||||
selected?: ?boolean,
|
||||
multiSelect?: ?boolean,
|
||||
disabled?: ?boolean,
|
||||
|
||||
@@ -18,12 +18,12 @@ type ViewStyleProp = React.ElementConfig<typeof View>['style'];
|
||||
type Props = {
|
||||
accessibilityLabel?: ?string,
|
||||
testID?: ?string,
|
||||
onPressIn?: ?() => mixed,
|
||||
onPressOut?: ?() => mixed,
|
||||
onPressIn?: ?() => unknown,
|
||||
onPressOut?: ?() => unknown,
|
||||
children?: ?React.Node,
|
||||
title: string,
|
||||
description?: ?string,
|
||||
onPress: () => mixed,
|
||||
onPress: () => unknown,
|
||||
style?: ViewStyleProp | ((pressed: boolean) => ViewStyleProp),
|
||||
};
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ type Props = $ReadOnly<{
|
||||
testID?: string,
|
||||
textTestID?: string,
|
||||
children?: React.Node,
|
||||
onPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPress?: ?(event: GestureResponderEvent) => unknown,
|
||||
}>;
|
||||
|
||||
function RNTesterButton(props: Props): React.Node {
|
||||
|
||||
@@ -16,7 +16,7 @@ const {StyleSheet, Text, TouchableOpacity, View} = require('react-native');
|
||||
const filters = ['Basic', 'UI', 'ListView', 'iOS', 'Android'];
|
||||
|
||||
type Props = {
|
||||
onFilterButtonPress: (filter: string) => mixed, //optional only for testing
|
||||
onFilterButtonPress: (filter: string) => unknown, //optional only for testing
|
||||
...
|
||||
};
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ const RNTesterExampleFilter = require('./RNTesterExampleFilter');
|
||||
type Props = {
|
||||
module: RNTesterModule,
|
||||
example?: ?RNTesterModuleExample,
|
||||
onExampleCardPress?: ?(exampleName: string) => mixed,
|
||||
onExampleCardPress?: ?(exampleName: string) => unknown,
|
||||
};
|
||||
|
||||
function getExampleTitle(title: $FlowFixMe, platform: $FlowFixMe) {
|
||||
|
||||
@@ -1508,7 +1508,7 @@ class EnabledExample extends React.Component<
|
||||
isEnabled: false,
|
||||
};
|
||||
_subscription: EventSubscription;
|
||||
componentDidMount(): null | Promise<mixed> {
|
||||
componentDidMount(): null | Promise<unknown> {
|
||||
this._subscription = AccessibilityInfo.addEventListener(
|
||||
this.props.eventListener,
|
||||
this._handleToggled,
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ export type PlatformTestResult = $ReadOnly<{
|
||||
name: string,
|
||||
status: PlatformTestResultStatus,
|
||||
assertions: $ReadOnlyArray<PlatformTestAssertionResult>,
|
||||
error: mixed | null, // null is technically unnecessary but is kept to ensure the error is described as nullable
|
||||
error: unknown | null, // null is technically unnecessary but is kept to ensure the error is described as nullable
|
||||
}>;
|
||||
|
||||
export type PlatformTestContext = $ReadOnly<{
|
||||
|
||||
@@ -107,7 +107,7 @@ class FlatListExample extends React.PureComponent<Props, State> {
|
||||
this.setState({filterText});
|
||||
};
|
||||
|
||||
_onChangeScrollToIndex = (text: mixed) => {
|
||||
_onChangeScrollToIndex = (text: unknown) => {
|
||||
this._listRef?.scrollToIndex({viewPosition: 0.5, index: Number(text)});
|
||||
};
|
||||
|
||||
@@ -298,7 +298,7 @@ class FlatListExample extends React.PureComponent<Props, State> {
|
||||
</RNTesterPage>
|
||||
);
|
||||
}
|
||||
_captureRef = (ref: FlatList<mixed> | null) => {
|
||||
_captureRef = (ref: FlatList<unknown> | null) => {
|
||||
this._listRef = ref;
|
||||
};
|
||||
// $FlowFixMe[missing-local-annot]
|
||||
@@ -422,7 +422,7 @@ class FlatListExample extends React.PureComponent<Props, State> {
|
||||
}));
|
||||
};
|
||||
|
||||
_listRef: FlatList<mixed> | null;
|
||||
_listRef: FlatList<unknown> | null;
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
|
||||
@@ -42,7 +42,7 @@ function MultiColumnExample(): React.Node {
|
||||
const _onChangeFilterText = (_filterText: string) => {
|
||||
setFilterText(_filterText);
|
||||
};
|
||||
const _onChangeNumColumns = (_numColumns: mixed) => {
|
||||
const _onChangeNumColumns = (_numColumns: unknown) => {
|
||||
setNumColumns(Number(_numColumns));
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ export function render(): React.Node {
|
||||
/**
|
||||
* Showcase threshold of two overlapping elements
|
||||
*/
|
||||
function roundRect(rect: mixed): ?{
|
||||
function roundRect(rect: unknown): ?{
|
||||
x: number,
|
||||
y: number,
|
||||
width: number,
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ export function render(): React.Node {
|
||||
return <IntersectionObserverClippingRootExample />;
|
||||
}
|
||||
|
||||
function roundRect(rect: mixed): ?{
|
||||
function roundRect(rect: unknown): ?{
|
||||
x: number,
|
||||
y: number,
|
||||
width: number,
|
||||
|
||||
Loaded 100 of 131 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user