@types/react-dom 17.0.19 → 17.0.21

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
@@ -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/v17.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Wed, 15 Feb 2023 00:32:43 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
 
@@ -13,15 +13,26 @@
13
13
  export as namespace ReactDOM;
14
14
 
15
15
  import {
16
- ReactInstance, Component, ComponentState,
17
- ReactElement, FunctionComponentElement, CElement,
18
- DOMAttributes, DOMElement, ReactNode, ReactPortal
19
- } from 'react';
16
+ CElement,
17
+ Component,
18
+ ComponentState,
19
+ DOMAttributes,
20
+ DOMElement,
21
+ FunctionComponentElement,
22
+ ReactElement,
23
+ ReactInstance,
24
+ ReactNode,
25
+ ReactPortal,
26
+ } from "react";
20
27
 
21
28
  export function findDOMNode(instance: ReactInstance | null | undefined): Element | null | Text;
22
29
  export function unmountComponentAtNode(container: Element | DocumentFragment): boolean;
23
30
 
24
- export function createPortal(children: ReactNode, container: Element | DocumentFragment, key?: null | string): ReactPortal;
31
+ export function createPortal(
32
+ children: ReactNode,
33
+ container: Element | DocumentFragment,
34
+ key?: null | string,
35
+ ): ReactPortal;
25
36
 
26
37
  export const version: string;
27
38
  export const render: Renderer;
@@ -37,17 +48,20 @@ export function unstable_renderSubtreeIntoContainer<T extends Element>(
37
48
  parentComponent: Component<any>,
38
49
  element: DOMElement<DOMAttributes<T>, T>,
39
50
  container: Element,
40
- callback?: (element: T) => any): T;
51
+ callback?: (element: T) => any,
52
+ ): T;
41
53
  export function unstable_renderSubtreeIntoContainer<P, T extends Component<P, ComponentState>>(
42
54
  parentComponent: Component<any>,
43
55
  element: CElement<P, T>,
44
56
  container: Element,
45
- callback?: (component: T) => any): T;
57
+ callback?: (component: T) => any,
58
+ ): T;
46
59
  export function unstable_renderSubtreeIntoContainer<P>(
47
60
  parentComponent: Component<any>,
48
61
  element: ReactElement<P>,
49
62
  container: Element,
50
- callback?: (component?: Component<P, ComponentState> | Element) => any): Component<P, ComponentState> | Element | void;
63
+ callback?: (component?: Component<P, ComponentState> | Element) => any,
64
+ ): Component<P, ComponentState> | Element | void;
51
65
 
52
66
  export type Container = Element | Document | DocumentFragment;
53
67
 
@@ -57,43 +71,43 @@ export interface Renderer {
57
71
 
58
72
  <T extends Element>(
59
73
  element: DOMElement<DOMAttributes<T>, T>,
60
- container: Container| null,
61
- callback?: () => void
74
+ container: Container | null,
75
+ callback?: () => void,
62
76
  ): T;
63
77
 
64
78
  (
65
79
  element: Array<DOMElement<DOMAttributes<any>, any>>,
66
- container: Container| null,
67
- callback?: () => void
80
+ container: Container | null,
81
+ callback?: () => void,
68
82
  ): Element;
69
83
 
70
84
  (
71
85
  element: FunctionComponentElement<any> | Array<FunctionComponentElement<any>>,
72
- container: Container| null,
73
- callback?: () => void
86
+ container: Container | null,
87
+ callback?: () => void,
74
88
  ): void;
75
89
 
76
90
  <P, T extends Component<P, ComponentState>>(
77
91
  element: CElement<P, T>,
78
- container: Container| null,
79
- callback?: () => void
92
+ container: Container | null,
93
+ callback?: () => void,
80
94
  ): T;
81
95
 
82
96
  (
83
97
  element: Array<CElement<any, Component<any, ComponentState>>>,
84
- container: Container| null,
85
- callback?: () => void
98
+ container: Container | null,
99
+ callback?: () => void,
86
100
  ): Component<any, ComponentState>;
87
101
 
88
102
  <P>(
89
103
  element: ReactElement<P>,
90
- container: Container| null,
91
- callback?: () => void
104
+ container: Container | null,
105
+ callback?: () => void,
92
106
  ): Component<P, ComponentState> | Element | void;
93
107
 
94
108
  (
95
109
  element: ReactElement[],
96
- container: Container| null,
97
- callback?: () => void
110
+ container: Container | null,
111
+ callback?: () => void,
98
112
  ): Component<any, ComponentState> | Element | void;
99
113
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react-dom",
3
- "version": "17.0.19",
3
+ "version": "17.0.21",
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": "^17"
51
51
  },
