@types/react-dom 16.9.19 → 16.9.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
react-dom v16.9/LICENSE CHANGED
File without changes
@@ -8,7 +8,7 @@ This package contains type definitions for React (react-dom) (https://reactjs.or
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom/v16.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Tue, 25 Apr 2023 20:32:50 GMT
11
+ * Last updated: Wed, 27 Sep 2023 07:12:04 GMT
12
12
  * Dependencies: [@types/react](https://npmjs.com/package/@types/react)
13
13
  * Global values: `ReactDOM`, `ReactDOMServer`
14
14
 
@@ -17,15 +17,26 @@
17
17
  export as namespace ReactDOM;
18
18
 
19
19
  import {
20
- ReactInstance, Component, ComponentState,
21
- ReactElement, SFCElement, CElement,
22
- DOMAttributes, DOMElement, ReactNode, ReactPortal
23
- } from 'react';
20
+ CElement,
21
+ Component,
22
+ ComponentState,
23
+ DOMAttributes,
24
+ DOMElement,
25
+ ReactElement,
26
+ ReactInstance,
27
+ ReactNode,
28
+ ReactPortal,
29
+ SFCElement,
30
+ } from "react";
24
31
 
25
32
  export function findDOMNode(instance: ReactInstance | null | undefined): Element | null | Text;
26
33
  export function unmountComponentAtNode(container: Element | DocumentFragment): boolean;
27
34
 
28
- export function createPortal(children: ReactNode, container: Element | DocumentFragment, key?: null | string): ReactPortal;
35
+ export function createPortal(
36
+ children: ReactNode,
37
+ container: Element | DocumentFragment,
38
+ key?: null | string,
39
+ ): ReactPortal;
29
40
 
30
41
  export const version: string;
31
42
  export const render: Renderer;
@@ -41,17 +52,20 @@ export function unstable_renderSubtreeIntoContainer<T extends Element>(
41
52
  parentComponent: Component<any>,
42
53
  element: DOMElement<DOMAttributes<T>, T>,
43
54
  container: Element,
44
- callback?: (element: T) => any): T;
55
+ callback?: (element: T) => any,
56
+ ): T;
45
57
  export function unstable_renderSubtreeIntoContainer<P, T extends Component<P, ComponentState>>(
46
58
  parentComponent: Component<any>,
47
59
  element: CElement<P, T>,
48
60
  container: Element,
49
- callback?: (component: T) => any): T;
61
+ callback?: (component: T) => any,
62
+ ): T;
50
63
  export function unstable_renderSubtreeIntoContainer<P>(
51
64
  parentComponent: Component<any>,
52
65
  element: ReactElement<P>,
53
66
  container: Element,
54
- callback?: (component?: Component<P, ComponentState> | Element) => any): Component<P, ComponentState> | Element | void;
67
+ callback?: (component?: Component<P, ComponentState> | Element) => any,
68
+ ): Component<P, ComponentState> | Element | void;
55
69
 
56
70
  export type Container = Element | Document | DocumentFragment;
57
71
 
