Skip to content

Commit 74bf335

Browse files
authored
chore: improve robustness & TS type (#540)
1 parent f9b468e commit 74bf335

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Dom/findDOMNode.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function isDOM(node: any): node is HTMLElement | SVGElement {
1010
/**
1111
* Retrieves a DOM node via a ref, and does not invoke `findDOMNode`.
1212
*/
13-
export function getDOM(node: any): node is HTMLElement | SVGElement {
13+
export function getDOM(node: any): HTMLElement | SVGElement | null {
1414
if (node && typeof node === 'object' && isDOM(node.nativeElement)) {
1515
return node.nativeElement;
1616
}
@@ -34,7 +34,7 @@ export default function findDOMNode<T = Element | Text>(
3434
}
3535

3636
if (node instanceof React.Component) {
37-
return ReactDOM.findDOMNode(node) as unknown as T;
37+
return ReactDOM.findDOMNode?.(node) as unknown as T;
3838
}
3939

4040
return null;

0 commit comments

Comments
 (0)