@types/react 18.3.0 → 18.3.2

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: Thu, 25 Apr 2024 20:07:03 GMT
11
+ * Last updated: Sat, 11 May 2024 10:35:44 GMT
12
12
  * Dependencies: [@types/prop-types](https://npmjs.com/package/@types/prop-types), [csstype](https://npmjs.com/package/csstype)
13
13
 
14
14
  # Credits
react/canary.d.ts CHANGED
@@ -31,30 +31,7 @@ declare const UNDEFINED_VOID_ONLY: unique symbol;
31
31
  type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
32
32
 
33
33
  declare module "." {
34
- interface ThenableImpl<T> {
35
- then(onFulfill: (value: T) => unknown, onReject: (error: unknown) => unknown): void | PromiseLike<unknown>;
36
- }
37
- interface UntrackedThenable<T> extends ThenableImpl<T> {
38
- status?: void;
39
- }
40
-
41
- export interface PendingThenable<T> extends ThenableImpl<T> {
42
- status: "pending";
43
- }
44
-
45
- export interface FulfilledThenable<T> extends ThenableImpl<T> {
46
- status: "fulfilled";
47
- value: T;
48
- }
49
-
50
- export interface RejectedThenable<T> extends ThenableImpl<T> {
51
- status: "rejected";
52
- reason: unknown;
53
- }
54
-
55
- export type Thenable<T> = UntrackedThenable<T> | PendingThenable<T> | FulfilledThenable<T> | RejectedThenable<T>;
56
-
57
- export type Usable<T> = Thenable<T> | Context<T>;
34
+ export type Usable<T> = PromiseLike<T> | Context<T>;
58
35
 
59
36
  export function use<T>(usable: Usable<T>): T;
60
37
 
react/index.d.ts CHANGED
@@ -2126,6 +2126,21 @@ declare namespace React {
2126
2126
  */
2127
2127
  export function startTransition(scope: TransitionFunction): void;
2128
2128
 
2129
+ /**
2130
+ * Wrap any code rendering and triggering updates to your components into `act()` calls.
2131
+ *
2132
+ * Ensures that the behavior in your tests matches what happens in the browser
2133
+ * more closely by executing pending `useEffect`s before returning. This also
2134
+ * reduces the amount of re-renders done.
2135
+ *
2136
+ * @param callback A synchronous, void callback that will execute as a single, complete React commit.
2137
+ *
2138
+ * @see https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks
2139
+ */
2140
+ // While act does always return Thenable, if a void function is passed, we pretend the return value is also void to not trigger dangling Promise lint rules.
2141
+ export function act(callback: () => VoidOrUndefinedOnly): void;
2142
+ export function act<T>(callback: () => T | Promise<T>): Promise<T>;
2143
+
2129
2144
  export function useId(): string;
2130
2145
 
2131
2146
  /**
react/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react",
3
- "version": "18.3.0",
3
+ "version": "18.3.2",
4
4
  "description": "TypeScript definitions for react",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
6
6
  "license": "MIT",
@@ -205,6 +205,6 @@
205
205
  "@types/prop-types": "*",
206
206
  "csstype": "^3.0.2"
207
207
  },
208
- "typesPublisherContentHash": "1093bc44781bcac15850f1b23f283097f357555c55e42d87324ecdaa8b6ebed9",
208
+ "typesPublisherContentHash": "e63279aa450130dc18d97965c05f4d9894b1c09a879bb8a888cece44220f7bf3",
209
209
  "typeScriptVersion": "4.7"
210
210
  }
react/ts5.0/canary.d.ts CHANGED
@@ -31,30 +31,7 @@ declare const UNDEFINED_VOID_ONLY: unique symbol;
31
31
  type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
32
32
 
33
33
  declare module "." {
34
- interface ThenableImpl<T> {
35
- then(onFulfill: (value: T) => unknown, onReject: (error: unknown) => unknown): void | PromiseLike<unknown>;
36
- }
37
- interface UntrackedThenable<T> extends ThenableImpl<T> {
38
- status?: void;
39
- }
40
-
41
- export interface PendingThenable<T> extends ThenableImpl<T> {
42
- status: "pending";
43
- }
44
-
45
- export interface FulfilledThenable<T> extends ThenableImpl<T> {
46
- status: "fulfilled";
47
- value: T;
48
- }
49
-
50
- export interface RejectedThenable<T> extends ThenableImpl<T> {
51
- status: "rejected";
52
- reason: unknown;
53
- }
54
-
55
- export type Thenable<T> = UntrackedThenable<T> | PendingThenable<T> | FulfilledThenable<T> | RejectedThenable<T>;
56
-
57
- export type Usable<T> = Thenable<T> | Context<T>;
34
+ export type Usable<T> = PromiseLike<T> | Context<T>;
58
35
 
59
36
  export function use<T>(usable: Usable<T>): T;
60
37
 
react/ts5.0/index.d.ts CHANGED
@@ -2127,6 +2127,21 @@ declare namespace React {
2127
2127
  */
2128
2128
  export function startTransition(scope: TransitionFunction): void;
2129
2129
 
2130
+ /**
2131
+ * Wrap any code rendering and triggering updates to your components into `act()` calls.
2132
+ *
2133
+ * Ensures that the behavior in your tests matches what happens in the browser
2134
+ * more closely by executing pending `useEffect`s before returning. This also
2135
+ * reduces the amount of re-renders done.
2136
+ *
2137
+ * @param callback A synchronous, void callback that will execute as a single, complete React commit.
2138
+ *
2139
+ * @see https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks
2140
+ */
2141
+ // While act does always return Thenable, if a void function is passed, we pretend the return value is also void to not trigger dangling Promise lint rules.
2142
+ export function act(callback: () => VoidOrUndefinedOnly): void;
2143
+ export function act<T>(callback: () => T | Promise<T>): Promise<T>;
2144
+
2130
2145
  export function useId(): string;
2131
2146
 
2132
2147
  /**