@@ -62,42 +76,42 @@ export interface Renderer {
62
76
  <T extends Element>(
63
77
  element: DOMElement<DOMAttributes<T>, T>,
64
78
  container: Container | null,
65
- callback?: () => void
79
+ callback?: () => void,
66
80
  ): T;
67
81
 
68
82
  (
69
83
  element: Array<DOMElement<DOMAttributes<any>, any>>,
70
- container: Container| null,
71
- callback?: () => void
84
+ container: Container | null,
85
+ callback?: () => void,
72
86
  ): Element;
73
87
 
74
88
  (
75
89
  element: SFCElement<any> | Array<SFCElement<any>>,
76
- container: Container| null,
77
- callback?: () => void
90
+ container: Container | null,
91
+ callback?: () => void,
78
92
  ): void;
79
93
 
80
94
  <P, T extends Component<P, ComponentState>>(
81
95
  element: CElement<P, T>,
82
- container: Container| null,
83
- callback?: () => void
96
+ container: Container | null,
97
+ callback?: () => void,
84
98
  ): T;
85
99
 
86
100
  (
87
101
  element: Array<CElement<any, Component<any, ComponentState>>>,
88
- container: Container| null,
89
- callback?: () => void
102
+ container: Container | null,
103
+ callback?: () => void,
90
104
  ): Component<any, ComponentState>;
91
105
 
92
106
  <P>(
93
107
  element: ReactElement<P>,
94
- container: Container| null,
95
- callback?: () => void
108
+ container: Container | null,
109
+ callback?: () => void,
96
110
  ): Component<P, ComponentState> | Element | void;
97
111
 
98
112
  (
99
113
  element: ReactElement[],
100
- container: Container| null,
101
- callback?: () => void
114
+ container: Container | null,
115
+ callback?: () => void,
102
116
  ): Component<any, ComponentState> | Element | void;
103
117
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react-dom",
3
- "version": "16.9.19",
3
+ "version": "16.9.20",
4
4
  "description": "TypeScript definitions for React (react-dom)",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom",
6
6
  "license": "MIT",
@@ -49,6 +49,6 @@
49
49
  "dependencies": {
50
50
  "@types/react": "^16"
51
51
  },
52
- "typesPublisherContentHash": "bf7007a07feb8c5f626088459485d80ac74fcdef8ed3f960b41cea18c6c468fd",
53
- "typeScriptVersion": "4.3"
52
+ "typesPublisherContentHash": "477babe8a014b857fdf74c13000cb1a891032021da7962cd8ffbb747a33260e0",
53
+ "typeScriptVersion": "4.5"
54
54
  }
@@ -6,7 +6,7 @@ declare global {
6
6
  }
7
7
  }
8
8
 
9
- import { ReactElement } from 'react';
9
+ import { ReactElement } from "react";
10
10
 
11
11
  /**
12
12
  * Render a React element to its initial HTML. This should only be used on the server.
@@ -1,9 +1,17 @@
1
1
  import {
2
- AbstractView, Component, ComponentClass,
3
- ReactElement, ReactInstance, ClassType,
4
- DOMElement, SFCElement, CElement,
5
- ReactHTMLElement, DOMAttributes, SFC
6
- } from 'react';
2
+ AbstractView,
3
+ CElement,
4
+ ClassType,
5
+ Component,
6
+ ComponentClass,
7
+ DOMAttributes,
8
+ DOMElement,
9
+ ReactElement,
10
+ ReactHTMLElement,
11
+ ReactInstance,
12
+ SFC,
13
+ SFCElement,
14
+ } from "react";
7
15
 
8
16
  import * as ReactTestUtils from ".";
9
17
 
@@ -23,7 +31,21 @@ export interface OptionalEventProperties {
23
31
  type?: string | undefined;
24
32
  }
25
33
 
26
- export type ModifierKey = "Alt" | "AltGraph" | "CapsLock" | "Control" | "Fn" | "FnLock" | "Hyper" | "Meta" | "NumLock" | "ScrollLock" | "Shift" | "Super" | "Symbol" | "SymbolLock";
34
+ export type ModifierKey =
35
+ | "Alt"
36
+ | "AltGraph"
37
+ | "CapsLock"
38
+ | "Control"
39
+ | "Fn"
40
+ | "FnLock"
41
+ | "Hyper"
42
+ | "Meta"
43
+ | "NumLock"
44
+ | "ScrollLock"
45
+ | "Shift"
46
+ | "Super"
47
+ | "Symbol"
48
+ | "SymbolLock";
27
49
 
28
50
  export interface SyntheticEventData extends OptionalEventProperties {
29
51
  altKey?: boolean | undefined;
@@ -62,7 +84,7 @@ export interface SyntheticEventData extends OptionalEventProperties {
62
84
  export type EventSimulator = (element: Element | Component<any>, eventData?: SyntheticEventData) => void;
63
85
 
64
86
  export interface MockedComponentClass {
65
- new (props: any): any;
87
+ new(props: any): any;
66
88
  }
67
89
 
68
90
  export interface ShallowRenderer {
@@ -81,7 +103,7 @@ export interface ShallowRenderer {
81
103
  * Simulate an event dispatch on a DOM node with optional `eventData` event data.
82
104
  * `Simulate` has a method for every event that React understands.
83
105
  */
