diff --git a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap index fff3ba1b671..e932154065a 100644 --- a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap +++ b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap @@ -9460,10 +9460,10 @@ exports[`public API should not change unintentionally src/private/webapis/inters entries: Array, observer: IntersectionObserver ) => mixed; -type IntersectionObserverInit = { - threshold?: number | $ReadOnlyArray, - rnRootThreshold?: number | $ReadOnlyArray, -}; +export interface IntersectionObserverInit { + threshold?: number | $ReadOnlyArray; + rnRootThreshold?: number | $ReadOnlyArray; +} declare export default class IntersectionObserver { constructor( callback: IntersectionObserverCallback, @@ -9507,15 +9507,15 @@ exports[`public API should not change unintentionally src/private/webapis/mutati mutationRecords: $ReadOnlyArray, observer: MutationObserver ) => mixed; -type MutationObserverInit = $ReadOnly<{ - subtree?: boolean, - childList: true, - attributes?: boolean, - attributeFilter?: $ReadOnlyArray, - attributeOldValue?: boolean, - characterData?: boolean, - characterDataOldValue?: boolean, -}>; +export interface MutationObserverInit { + +subtree?: boolean; + +childList: true; + +attributes?: boolean; + +attributeFilter?: $ReadOnlyArray; + +attributeOldValue?: boolean; + +characterData?: boolean; + +characterDataOldValue?: boolean; +} declare export default class MutationObserver { constructor(callback: MutationObserverCallback): void; observe(target: ReactNativeElement, options?: MutationObserverInit): void; @@ -9687,12 +9687,12 @@ export type PerformanceObserverCallback = ( observer: PerformanceObserver, options?: PerformanceObserverCallbackOptions ) => void; -export type PerformanceObserverInit = { - entryTypes?: Array, - type?: PerformanceEntryType, - buffered?: boolean, - durationThreshold?: DOMHighResTimeStamp, -}; +export interface PerformanceObserverInit { + +entryTypes?: Array; + +type?: PerformanceEntryType; + +buffered?: boolean; + +durationThreshold?: DOMHighResTimeStamp; +} declare export class PerformanceObserver { constructor(callback: PerformanceObserverCallback): void; observe(options: PerformanceObserverInit): void; diff --git a/packages/react-native/src/private/webapis/intersectionobserver/IntersectionObserver.js b/packages/react-native/src/private/webapis/intersectionobserver/IntersectionObserver.js index d7dd8742c72..b62d8d1a1ed 100644 --- a/packages/react-native/src/private/webapis/intersectionobserver/IntersectionObserver.js +++ b/packages/react-native/src/private/webapis/intersectionobserver/IntersectionObserver.js @@ -21,10 +21,10 @@ export type IntersectionObserverCallback = ( observer: IntersectionObserver, ) => mixed; -type IntersectionObserverInit = { +export interface IntersectionObserverInit { // root?: ReactNativeElement, // This option exists on the Web but it's not currently supported in React Native. // rootMargin?: string, // This option exists on the Web but it's not currently supported in React Native. - threshold?: number | $ReadOnlyArray, + threshold?: number | $ReadOnlyArray; /** * This is a React Native specific option (not spec compliant) that specifies @@ -36,8 +36,8 @@ type IntersectionObserverInit = { * Note: If `rnRootThreshold` is set, and `threshold` is not set, * `threshold` will not default to [0] (as per spec) */ - rnRootThreshold?: number | $ReadOnlyArray, -}; + rnRootThreshold?: number | $ReadOnlyArray; +} /** * The [Intersection Observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API) diff --git a/packages/react-native/src/private/webapis/mutationobserver/MutationObserver.js b/packages/react-native/src/private/webapis/mutationobserver/MutationObserver.js index 0717abc9eb1..17a5b26dd21 100644 --- a/packages/react-native/src/private/webapis/mutationobserver/MutationObserver.js +++ b/packages/react-native/src/private/webapis/mutationobserver/MutationObserver.js @@ -21,18 +21,18 @@ export type MutationObserverCallback = ( observer: MutationObserver, ) => mixed; -type MutationObserverInit = $ReadOnly<{ - subtree?: boolean, +export interface MutationObserverInit { + +subtree?: boolean; // This is the only supported option so it's required to be `true`. - childList: true, + +childList: true; // Unsupported: - attributes?: boolean, - attributeFilter?: $ReadOnlyArray, - attributeOldValue?: boolean, - characterData?: boolean, - characterDataOldValue?: boolean, -}>; + +attributes?: boolean; + +attributeFilter?: $ReadOnlyArray; + +attributeOldValue?: boolean; + +characterData?: boolean; + +characterDataOldValue?: boolean; +} /** * This is a React Native implementation for the `MutationObserver` API diff --git a/packages/react-native/src/private/webapis/performance/PerformanceObserver.js b/packages/react-native/src/private/webapis/performance/PerformanceObserver.js index ea3814d085b..30b902fbb80 100644 --- a/packages/react-native/src/private/webapis/performance/PerformanceObserver.js +++ b/packages/react-native/src/private/webapis/performance/PerformanceObserver.js @@ -66,12 +66,12 @@ export type PerformanceObserverCallback = ( options?: PerformanceObserverCallbackOptions, ) => void; -export type PerformanceObserverInit = { - entryTypes?: Array, - type?: PerformanceEntryType, - buffered?: boolean, - durationThreshold?: DOMHighResTimeStamp, -}; +export interface PerformanceObserverInit { + +entryTypes?: Array; + +type?: PerformanceEntryType; + +buffered?: boolean; + +durationThreshold?: DOMHighResTimeStamp; +} function getSupportedPerformanceEntryTypes(): $ReadOnlyArray { if (!NativePerformance) {