@@ -2649,7 +2649,7 @@ function addEventListenerToChild(
2649
2649
listener : EventListener ,
2650
2650
optionsOrUseCapture ?: EventListenerOptionsOrUseCapture ,
2651
2651
) : boolean {
2652
- const instance = getInstanceFromHostFiber ( child ) ;
2652
+ const instance = getInstanceFromHostFiber < Instance > ( child ) ;
2653
2653
instance . addEventListener ( type , listener , optionsOrUseCapture ) ;
2654
2654
return false ;
2655
2655
}
@@ -2689,7 +2689,7 @@ function removeEventListenerFromChild(
2689
2689
listener : EventListener ,
2690
2690
optionsOrUseCapture ?: EventListenerOptionsOrUseCapture ,
2691
2691
) : boolean {
2692
- const instance = getInstanceFromHostFiber ( child ) ;
2692
+ const instance = getInstanceFromHostFiber < Instance > ( child ) ;
2693
2693
instance . removeEventListener ( type , listener , optionsOrUseCapture ) ;
2694
2694
return false ;
2695
2695
}
@@ -2708,7 +2708,7 @@ function setFocusOnFiberIfFocusable(
2708
2708
fiber : Fiber ,
2709
2709
focusOptions ?: FocusOptions ,
2710
2710
) : boolean {
2711
- const instance = getInstanceFromHostFiber ( fiber ) ;
2711
+ const instance = getInstanceFromHostFiber < Instance > ( fiber ) ;
2712
2712
return setFocusIfFocusable ( instance , focusOptions ) ;
2713
2713
}
2714
2714
// $FlowFixMe[prop-missing]
@@ -2740,7 +2740,7 @@ FragmentInstance.prototype.blur = function (this: FragmentInstanceType): void {
2740
2740
} ;
2741
2741
function blurActiveElementWithinFragment ( child : Fiber ) : boolean {
2742
2742
// TODO: We can get the activeElement from the parent outside of the loop when we have a reference.
2743
- const instance = getInstanceFromHostFiber ( child ) ;
2743
+ const instance = getInstanceFromHostFiber < Instance > ( child ) ;
2744
2744
const ownerDocument = instance . ownerDocument ;
2745
2745
if ( instance === ownerDocument . activeElement ) {
2746
2746
// $FlowFixMe[prop-missing]
@@ -2764,7 +2764,7 @@ function observeChild(
2764
2764
child : Fiber ,
2765
2765
observer : IntersectionObserver | ResizeObserver ,
2766
2766
) {
2767
- const instance = getInstanceFromHostFiber ( child ) ;
2767
+ const instance = getInstanceFromHostFiber < Instance > ( child ) ;
2768
2768
observer . observe ( instance ) ;
2769
2769
return false ;
2770
2770
}
@@ -2789,7 +2789,7 @@ function unobserveChild(
2789
2789
child : Fiber ,
2790
2790
observer : IntersectionObserver | ResizeObserver ,
2791
2791
) {
2792
- const instance = getInstanceFromHostFiber ( child ) ;
2792
+ const instance = getInstanceFromHostFiber < Instance > ( child ) ;
2793
2793
observer . unobserve ( instance ) ;
2794
2794
return false ;
2795
2795
}
@@ -2802,7 +2802,7 @@ FragmentInstance.prototype.getClientRects = function (
2802
2802
return rects ;
2803
2803
} ;
2804
2804
function collectClientRects(child: Fiber, rects: Array< DOMRect > ): boolean {
2805
- const instance = getInstanceFromHostFiber ( child ) ;
2805
+ const instance = getInstanceFromHostFiber < Instance > ( child ) ;
2806
2806
// $FlowFixMe[method-unbinding]
2807
2807
rects . push . apply ( rects , instance . getClientRects ( ) ) ;
2808
2808
return false ;
@@ -2816,7 +2816,8 @@ FragmentInstance.prototype.getRootNode = function (
2816
2816
if ( parentHostFiber === null ) {
2817
2817
return this ;
2818
2818
}
2819
- const parentHostInstance = getInstanceFromHostFiber ( parentHostFiber ) ;
2819
+ const parentHostInstance =
2820
+ getInstanceFromHostFiber < Instance > ( parentHostFiber ) ;
2820
2821
const rootNode =
2821
2822
// $FlowFixMe[incompatible-cast] Flow expects Node
2822
2823
( parentHostInstance . getRootNode ( getRootNodeOptions ) : Document | ShadowRoot ) ;
@@ -2838,7 +2839,8 @@ FragmentInstance.prototype.compareDocumentPosition = function (
2838
2839
if ( children . length === 0 ) {
2839
2840
// If the fragment has no children, we can use the parent and
2840
2841
// siblings to determine a position.
2841
- const parentHostInstance = getInstanceFromHostFiber ( parentHostFiber ) ;
2842
+ const parentHostInstance =
2843
+ getInstanceFromHostFiber < Instance > ( parentHostFiber ) ;
2842
2844
const parentResult = parentHostInstance . compareDocumentPosition ( otherNode ) ;
2843
2845
result = parentResult ;
2844
2846
if ( parentHostInstance === otherNode ) {
@@ -2852,7 +2854,7 @@ FragmentInstance.prototype.compareDocumentPosition = function (
2852
2854
result = Node . DOCUMENT_POSITION_PRECEDING ;
2853
2855
} else {
2854
2856
const nextSiblingInstance =
2855
- getInstanceFromHostFiber ( nextSiblingFiber ) ;
2857
+ getInstanceFromHostFiber < Instance > ( nextSiblingFiber ) ;
2856
2858
const nextSiblingResult =
2857
2859
nextSiblingInstance . compareDocumentPosition ( otherNode ) ;
2858
2860
if (
@@ -2871,8 +2873,10 @@ FragmentInstance.prototype.compareDocumentPosition = function (
2871
2873
return result ;
2872
2874
}
2873
2875
2874
- const firstElement = getInstanceFromHostFiber ( children [ 0 ] ) ;
2875
- const lastElement = getInstanceFromHostFiber ( children [ children . length - 1 ] ) ;
2876
+ const firstElement = getInstanceFromHostFiber < Instance > ( children [ 0 ] ) ;
2877
+ const lastElement = getInstanceFromHostFiber < Instance > (
2878
+ children [ children . length - 1 ] ,
2879
+ ) ;
2876
2880
const firstResult = firstElement . compareDocumentPosition ( otherNode ) ;
2877
2881
const lastResult = lastElement . compareDocumentPosition ( otherNode ) ;
2878
2882
if (
0 commit comments