52
- "typesPublisherContentHash": "6306a0c4e47ce432842f022a4c404efaa3de85e99b0d6e3543adb9229395fa1c",
53
- "typeScriptVersion": "4.2"
52
+ "typesPublisherContentHash": "6223b5cc7c7572f8b3bb9a53fe6b60be3f6841422188ef5df177220c213bb3a7",
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 {
@@ -88,16 +110,19 @@ export namespace Simulate {
88
110
  const animationIteration: EventSimulator;
89
111
  const animationStart: EventSimulator;
90
112
  const blur: EventSimulator;
113
+ const cancel: EventSimulator;
91
114
  const canPlay: EventSimulator;
92
115
  const canPlayThrough: EventSimulator;
93
116
  const change: EventSimulator;
94
117
  const click: EventSimulator;
118
+ const close: EventSimulator;
95
119
  const compositionEnd: EventSimulator;
96
120
  const compositionStart: EventSimulator;
97
121
  const compositionUpdate: EventSimulator;
98
122
  const contextMenu: EventSimulator;
99
123
  const copy: EventSimulator;
100
124
  const cut: EventSimulator;
125
+ const auxClick: EventSimulator;
101
126
  const doubleClick: EventSimulator;
102
127
  const drag: EventSimulator;
103
128
  const dragEnd: EventSimulator;
@@ -134,11 +159,24 @@ export namespace Simulate {
134
159
  const play: EventSimulator;
135
160
  const playing: EventSimulator;
136
161
  const progress: EventSimulator;
162
+ const pointerCancel: EventSimulator;
163
+ const pointerDown: EventSimulator;
164
+ const pointerUp: EventSimulator;
165
+ const pointerMove: EventSimulator;
166
+ const pointerOut: EventSimulator;
167
+ const pointerOver: EventSimulator;
168
+ const pointerEnter: EventSimulator;
169
+ const pointerLeave: EventSimulator;
170
+ const gotPointerCapture: EventSimulator;
171
+ const lostPointerCapture: EventSimulator;
137
172
  const rateChange: EventSimulator;
173
+ const reset: EventSimulator;
138
174
  const scroll: EventSimulator;
175
+ const toggle: EventSimulator;
139
176
  const seeked: EventSimulator;
140
177
  const seeking: EventSimulator;
141
178
  const select: EventSimulator;
179
+ const beforeInput: EventSimulator;
142
180
  const stalled: EventSimulator;
143
181
  const submit: EventSimulator;
144
182
  const suspend: EventSimulator;
@@ -157,17 +195,21 @@ export namespace Simulate {
157
195
  * Render a React element into a detached DOM node in the document. __This function requires a DOM__.
158
196
  */
159
197
  export function renderIntoDocument<T extends Element>(
160
- element: DOMElement<any, T>): T;
198
+ element: DOMElement<any, T>,
199
+ ): T;
161
200
  export function renderIntoDocument(
162
- element: FunctionComponentElement<any>): void;
201
+ element: FunctionComponentElement<any>,
202
+ ): void;
163
203
  // If we replace `P` with `any` in this overload, then some tests fail because
164
204
  // calls to `renderIntoDocument` choose the last overload on the
165
205
  // subtype-relation pass and get an undesirably broad return type. Using `P`
166
206
  // allows this overload to match on the subtype-relation pass.
167
207
  export function renderIntoDocument<P, T extends Component<P>>(
168
- element: CElement<P, T>): T;
208
+ element: CElement<P, T>,
209
+ ): T;
169
210
  export function renderIntoDocument<P>(
170
- element: ReactElement<P>): Component<P> | Element | void;
211
+ element: ReactElement<P>,
212
+ ): Component<P> | Element | void;
171
213
 
172
214
  /**
173
215
  * Pass a mocked component module to this method to augment it with useful methods that allow it to
@@ -175,7 +217,9 @@ export function renderIntoDocument<P>(
175
217
  * a simple `<div>` (or other tag if `mockTagName` is provided) containing any provided children.
176
218
  */
177
219
  export function mockComponent(
178
- mocked: MockedComponentClass, mockTagName?: string): typeof ReactTestUtils;
220
+ mocked: MockedComponentClass,
221
+ mockTagName?: string,
222
+ ): typeof ReactTestUtils;
179
223
 
180
224
  /**
181
225
  * Returns `true` if `element` is any React element.
@@ -186,22 +230,30 @@ export function isElement(element: any): boolean;
186
230
  * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
187
231
  */
188
232
  export function isElementOfType<T extends HTMLElement>(
189
- element: ReactElement, type: string): element is ReactHTMLElement<T>;
233
+ element: ReactElement,
234
+ type: string,
235
+ ): element is ReactHTMLElement<T>;
190
236
  /**
191
237
  * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
192
238
  */
