mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #33044 from eps1lon/react-dom/findDOMNode-optional
[react-dom] Allow maybe instance in findDOMNode
This commit is contained in:
Vendored
+1
-1
@@ -17,7 +17,7 @@ import {
|
||||
DOMAttributes, DOMElement, ReactNode, ReactPortal
|
||||
} from 'react';
|
||||
|
||||
export function findDOMNode(instance: ReactInstance): Element | null | Text;
|
||||
export function findDOMNode(instance: ReactInstance | null | undefined): Element | null | Text;
|
||||
export function unmountComponentAtNode(container: Element): boolean;
|
||||
|
||||
export function createPortal(children: ReactNode, container: Element, key?: null | string): ReactPortal;
|
||||
|
||||
@@ -30,6 +30,8 @@ describe('ReactDOM', () => {
|
||||
const rootElement = document.createElement('div');
|
||||
ReactDOM.render(React.createElement('div'), rootElement);
|
||||
ReactDOM.findDOMNode(rootElement);
|
||||
ReactDOM.findDOMNode(null);
|
||||
ReactDOM.findDOMNode(undefined);
|
||||
});
|
||||
|
||||
it('createPortal', () => {
|
||||
|
||||
Vendored
+1
-1
@@ -15,7 +15,7 @@ import {
|
||||
DOMAttributes, DOMElement
|
||||
} from 'react';
|
||||
|
||||
export function findDOMNode<E extends Element>(instance: ReactInstance): E;
|
||||
export function findDOMNode<E extends Element>(instance: ReactInstance | null | undefined): E;
|
||||
export function findDOMNode(instance: ReactInstance): Element;
|
||||
|
||||
export function render<P extends DOMAttributes<T>, T extends Element>(
|
||||
|
||||
@@ -25,6 +25,8 @@ describe('ReactDOM', () => {
|
||||
const rootElement = document.createElement('div');
|
||||
ReactDOM.render(React.createElement('div'), rootElement);
|
||||
ReactDOM.findDOMNode(rootElement);
|
||||
ReactDOM.findDOMNode(null);
|
||||
ReactDOM.findDOMNode(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user