@types/react-dom 16.9.18 → 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: Wed, 15 Feb 2023 00:32:44 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.18",
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": "b229ad33a419884f004fd4e1823e41bae30bd462a08c2374cb4a779fd45ff142",
53
- "typeScriptVersion": "4.2"
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 {
@@ -87,16 +109,19 @@ export namespace Simulate {
87
109
  const animationIteration: EventSimulator;
88
110
  const animationStart: EventSimulator;
89
111
  const blur: EventSimulator;
112
+ const cancel: EventSimulator;
90
113
  const canPlay: EventSimulator;
91
114
  const canPlayThrough: EventSimulator;
92
115
  const change: EventSimulator;
93
116
  const click: EventSimulator;
117
+ const close: EventSimulator;
94
118
  const compositionEnd: EventSimulator;
95
119
  const compositionStart: EventSimulator;
96
120
  const compositionUpdate: EventSimulator;
97
121
  const contextMenu: EventSimulator;
98
122
  const copy: EventSimulator;
99
123
  const cut: EventSimulator;
124
+ const auxClick: EventSimulator;
100
125
  const doubleClick: EventSimulator;
101
126
  const drag: EventSimulator;
102
127
  const dragEnd: EventSimulator;
@@ -133,11 +158,24 @@ export namespace Simulate {
133
158
  const play: EventSimulator;
134
159
  const playing: EventSimulator;
135
160
  const progress: EventSimulator;
161
+ const pointerCancel: EventSimulator;
162
+ const pointerDown: EventSimulator;
163
+ const pointerUp: EventSimulator;
164
+ const pointerMove: EventSimulator;
165
+ const pointerOut: EventSimulator;
166
+ const pointerOver: EventSimulator;
167
+ const pointerEnter: EventSimulator;
168
+ const pointerLeave: EventSimulator;
169
+ const gotPointerCapture: EventSimulator;
170
+ const lostPointerCapture: EventSimulator;
136
171
  const rateChange: EventSimulator;
172
+ const reset: EventSimulator;
137
173
  const scroll: EventSimulator;
174
+ const toggle: EventSimulator;
138
175
  const seeked: EventSimulator;
139
176
  const seeking: EventSimulator;
140
177
  const select: EventSimulator;
178
+ const beforeInput: EventSimulator;
141
179
  const stalled: EventSimulator;
142
180
  const submit: EventSimulator;
143
181
  const suspend: EventSimulator;
@@ -156,17 +194,21 @@ export namespace Simulate {
156
194
  * Render a React element into a detached DOM node in the document. __This function requires a DOM__.
157
195
  */
158
196
  export function renderIntoDocument<T extends Element>(
159
- element: DOMElement<any, T>): T;
197
+ element: DOMElement<any, T>,
198
+ ): T;
160
199
  export function renderIntoDocument(
161
- element: SFCElement<any>): void;
200
+ element: SFCElement<any>,
201
+ ): void;
162
202
  // If we replace `P` with `any` in this overload, then some tests fail because
163
203
  // calls to `renderIntoDocument` choose the last overload on the
164
204
  // subtype-relation pass and get an undesirably broad return type. Using `P`
165
205
  // allows this overload to match on the subtype-relation pass.
166
206
  export function renderIntoDocument<P, T extends Component<P>>(
167
- element: CElement<P, T>): T;
207
+ element: CElement<P, T>,
208
+ ): T;
168
209
  export function renderIntoDocument<P>(
169
- element: ReactElement<P>): Component<P> | Element | void;
210
+ element: ReactElement<P>,
211
+ ): Component<P> | Element | void;
170
212
 
171
213
  /**
172
214
  * Pass a mocked component module to this method to augment it with useful methods that allow it to
@@ -174,7 +216,9 @@ export function renderIntoDocument<P>(
174
216
  * a simple `<div>` (or other tag if `mockTagName` is provided) containing any provided children.
175
217
  */
176
218
  export function mockComponent(
177
- mocked: MockedComponentClass, mockTagName?: string): typeof ReactTestUtils;
219
+ mocked: MockedComponentClass,
220
+ mockTagName?: string,
221
+ ): typeof ReactTestUtils;
178
222
 
179
223
  /**
180
224
  * Returns `true` if `element` is any React element.
@@ -185,22 +229,30 @@ export function isElement(element: any): boolean;
185
229
  * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
186
230
  */
187
231
  export function isElementOfType<T extends HTMLElement>(
188
- element: ReactElement, type: string): element is ReactHTMLElement<T>;
232
+ element: ReactElement,
233
+ type: string,
234
+ ): element is ReactHTMLElement<T>;
189
235
  /**
190
236
  * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
191
237
  */
