@types/react 18.2.2 → 18.2.4

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/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for React (https://react.dev/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Wed, 03 May 2023 20:32:43 GMT
11
+ * Last updated: Thu, 04 May 2023 07:32:47 GMT
12
12
  * Dependencies: [@types/csstype](https://npmjs.com/package/@types/csstype), [@types/prop-types](https://npmjs.com/package/@types/prop-types), [@types/scheduler](https://npmjs.com/package/@types/scheduler)
13
13
  * Global values: `React`
14
14
 
react/experimental.d.ts CHANGED
@@ -42,6 +42,12 @@ declare const UNDEFINED_VOID_ONLY: unique symbol;
42
42
  type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
43
43
 
44
44
  declare module '.' {
45
+ // Need an interface to not cause ReactNode to be a self-referential type.
46
+ interface PromiseLikeOfReactNode extends PromiseLike<ReactNode> {}
47
+ interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES {
48
+ promises: PromiseLikeOfReactNode;
49
+ }
50
+
45
51
  export interface SuspenseProps {
46
52
  /**
47
53
  * The presence of this prop indicates that the content is computationally expensive to render.
@@ -123,4 +129,9 @@ declare module '.' {
123
129
  */
124
130
  (callback: () => Promise<VoidOrUndefinedOnly>): void;
125
131
  }
132
+
133
+ function experimental_useOptimistic<State, Action>(
134
+ passthrough: State,
135
+ reducer?: (state: State, action: Action) => State,
136
+ ): [State, (action: Action) => void];
126
137
  }
react/index.d.ts CHANGED
@@ -238,7 +238,23 @@ declare namespace React {
238
238
  */
239
239
  interface ReactNodeArray extends ReadonlyArray<ReactNode> {}
240
240
  type ReactFragment = Iterable<ReactNode>;
241
- type ReactNode = ReactElement | string | number | ReactFragment | ReactPortal | boolean | null | undefined;
241
+
242
+ /**
243
+ * For internal usage only.
244
+ * Different release channels declare additional types of ReactNode this particular release channel accepts.
245
+ * App or library types should never augment this interface.
246
+ */
247
+ interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES {}
248
+ type ReactNode =
249
+ | ReactElement
250
+ | string
251
+ | number
252
+ | ReactFragment
253
+ | ReactPortal
254
+ | boolean
255
+ | null
256
+ | undefined
257
+ | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES];
242
258
 
243
259
  //
244
260
  // Top Level API
react/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react",
3
- "version": "18.2.2",
3
+ "version": "18.2.4",
4
4
  "description": "TypeScript definitions for React",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
6
6
  "license": "MIT",
@@ -158,7 +158,7 @@
158
158
  "@types/scheduler": "*",
159
159
  "csstype": "^3.0.2"
160
160
  },
161
- "typesPublisherContentHash": "e929af8a16a9eb46475643cee5493bf45dcf962806ff8ddc1e0200888ff4fed2",
161
+ "typesPublisherContentHash": "ae285a1f71e01ae214d0d07feb6897bda4d6ac1e892d2b4138170e851772d2c3",
162
162
  "typeScriptVersion": "4.3",
163
163
  "exports": {
164
164
  ".": {
@@ -42,6 +42,12 @@ declare const UNDEFINED_VOID_ONLY: unique symbol;
42
42
  type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
43
43
 
44
44
  declare module '.' {
45
+ // Need an interface to not cause ReactNode to be a self-referential type.
46
+ interface PromiseLikeOfReactNode extends PromiseLike<ReactNode> {}
47
+ interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES {
48
+ promises: PromiseLikeOfReactNode;
49
+ }
50
+
45
51
  export interface SuspenseProps {
46
52
  /**
47
53
  * The presence of this prop indicates that the content is computationally expensive to render.
@@ -123,4 +129,9 @@ declare module '.' {
123
129
  */
124
130
  (callback: () => Promise<VoidOrUndefinedOnly>): void;
125
131
  }
132
+
133
+ function experimental_useOptimistic<State, Action>(
134
+ passthrough: State,
135
+ reducer?: (state: State, action: Action) => State,
136
+ ): [State, (action: Action) => void];
126
137
  }
react/ts5.0/index.d.ts CHANGED
@@ -206,7 +206,23 @@ declare namespace React {
206
206
  */
207
207
  interface ReactNodeArray extends ReadonlyArray<ReactNode> {}
208
208
  type ReactFragment = Iterable<ReactNode>;
209
- type ReactNode = ReactElement | string | number | ReactFragment | ReactPortal | boolean | null | undefined;
209
+
210
+ /**
211
+ * For internal usage only.
212
+ * Different release channels declare additional types of ReactNode this particular release channel accepts.
213
+ * App or library types should never augment this interface.
214
+ */
215
+ interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES {}
216
+ type ReactNode =
217
+ | ReactElement
218
+ | string
219
+ | number
220
+ | ReactFragment
221
+ | ReactPortal
222
+ | boolean
223
+ | null
224
+ | undefined
225
+ | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES];
210
226
 
211
227
  //
212
228
  // Top Level API