We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e34eb0b commit 30f034fCopy full SHA for 30f034f
src/Dom/findDOMNode.ts
@@ -3,9 +3,11 @@ import ReactDOM from 'react-dom';
3
/**
4
* Return if a node is a DOM node. Else will return by `findDOMNode`
5
*/
6
-export default function findDOMNode(node: React.ReactInstance | HTMLElement): Element | Text {
+export default function findDOMNode<T = Element | Text>(
7
+ node: React.ReactInstance | HTMLElement,
8
+): T {
9
if (node instanceof HTMLElement) {
- return node;
10
+ return (node as unknown) as T;
11
}
- return ReactDOM.findDOMNode(node);
12
+ return (ReactDOM.findDOMNode(node) as unknown) as T;
13
0 commit comments