@types/react 18.0.20 → 18.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/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for React (http://facebook.github.io/reac
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Tue, 13 Sep 2022 18:33:02 GMT
11
+ * Last updated: Mon, 24 Oct 2022 17:02:37 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
@@ -103,30 +103,6 @@ declare module '.' {
103
103
  */
104
104
  export const SuspenseList: ExoticComponent<SuspenseListProps>;
105
105
 
106
- interface ThenableImpl<T> {
107
- then(onFulfill: (value: T) => unknown, onReject: (error: unknown) => unknown): void | PromiseLike<unknown>;
108
- }
109
- interface UntrackedThenable<T> extends ThenableImpl<T> {
110
- status?: void;
111
- }
112
-
113
- export interface PendingThenable<T> extends ThenableImpl<T> {
114
- status: 'pending';
115
- }
116
-
117
- export interface FulfilledThenable<T> extends ThenableImpl<T> {
118
- status: 'fulfilled';
119
- value: T;
120
- }
121
-
122
- export interface RejectedThenable<T> extends ThenableImpl<T> {
123
- status: 'rejected';
124
- reason: unknown;
125
- }
126
-
127
- export type Thenable<T> = UntrackedThenable<T> | PendingThenable<T> | FulfilledThenable<T> | RejectedThenable<T>;
128
-
129
- export type Usable<T> = Thenable<T> | Context<T>;
130
-
131
- export function experimental_use<T>(usable: Usable<T>): T;
106
+ // tslint:disable-next-line ban-types
107
+ export function experimental_useEvent<T extends Function>(event: T): T;
132
108
  }
react/next.d.ts CHANGED
@@ -27,4 +27,60 @@ import React = require('.');
27
27
 
28
28
  export {};
29
29
 
30
- declare module '.' {}
30
+ declare module '.' {
31
+ interface ThenableImpl<T> {
32
+ then(onFulfill: (value: T) => unknown, onReject: (error: unknown) => unknown): void | PromiseLike<unknown>;
33
+ }
34
+ interface UntrackedThenable<T> extends ThenableImpl<T> {
35
+ status?: void;
36
+ }
37
+
38
+ export interface PendingThenable<T> extends ThenableImpl<T> {
39
+ status: 'pending';
40
+ }
41
+
42
+ export interface FulfilledThenable<T> extends ThenableImpl<T> {
43
+ status: 'fulfilled';
44
+ value: T;
45
+ }
46
+
47
+ export interface RejectedThenable<T> extends ThenableImpl<T> {
48
+ status: 'rejected';
49
+ reason: unknown;
50
+ }
51
+
52
+ export type Thenable<T> = UntrackedThenable<T> | PendingThenable<T> | FulfilledThenable<T> | RejectedThenable<T>;
53
+
54
+ export type Usable<T> = Thenable<T> | Context<T>;
55
+
56
+ export function use<T>(usable: Usable<T>): T;
57
+
58
+ interface ServerContextJSONArray extends ReadonlyArray<ServerContextJSONArray> {}
59
+ export type ServerContextJSONValue =
60
+ | string
61
+ | boolean
62
+ | number
63
+ | null
64
+ | ServerContextJSONArray
65
+ | { [key: string]: ServerContextJSONValue };
66
+ export interface ServerContext<T extends ServerContextJSONValue> {
67
+ Provider: Provider<T>;
68
+ }
69
+ /**
70
+ * Accepts a context object (the value returned from `React.createContext` or `React.createServerContext`) and returns the current
71
+ * context value, as given by the nearest context provider for the given context.
72
+ *
73
+ * @version 16.8.0
74
+ * @see https://reactjs.org/docs/hooks-reference.html#usecontext
75
+ */
76
+ function useContext<T extends ServerContextJSONValue>(context: ServerContext<T>): T;
77
+ export function createServerContext<T extends ServerContextJSONValue>(
78
+ globalName: string,
79
+ defaultValue: T,
80
+ ): ServerContext<T>;
81
+
82
+ // tslint:disable-next-line ban-types
83
+ export function cache<CachedFunction extends Function>(fn: CachedFunction): CachedFunction;
84
+
85
+ export function unstable_useCacheRefresh(): () => void;
86
+ }
react/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react",
3
- "version": "18.0.20",
3
+ "version": "18.0.22",
4
4
  "description": "TypeScript definitions for React",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
6
6
  "license": "MIT",
@@ -146,7 +146,7 @@
146
146
  "@types/scheduler": "*",
147
147
  "csstype": "^3.0.2"
148
148
  },
149
- "typesPublisherContentHash": "5141abe6a2c43cc650ba3ed0a923551e987617cf326b31e0d27000519f0ae22e",
149
+ "typesPublisherContentHash": "f092726471afd8e8301f411b8985d23d0afc491893fe654a3d4995e7daf48ea1",
150
150
  "typeScriptVersion": "4.1",
151
151
  "exports": {
152
152
  ".": {