192
238
  export function isElementOfType<P extends DOMAttributes<{}>, T extends Element>(
193
- element: ReactElement, type: string): element is DOMElement<P, T>;
239
+ element: ReactElement,
240
+ type: string,
241
+ ): element is DOMElement<P, T>;
194
242
  /**
195
243
  * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
196
244
  */
197
245
  export function isElementOfType<P>(
198
- element: ReactElement, type: SFC<P>): element is SFCElement<P>;
246
+ element: ReactElement,
247
+ type: SFC<P>,
248
+ ): element is SFCElement<P>;
199
249
  /**
200
250
  * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
201
251
  */
202
252
  export function isElementOfType<P, T extends Component<P>, C extends ComponentClass<P>>(
203
- 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>;
204
256
 
205
257
  /**
206
258
  * Returns `true` if `instance` is a DOM component (such as a `<div>` or `<span>`).
@@ -214,7 +266,9 @@ export function isCompositeComponent(instance: ReactInstance): instance is Compo
214
266
  * Returns `true` if `instance` is a component whose type is of a React `componentClass`.
215
267
  */
216
268
  export function isCompositeComponentWithType<T extends Component<any>, C extends ComponentClass<any>>(
217
- instance: ReactInstance, type: ClassType<any, T, C>): boolean;
269
+ instance: ReactInstance,
270
+ type: ClassType<any, T, C>,
271
+ ): boolean;
218
272
 
219
273
  /**
220
274
  * Traverse all components in `tree` and accumulate all components where
@@ -223,7 +277,8 @@ export function isCompositeComponentWithType<T extends Component<any>, C extends
223
277
  */
224
278
  export function findAllInRenderedTree(
225
279
  root: Component<any>,
226
- fn: (i: ReactInstance) => boolean): ReactInstance[];
280
+ fn: (i: ReactInstance) => boolean,
281
+ ): ReactInstance[];
227
282
 
228
283
  /**
229
284
  * Finds all DOM elements of components in the rendered tree that are
@@ -231,7 +286,8 @@ export function findAllInRenderedTree(
231
286
  */
232
287
  export function scryRenderedDOMComponentsWithClass(
233
288
  root: Component<any>,
234
- className: string): Element[];
289
+ className: string,
290
+ ): Element[];
235
291
  /**
236
292
  * Like `scryRenderedDOMComponentsWithClass()` but expects there to be one result,
237
293
  * and returns that one result, or throws exception if there is any other
@@ -239,7 +295,8 @@ export function scryRenderedDOMComponentsWithClass(
239
295
  */
240
296
  export function findRenderedDOMComponentWithClass(
241
297
  root: Component<any>,
242
- className: string): Element;
298
+ className: string,
299
+ ): Element;
243
300
 
244
301
  /**
245
302
  * Finds all DOM elements of components in the rendered tree that are
@@ -247,7 +304,8 @@ export function findRenderedDOMComponentWithClass(
247
304
  */
248
305
  export function scryRenderedDOMComponentsWithTag(
249
306
  root: Component<any>,
250
- tagName: string): Element[];
307
+ tagName: string,
308
+ ): Element[];
251
309
  /**
252
310
  * Like `scryRenderedDOMComponentsWithTag()` but expects there to be one result,
253
311
  * and returns that one result, or throws exception if there is any other
@@ -255,14 +313,16 @@ export function scryRenderedDOMComponentsWithTag(
255
313
  */
256
314
  export function findRenderedDOMComponentWithTag(
257
315
  root: Component<any>,
258
- tagName: string): Element;
316
+ tagName: string,
317
+ ): Element;
259
318
 
260
319
  /**
261
320
  * Finds all instances of components with type equal to `componentClass`.
262
321
  */
263
322
  export function scryRenderedComponentsWithType<T extends Component<any>, C extends ComponentClass<any>>(
264
323
  root: Component<any>,
265
- type: ClassType<any, T, C>): T[];
324
+ type: ClassType<any, T, C>,
325
+ ): T[];
266
326
 
267
327
  /**
268
328
  * Same as `scryRenderedComponentsWithType()` but expects there to be one result
@@ -271,7 +331,8 @@ export function scryRenderedComponentsWithType<T extends Component<any>, C exten
271
331
  */
272
332
  export function findRenderedComponentWithType<T extends Component<any>, C extends ComponentClass<any>>(
273
333
  root: Component<any>,
274
- type: ClassType<any, T, C>): T;
334
+ type: ClassType<any, T, C>,
335
+ ): T;
275
336
 
276
337
  /**
277
338
  * Call this in your tests to create a shallow renderer.