84
- export namespace Simulate {
106
+ export namespace Simulate {
85
107
  const abort: EventSimulator;
86
108
  const animationEnd: EventSimulator;
87
109
  const animationIteration: EventSimulator;
@@ -172,17 +194,21 @@ export interface ShallowRenderer {
172
194
  * Render a React element into a detached DOM node in the document. __This function requires a DOM__.
173
195
  */
174
196
  export function renderIntoDocument<T extends Element>(
175
- element: DOMElement<any, T>): T;
197
+ element: DOMElement<any, T>,
198
+ ): T;
176
199
  export function renderIntoDocument(
177
- element: SFCElement<any>): void;
200
+ element: SFCElement<any>,
201
+ ): void;
178
202
  // If we replace `P` with `any` in this overload, then some tests fail because
179
203
  // calls to `renderIntoDocument` choose the last overload on the
180
204
  // subtype-relation pass and get an undesirably broad return type. Using `P`
181
205
  // allows this overload to match on the subtype-relation pass.
182
206
  export function renderIntoDocument<P, T extends Component<P>>(
183
- element: CElement<P, T>): T;
207
+ element: CElement<P, T>,
208
+ ): T;
184
209
  export function renderIntoDocument<P>(
185
- element: ReactElement<P>): Component<P> | Element | void;
210
+ element: ReactElement<P>,
211
+ ): Component<P> | Element | void;
186
212
 
187
213
  /**
188
214
  * Pass a mocked component module to this method to augment it with useful methods that allow it to
@@ -190,7 +216,9 @@ export function renderIntoDocument<P>(
190
216
  * a simple `<div>` (or other tag if `mockTagName` is provided) containing any provided children.
191
217
  */
192
218
  export function mockComponent(
193
- mocked: MockedComponentClass, mockTagName?: string): typeof ReactTestUtils;
219
+ mocked: MockedComponentClass,
220
+ mockTagName?: string,
221
+ ): typeof ReactTestUtils;
194
222
 
195
223
  /**
196
224
  * Returns `true` if `element` is any React element.
@@ -201,22 +229,30 @@ export function isElement(element: any): boolean;
201
229
  * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
202
230
  */
203
231
  export function isElementOfType<T extends HTMLElement>(
204
- element: ReactElement, type: string): element is ReactHTMLElement<T>;
232
+ element: ReactElement,
233
+ type: string,
234
+ ): element is ReactHTMLElement<T>;
205
235
  /**
206
236
  * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
207
237
  */
208
238
  export function isElementOfType<P extends DOMAttributes<{}>, T extends Element>(
209
- element: ReactElement, type: string): element is DOMElement<P, T>;
239
+ element: ReactElement,
240
+ type: string,
241
+ ): element is DOMElement<P, T>;
210
242
  /**
211
243
  * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
212
244
  */
213
245
  export function isElementOfType<P>(
214
- element: ReactElement, type: SFC<P>): element is SFCElement<P>;
246
+ element: ReactElement,
247
+ type: SFC<P>,
248
+ ): element is SFCElement<P>;
215
249
  /**
216
250
  * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
217
251
  */
218
252
  export function isElementOfType<P, T extends Component<P>, C extends ComponentClass<P>>(
219
- element: ReactElement, type: ClassType<P, T, C>): element is CElement<P, T>;
253
+ element: ReactElement,
254
+ type: ClassType<P, T, C>,
255
+ ): element is CElement<P, T>;
220
256
 