193
239
  export function isElementOfType<P extends DOMAttributes<{}>, T extends Element>(
194
- element: ReactElement, type: string): element is DOMElement<P, T>;
240
+ element: ReactElement,
241
+ type: string,
242
+ ): element is DOMElement<P, T>;
195
243
  /**
196
244
  * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
197
245
  */
198
246
  export function isElementOfType<P>(
199
- element: ReactElement, type: FC<P>): element is FunctionComponentElement<P>;
247
+ element: ReactElement,
248
+ type: FC<P>,
249
+ ): element is FunctionComponentElement<P>;
200
250
  /**
201
251
  * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
202
252
  */
203
253
  export function isElementOfType<P, T extends Component<P>, C extends ComponentClass<P>>(
204
- 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>;
205
257
 
206
258
  /**
207
259
  * Returns `true` if `instance` is a DOM component (such as a `<div>` or `<span>`).
@@ -215,7 +267,9 @@ export function isCompositeComponent(instance: ReactInstance): instance is Compo
215
267
  * Returns `true` if `instance` is a component whose type is of a React `componentClass`.
216
268
  */
217
269
  export function isCompositeComponentWithType<T extends Component<any>, C extends ComponentClass<any>>(
218
- instance: ReactInstance, type: ClassType<any, T, C>): boolean;
270
+ instance: ReactInstance,
271
+ type: ClassType<any, T, C>,
272
+ ): boolean;
219
273
 
220
274
  /**
221
275
  * Traverse all components in `tree` and accumulate all components where
@@ -224,7 +278,8 @@ export function isCompositeComponentWithType<T extends Component<any>, C extends
224
278
  */
225
279
  export function findAllInRenderedTree(
226
280
  root: Component<any>,
227
- fn: (i: ReactInstance) => boolean): ReactInstance[];
281
+ fn: (i: ReactInstance) => boolean,
282
+ ): ReactInstance[];
228
283
 
229
284
  /**
230
285
  * Finds all DOM elements of components in the rendered tree that are
@@ -232,7 +287,8 @@ export function findAllInRenderedTree(
232
287
  */
233
288
  export function scryRenderedDOMComponentsWithClass(
234
289
  root: Component<any>,
235
- className: string): Element[];
290
+ className: string,
291
+ ): Element[];
236
292
  /**
237
293
  * Like `scryRenderedDOMComponentsWithClass()` but expects there to be one result,
238
294
  * and returns that one result, or throws exception if there is any other
@@ -240,7 +296,8 @@ export function scryRenderedDOMComponentsWithClass(
240
296
  */
241
297
  export function findRenderedDOMComponentWithClass(
242
298
  root: Component<any>,
243
- className: string): Element;
299
+ className: string,
300
+ ): Element;
244
301
 
245
302
  /**
246
303
  * Finds all DOM elements of components in the rendered tree that are
@@ -248,7 +305,8 @@ export function findRenderedDOMComponentWithClass(
248
305
  */
249
306
  export function scryRenderedDOMComponentsWithTag(
250
307
  root: Component<any>,
251
- tagName: string): Element[];
308
+ tagName: string,
309
+ ): Element[];
252
310
  /**
253
311
  * Like `scryRenderedDOMComponentsWithTag()` but expects there to be one result,
254
312
  * and returns that one result, or throws exception if there is any other
@@ -256,14 +314,16 @@ export function scryRenderedDOMComponentsWithTag(
256
314
  */
257
315
  export function findRenderedDOMComponentWithTag(
258
316
  root: Component<any>,
259
- tagName: string): Element;
317
+ tagName: string,
318
+ ): Element;
260
319
 
261
320
  /**
262
321
  * Finds all instances of components with type equal to `componentClass`.
263
322
  */
264
323
  export function scryRenderedComponentsWithType<T extends Component<any>, C extends ComponentClass<any>>(
265
324
  root: Component<any>,
266
- type: ClassType<any, T, C>): T[];
325
+ type: ClassType<any, T, C>,
326
+ ): T[];
267
327
 
268
328
  /**
269
329
  * Same as `scryRenderedComponentsWithType()` but expects there to be one result
@@ -272,7 +332,8 @@ export function scryRenderedComponentsWithType<T extends Component<any>, C exten
272
332
  */
273
333
  export function findRenderedComponentWithType<T extends Component<any>, C extends ComponentClass<any>>(
274
334
  root: Component<any>,
275
- type: ClassType<any, T, C>): T;
335
+ type: ClassType<any, T, C>,
336
+ ): T;
276
337
 
277
338
  /**
278
339
  * Call this in your tests to create a shallow renderer.