@types/react-dom 17.0.20 → 17.0.22

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