221
257
  /**
222
258
  * Returns `true` if `instance` is a DOM component (such as a `<div>` or `<span>`).
@@ -230,7 +266,9 @@ export function isCompositeComponent(instance: ReactInstance): instance is Compo
230
266
  * Returns `true` if `instance` is a component whose type is of a React `componentClass`.
231
267
  */
232
268
  export function isCompositeComponentWithType<T extends Component<any>, C extends ComponentClass<any>>(
233
- instance: ReactInstance, type: ClassType<any, T, C>): boolean;
269
+ instance: ReactInstance,
270
+ type: ClassType<any, T, C>,
271
+ ): boolean;
234
272
 
235
273
  /**
236
274
  * Traverse all components in `tree` and accumulate all components where
@@ -239,7 +277,8 @@ export function isCompositeComponentWithType<T extends Component<any>, C extends
239
277
  */
240
278
  export function findAllInRenderedTree(
241
279
  root: Component<any>,
242
- fn: (i: ReactInstance) => boolean): ReactInstance[];
280
+ fn: (i: ReactInstance) => boolean,
281
+ ): ReactInstance[];
243
282
 
244
283
  /**
245
284
  * Finds all DOM elements of components in the rendered tree that are
@@ -247,7 +286,8 @@ export function findAllInRenderedTree(
247
286
  */
248
287
  export function scryRenderedDOMComponentsWithClass(
249
288
  root: Component<any>,
250
- className: string): Element[];
289
+ className: string,
290
+ ): Element[];
251
291
  /**
252
292
  * Like `scryRenderedDOMComponentsWithClass()` but expects there to be one result,
253
293
  * and returns that one result, or throws exception if there is any other
@@ -255,7 +295,8 @@ export function scryRenderedDOMComponentsWithClass(
255
295
  */
256
296
  export function findRenderedDOMComponentWithClass(
257
297
  root: Component<any>,
258
- className: string): Element;
298
+ className: string,
299
+ ): Element;
259
300
 
260
301
  /**
261
302
  * Finds all DOM elements of components in the rendered tree that are
@@ -263,7 +304,8 @@ export function findRenderedDOMComponentWithClass(
263
304
  */
264
305
  export function scryRenderedDOMComponentsWithTag(
265
306
  root: Component<any>,
266
- tagName: string): Element[];
307
+ tagName: string,
308
+ ): Element[];
267
309
  /**
268
310
  * Like `scryRenderedDOMComponentsWithTag()` but expects there to be one result,
269
311
  * and returns that one result, or throws exception if there is any other
@@ -271,14 +313,16 @@ export function scryRenderedDOMComponentsWithTag(
271
313
  */
272
314
  export function findRenderedDOMComponentWithTag(
273
315
  root: Component<any>,
274
- tagName: string): Element;
316
+ tagName: string,
317
+ ): Element;
275
318
 
276
319
  /**
277
320
  * Finds all instances of components with type equal to `componentClass`.
278
321
  */
279
322
  export function scryRenderedComponentsWithType<T extends Component<any>, C extends ComponentClass<any>>(
280
323
  root: Component<any>,
281
- type: ClassType<any, T, C>): T[];
324
+ type: ClassType<any, T, C>,
325
+ ): T[];
282
326
 
283
327
  /**
284
328
  * Same as `scryRenderedComponentsWithType()` but expects there to be one result
@@ -287,7 +331,8 @@ export function scryRenderedComponentsWithType<T extends Component<any>, C exten
287
331
  */
288
332
  export function findRenderedComponentWithType<T extends Component<any>, C extends ComponentClass<any>>(
289
333
  root: Component<any>,
290
- type: ClassType<any, T, C>): T;
334
+ type: ClassType<any, T, C>,
335
+ ): T;
291
336
 
292
337
  /**
293
338
  * Call this in your tests to create a shallow renderer.