@types/react 17.0.41 → 17.0.44
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 → react v17.0}/LICENSE +0 -0
- react/README.md → react v17.0/README.md +2 -2
- react/global.d.ts → react v17.0/global.d.ts +4 -0
- react/index.d.ts → react v17.0/index.d.ts +14 -21
- {react → react v17.0}/jsx-dev-runtime.d.ts +0 -0
- {react → react v17.0}/jsx-runtime.d.ts +0 -0
- react/package.json → react v17.0/package.json +2 -2
- react/experimental.d.ts +0 -96
- react/next.d.ts +0 -148
{react → react v17.0}/LICENSE
RENAMED
File without changes
|
@@ -5,10 +5,10 @@
|
|
5
5
|
This package contains type definitions for React (http://facebook.github.io/react/).
|
6
6
|
|
7
7
|
# Details
|
8
|
-
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react.
|
8
|
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react/v17.
|
9
9
|
|
10
10
|
### Additional Details
|
11
|
-
* Last updated:
|
11
|
+
* Last updated: Thu, 07 Apr 2022 17:31:22 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
|
|
@@ -40,6 +40,7 @@ interface HTMLButtonElement extends HTMLElement { }
|
|
40
40
|
interface HTMLCanvasElement extends HTMLElement { }
|
41
41
|
interface HTMLDataElement extends HTMLElement { }
|
42
42
|
interface HTMLDataListElement extends HTMLElement { }
|
43
|
+
interface HTMLDetailsElement extends HTMLElement { }
|
43
44
|
interface HTMLDialogElement extends HTMLElement { }
|
44
45
|
interface HTMLDivElement extends HTMLElement { }
|
45
46
|
interface HTMLDListElement extends HTMLElement { }
|
@@ -60,10 +61,12 @@ interface HTMLLIElement extends HTMLElement { }
|
|
60
61
|
interface HTMLLinkElement extends HTMLElement { }
|
61
62
|
interface HTMLMapElement extends HTMLElement { }
|
62
63
|
interface HTMLMetaElement extends HTMLElement { }
|
64
|
+
interface HTMLMeterElement extends HTMLElement { }
|
63
65
|
interface HTMLObjectElement extends HTMLElement { }
|
64
66
|
interface HTMLOListElement extends HTMLElement { }
|
65
67
|
interface HTMLOptGroupElement extends HTMLElement { }
|
66
68
|
interface HTMLOptionElement extends HTMLElement { }
|
69
|
+
interface HTMLOutputElement extends HTMLElement { }
|
67
70
|
interface HTMLParagraphElement extends HTMLElement { }
|
68
71
|
interface HTMLParamElement extends HTMLElement { }
|
69
72
|
interface HTMLPreElement extends HTMLElement { }
|
@@ -83,6 +86,7 @@ interface HTMLTableRowElement extends HTMLElement { }
|
|
83
86
|
interface HTMLTableSectionElement extends HTMLElement { }
|
84
87
|
interface HTMLTemplateElement extends HTMLElement { }
|
85
88
|
interface HTMLTextAreaElement extends HTMLElement { }
|
89
|
+
interface HTMLTimeElement extends HTMLElement { }
|
86
90
|
interface HTMLTitleElement extends HTMLElement { }
|
87
91
|
interface HTMLTrackElement extends HTMLElement { }
|
88
92
|
interface HTMLUListElement extends HTMLElement { }
|
@@ -29,14 +29,6 @@
|
|
29
29
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
30
30
|
// TypeScript Version: 2.8
|
31
31
|
|
32
|
-
// NOTE: Users of the upcoming React 18 release should add a reference
|
33
|
-
// to 'react/next' in their project. See next.d.ts's top comment
|
34
|
-
// for reference and documentation on how exactly to do it.
|
35
|
-
|
36
|
-
// NOTE: Users of the `experimental` builds of React should add a reference
|
37
|
-
// to 'react/experimental' in their project. See experimental.d.ts's top comment
|
38
|
-
// for reference and documentation on how exactly to do it.
|
39
|
-
|
40
32
|
/// <reference path="global.d.ts" />
|
41
33
|
|
42
34
|
import * as CSS from 'csstype';
|
@@ -88,7 +80,8 @@ declare namespace React {
|
|
88
80
|
interface RefObject<T> {
|
89
81
|
readonly current: T | null;
|
90
82
|
}
|
91
|
-
|
83
|
+
// Bivariance hack for consistent unsoundness with RefObject
|
84
|
+
type RefCallback<T> = { bivarianceHack(instance: T | null): void }["bivarianceHack"];
|
92
85
|
type Ref<T> = RefCallback<T> | RefObject<T> | null;
|
93
86
|
type LegacyRef<T> = string | Ref<T>;
|
94
87
|
/**
|
@@ -2779,7 +2772,7 @@ declare namespace React {
|
|
2779
2772
|
bdi: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
2780
2773
|
bdo: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
2781
2774
|
big: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
2782
|
-
blockquote: DetailedHTMLFactory<BlockquoteHTMLAttributes<
|
2775
|
+
blockquote: DetailedHTMLFactory<BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
|
2783
2776
|
body: DetailedHTMLFactory<HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>;
|
2784
2777
|
br: DetailedHTMLFactory<HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
|
2785
2778
|
button: DetailedHTMLFactory<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
|
@@ -2792,8 +2785,8 @@ declare namespace React {
|
|
2792
2785
|
data: DetailedHTMLFactory<DataHTMLAttributes<HTMLDataElement>, HTMLDataElement>;
|
2793
2786
|
datalist: DetailedHTMLFactory<HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>;
|
2794
2787
|
dd: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
2795
|
-
del: DetailedHTMLFactory<DelHTMLAttributes<
|
2796
|
-
details: DetailedHTMLFactory<DetailsHTMLAttributes<
|
2788
|
+
del: DetailedHTMLFactory<DelHTMLAttributes<HTMLModElement>, HTMLModElement>;
|
2789
|
+
details: DetailedHTMLFactory<DetailsHTMLAttributes<HTMLDetailsElement>, HTMLDetailsElement>;
|
2797
2790
|
dfn: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
2798
2791
|
dialog: DetailedHTMLFactory<DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>;
|
2799
2792
|
div: DetailedHTMLFactory<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
@@ -2834,14 +2827,14 @@ declare namespace React {
|
|
2834
2827
|
menu: DetailedHTMLFactory<MenuHTMLAttributes<HTMLElement>, HTMLElement>;
|
2835
2828
|
menuitem: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
2836
2829
|
meta: DetailedHTMLFactory<MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>;
|
2837
|
-
meter: DetailedHTMLFactory<MeterHTMLAttributes<
|
2830
|
+
meter: DetailedHTMLFactory<MeterHTMLAttributes<HTMLMeterElement>, HTMLMeterElement>;
|
2838
2831
|
nav: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
2839
2832
|
noscript: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
2840
2833
|
object: DetailedHTMLFactory<ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>;
|
2841
2834
|
ol: DetailedHTMLFactory<OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>;
|
2842
2835
|
optgroup: DetailedHTMLFactory<OptgroupHTMLAttributes<HTMLOptGroupElement>, HTMLOptGroupElement>;
|
2843
2836
|
option: DetailedHTMLFactory<OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>;
|
2844
|
-
output: DetailedHTMLFactory<OutputHTMLAttributes<
|
2837
|
+
output: DetailedHTMLFactory<OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>;
|
2845
2838
|
p: DetailedHTMLFactory<HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>;
|
2846
2839
|
param: DetailedHTMLFactory<ParamHTMLAttributes<HTMLParamElement>, HTMLParamElement>;
|
2847
2840
|
picture: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
@@ -2873,7 +2866,7 @@ declare namespace React {
|
|
2873
2866
|
tfoot: DetailedHTMLFactory<HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
|
2874
2867
|
th: DetailedHTMLFactory<ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>;
|
2875
2868
|
thead: DetailedHTMLFactory<HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
|
2876
|
-
time: DetailedHTMLFactory<TimeHTMLAttributes<
|
2869
|
+
time: DetailedHTMLFactory<TimeHTMLAttributes<HTMLTimeElement>, HTMLTimeElement>;
|
2877
2870
|
title: DetailedHTMLFactory<HTMLAttributes<HTMLTitleElement>, HTMLTitleElement>;
|
2878
2871
|
tr: DetailedHTMLFactory<HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>;
|
2879
2872
|
track: DetailedHTMLFactory<TrackHTMLAttributes<HTMLTrackElement>, HTMLTrackElement>;
|
@@ -3110,7 +3103,7 @@ declare global {
|
|
3110
3103
|
bdi: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
3111
3104
|
bdo: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
3112
3105
|
big: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
3113
|
-
blockquote: React.DetailedHTMLProps<React.BlockquoteHTMLAttributes<
|
3106
|
+
blockquote: React.DetailedHTMLProps<React.BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
|
3114
3107
|
body: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>;
|
3115
3108
|
br: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
|
3116
3109
|
button: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
|
@@ -3123,8 +3116,8 @@ declare global {
|
|
3123
3116
|
data: React.DetailedHTMLProps<React.DataHTMLAttributes<HTMLDataElement>, HTMLDataElement>;
|
3124
3117
|
datalist: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>;
|
3125
3118
|
dd: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
3126
|
-
del: React.DetailedHTMLProps<React.DelHTMLAttributes<
|
3127
|
-
details: React.DetailedHTMLProps<React.DetailsHTMLAttributes<
|
3119
|
+
del: React.DetailedHTMLProps<React.DelHTMLAttributes<HTMLModElement>, HTMLModElement>;
|
3120
|
+
details: React.DetailedHTMLProps<React.DetailsHTMLAttributes<HTMLDetailsElement>, HTMLDetailsElement>;
|
3128
3121
|
dfn: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
3129
3122
|
dialog: React.DetailedHTMLProps<React.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>;
|
3130
3123
|
div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
@@ -3165,7 +3158,7 @@ declare global {
|
|
3165
3158
|
menu: React.DetailedHTMLProps<React.MenuHTMLAttributes<HTMLElement>, HTMLElement>;
|
3166
3159
|
menuitem: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
3167
3160
|
meta: React.DetailedHTMLProps<React.MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>;
|
3168
|
-
meter: React.DetailedHTMLProps<React.MeterHTMLAttributes<
|
3161
|
+
meter: React.DetailedHTMLProps<React.MeterHTMLAttributes<HTMLMeterElement>, HTMLMeterElement>;
|
3169
3162
|
nav: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
3170
3163
|
noindex: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
3171
3164
|
noscript: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
@@ -3173,7 +3166,7 @@ declare global {
|
|
3173
3166
|
ol: React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>;
|
3174
3167
|
optgroup: React.DetailedHTMLProps<React.OptgroupHTMLAttributes<HTMLOptGroupElement>, HTMLOptGroupElement>;
|
3175
3168
|
option: React.DetailedHTMLProps<React.OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>;
|
3176
|
-
output: React.DetailedHTMLProps<React.OutputHTMLAttributes<
|
3169
|
+
output: React.DetailedHTMLProps<React.OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>;
|
3177
3170
|
p: React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>;
|
3178
3171
|
param: React.DetailedHTMLProps<React.ParamHTMLAttributes<HTMLParamElement>, HTMLParamElement>;
|
3179
3172
|
picture: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
@@ -3205,7 +3198,7 @@ declare global {
|
|
3205
3198
|
tfoot: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
|
3206
3199
|
th: React.DetailedHTMLProps<React.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>;
|
3207
3200
|
thead: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
|
3208
|
-
time: React.DetailedHTMLProps<React.TimeHTMLAttributes<
|
3201
|
+
time: React.DetailedHTMLProps<React.TimeHTMLAttributes<HTMLTimeElement>, HTMLTimeElement>;
|
3209
3202
|
title: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTitleElement>, HTMLTitleElement>;
|
3210
3203
|
tr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>;
|
3211
3204
|
track: React.DetailedHTMLProps<React.TrackHTMLAttributes<HTMLTrackElement>, HTMLTrackElement>;
|
File without changes
|
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/react",
|
3
|
-
"version": "17.0.
|
3
|
+
"version": "17.0.44",
|
4
4
|
"description": "TypeScript definitions for React",
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
|
6
6
|
"license": "MIT",
|
@@ -146,6 +146,6 @@
|
|
146
146
|
"@types/scheduler": "*",
|
147
147
|
"csstype": "^3.0.2"
|
148
148
|
},
|
149
|
-
"typesPublisherContentHash": "
|
149
|
+
"typesPublisherContentHash": "e2337761fa2e58147fa60cfb84ff8c8c71c26c6c9f87260f220e15cb430c5ca4",
|
150
150
|
"typeScriptVersion": "3.9"
|
151
151
|
}
|
react/experimental.d.ts
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* These are types for things that are present in the `experimental` builds of React but not yet
|
3
|
-
* on a stable build.
|
4
|
-
*
|
5
|
-
* Once they are promoted to stable they can just be moved to the main index file.
|
6
|
-
*
|
7
|
-
* To load the types declared here in an actual project, there are three ways. The easiest one,
|
8
|
-
* if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section,
|
9
|
-
* is to add `"react/experimental"` to the `"types"` array.
|
10
|
-
*
|
11
|
-
* Alternatively, a specific import syntax can to be used from a typescript file.
|
12
|
-
* This module does not exist in reality, which is why the {} is important:
|
13
|
-
*
|
14
|
-
* ```ts
|
15
|
-
* import {} from 'react/experimental'
|
16
|
-
* ```
|
17
|
-
*
|
18
|
-
* It is also possible to include it through a triple-slash reference:
|
19
|
-
*
|
20
|
-
* ```ts
|
21
|
-
* /// <reference types="react/experimental" />
|
22
|
-
* ```
|
23
|
-
*
|
24
|
-
* Either the import or the reference only needs to appear once, anywhere in the project.
|
25
|
-
*/
|
26
|
-
|
27
|
-
// See https://github.com/facebook/react/blob/master/packages/react/src/React.js to see how the exports are declared,
|
28
|
-
// and https://github.com/facebook/react/blob/master/packages/shared/ReactFeatureFlags.js to verify which APIs are
|
29
|
-
// flagged experimental or not. Experimental APIs will be tagged with `__EXPERIMENTAL__`.
|
30
|
-
//
|
31
|
-
// For the inputs of types exported as simply a fiber tag, the `beginWork` function of ReactFiberBeginWork.js
|
32
|
-
// is a good place to start looking for details; it generally calls prop validation functions or delegates
|
33
|
-
// all tasks done as part of the render phase (the concurrent part of the React update cycle).
|
34
|
-
//
|
35
|
-
// Suspense-related handling can be found in ReactFiberThrow.js.
|
36
|
-
|
37
|
-
import React = require('./next');
|
38
|
-
|
39
|
-
export {};
|
40
|
-
|
41
|
-
declare module '.' {
|
42
|
-
export type SuspenseListRevealOrder = 'forwards' | 'backwards' | 'together';
|
43
|
-
export type SuspenseListTailMode = 'collapsed' | 'hidden';
|
44
|
-
|
45
|
-
export interface SuspenseListCommonProps {
|
46
|
-
/**
|
47
|
-
* Note that SuspenseList require more than one child;
|
48
|
-
* it is a runtime warning to provide only a single child.
|
49
|
-
*
|
50
|
-
* It does, however, allow those children to be wrapped inside a single
|
51
|
-
* level of `<React.Fragment>`.
|
52
|
-
*/
|
53
|
-
children: ReactElement | Iterable<ReactElement>;
|
54
|
-
}
|
55
|
-
|
56
|
-
interface DirectionalSuspenseListProps extends SuspenseListCommonProps {
|
57
|
-
/**
|
58
|
-
* Defines the order in which the `SuspenseList` children should be revealed.
|
59
|
-
*/
|
60
|
-
revealOrder: 'forwards' | 'backwards';
|
61
|
-
/**
|
62
|
-
* Dictates how unloaded items in a SuspenseList is shown.
|
63
|
-
*
|
64
|
-
* - By default, `SuspenseList` will show all fallbacks in the list.
|
65
|
-
* - `collapsed` shows only the next fallback in the list.
|
66
|
-
* - `hidden` doesn’t show any unloaded items.
|
67
|
-
*/
|
68
|
-
tail?: SuspenseListTailMode | undefined;
|
69
|
-
}
|
70
|
-
|
71
|
-
interface NonDirectionalSuspenseListProps extends SuspenseListCommonProps {
|
72
|
-
/**
|
73
|
-
* Defines the order in which the `SuspenseList` children should be revealed.
|
74
|
-
*/
|
75
|
-
revealOrder?: Exclude<SuspenseListRevealOrder, DirectionalSuspenseListProps['revealOrder']> | undefined;
|
76
|
-
/**
|
77
|
-
* The tail property is invalid when not using the `forwards` or `backwards` reveal orders.
|
78
|
-
*/
|
79
|
-
tail?: never | undefined;
|
80
|
-
}
|
81
|
-
|
82
|
-
export type SuspenseListProps = DirectionalSuspenseListProps | NonDirectionalSuspenseListProps;
|
83
|
-
|
84
|
-
/**
|
85
|
-
* `SuspenseList` helps coordinate many components that can suspend by orchestrating the order
|
86
|
-
* in which these components are revealed to the user.
|
87
|
-
*
|
88
|
-
* When multiple components need to fetch data, this data may arrive in an unpredictable order.
|
89
|
-
* However, if you wrap these items in a `SuspenseList`, React will not show an item in the list
|
90
|
-
* until previous items have been displayed (this behavior is adjustable).
|
91
|
-
*
|
92
|
-
* @see https://reactjs.org/docs/concurrent-mode-reference.html#suspenselist
|
93
|
-
* @see https://reactjs.org/docs/concurrent-mode-patterns.html#suspenselist
|
94
|
-
*/
|
95
|
-
export const SuspenseList: ExoticComponent<SuspenseListProps>;
|
96
|
-
}
|
react/next.d.ts
DELETED
@@ -1,148 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* These are types for things that are present in the upcoming React 18 release.
|
3
|
-
*
|
4
|
-
* Once React 18 is released they can just be moved to the main index file.
|
5
|
-
*
|
6
|
-
* To load the types declared here in an actual project, there are three ways. The easiest one,
|
7
|
-
* if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section,
|
8
|
-
* is to add `"react/next"` to the `"types"` array.
|
9
|
-
*
|
10
|
-
* Alternatively, a specific import syntax can to be used from a typescript file.
|
11
|
-
* This module does not exist in reality, which is why the {} is important:
|
12
|
-
*
|
13
|
-
* ```ts
|
14
|
-
* import {} from 'react/next'
|
15
|
-
* ```
|
16
|
-
*
|
17
|
-
* It is also possible to include it through a triple-slash reference:
|
18
|
-
*
|
19
|
-
* ```ts
|
20
|
-
* /// <reference types="react/next" />
|
21
|
-
* ```
|
22
|
-
*
|
23
|
-
* Either the import or the reference only needs to appear once, anywhere in the project.
|
24
|
-
*/
|
25
|
-
|
26
|
-
// See https://github.com/facebook/react/blob/master/packages/react/src/React.js to see how the exports are declared,
|
27
|
-
|
28
|
-
import React = require('.');
|
29
|
-
|
30
|
-
export {};
|
31
|
-
|
32
|
-
declare const UNDEFINED_VOID_ONLY: unique symbol;
|
33
|
-
type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
|
34
|
-
|
35
|
-
declare module '.' {
|
36
|
-
export interface SuspenseProps {
|
37
|
-
/**
|
38
|
-
* The presence of this prop indicates that the content is computationally expensive to render.
|
39
|
-
* In other words, the tree is CPU bound and not I/O bound (e.g. due to fetching data).
|
40
|
-
* @see {@link https://github.com/facebook/react/pull/19936}
|
41
|
-
*/
|
42
|
-
unstable_expectedLoadTime?: number | undefined;
|
43
|
-
}
|
44
|
-
|
45
|
-
// must be synchronous
|
46
|
-
export type TransitionFunction = () => VoidOrUndefinedOnly;
|
47
|
-
// strange definition to allow vscode to show documentation on the invocation
|
48
|
-
export interface TransitionStartFunction {
|
49
|
-
/**
|
50
|
-
* State updates caused inside the callback are allowed to be deferred.
|
51
|
-
*
|
52
|
-
* **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
|
53
|
-
*
|
54
|
-
* @param callback A _synchronous_ function which causes state updates that can be deferred.
|
55
|
-
*/
|
56
|
-
(callback: TransitionFunction): void;
|
57
|
-
}
|
58
|
-
|
59
|
-
/**
|
60
|
-
* Returns a deferred version of the value that may “lag behind” it for at most `timeoutMs`.
|
61
|
-
*
|
62
|
-
* This is commonly used to keep the interface responsive when you have something that renders immediately
|
63
|
-
* based on user input and something that needs to wait for a data fetch.
|
64
|
-
*
|
65
|
-
* A good example of this is a text input.
|
66
|
-
*
|
67
|
-
* @param value The value that is going to be deferred
|
68
|
-
*
|
69
|
-
* @see https://reactjs.org/docs/concurrent-mode-reference.html#usedeferredvalue
|
70
|
-
*/
|
71
|
-
export function useDeferredValue<T>(value: T): T;
|
72
|
-
|
73
|
-
/**
|
74
|
-
* Allows components to avoid undesirable loading states by waiting for content to load
|
75
|
-
* before transitioning to the next screen. It also allows components to defer slower,
|
76
|
-
* data fetching updates until subsequent renders so that more crucial updates can be
|
77
|
-
* rendered immediately.
|
78
|
-
*
|
79
|
-
* The `useTransition` hook returns two values in an array.
|
80
|
-
*
|
81
|
-
* The first is a boolean, React’s way of informing us whether we’re waiting for the transition to finish.
|
82
|
-
* The second is a function that takes a callback. We can use it to tell React which state we want to defer.
|
83
|
-
*
|
84
|
-
* **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
|
85
|
-
*
|
86
|
-
* @param config An optional object with `timeoutMs`
|
87
|
-
*
|
88
|
-
* @see https://reactjs.org/docs/concurrent-mode-reference.html#usetransition
|
89
|
-
*/
|
90
|
-
export function useTransition(): [boolean, TransitionStartFunction];
|
91
|
-
|
92
|
-
/**
|
93
|
-
* Similar to `useTransition` but allows uses where hooks are not available.
|
94
|
-
*
|
95
|
-
* @param callback A _synchronous_ function which causes state updates that can be deferred.
|
96
|
-
*/
|
97
|
-
export function startTransition(scope: TransitionFunction): void;
|
98
|
-
|
99
|
-
export function useId(): string;
|
100
|
-
|
101
|
-
/**
|
102
|
-
* this should be an internal type
|
103
|
-
*/
|
104
|
-
interface MutableSource<T> {
|
105
|
-
_source: T;
|
106
|
-
}
|
107
|
-
|
108
|
-
export type MutableSourceSubscribe<T> = (source: T, callback: () => void) => () => void;
|
109
|
-
|
110
|
-
/**
|
111
|
-
* @param source A source could be anything as long as they can be subscribed to and have a "version".
|
112
|
-
* @param getVersion A function returns a value which will change whenever part of the source changes.
|
113
|
-
*/
|
114
|
-
export function unstable_createMutableSource<T>(source: T, getVersion: () => any): MutableSource<T>;
|
115
|
-
|
116
|
-
/**
|
117
|
-
* useMutableSource() enables React components to safely and efficiently read from a mutable external source in Concurrent Mode.
|
118
|
-
* The API will detect mutations that occur during a render to avoid tearing
|
119
|
-
* and it will automatically schedule updates when the source is mutated.
|
120
|
-
* @param MutableSource
|
121
|
-
* @param getSnapshot
|
122
|
-
* @param subscribe
|
123
|
-
*
|
124
|
-
* @see https://github.com/reactjs/rfcs/blob/master/text/0147-use-mutable-source.md
|
125
|
-
*/
|
126
|
-
export function unstable_useMutableSource<T, TResult extends unknown>(MutableSource: MutableSource<T>, getSnapshot: (source: T) => TResult, subscribe: MutableSourceSubscribe<T>): TResult;
|
127
|
-
|
128
|
-
/**
|
129
|
-
* @param effect Imperative function that can return a cleanup function
|
130
|
-
* @param deps If present, effect will only activate if the values in the list change.
|
131
|
-
*
|
132
|
-
* @see https://github.com/facebook/react/pull/21913
|
133
|
-
*/
|
134
|
-
export function useInsertionEffect(effect: EffectCallback, deps?: DependencyList): void;
|
135
|
-
|
136
|
-
/**
|
137
|
-
* @param subscribe
|
138
|
-
* @param getSnapshot
|
139
|
-
*
|
140
|
-
* @see https://github.com/reactwg/react-18/discussions/86
|
141
|
-
*/
|
142
|
-
// keep in sync with `useSyncExternalStore` from `use-sync-external-store`
|
143
|
-
export function useSyncExternalStore<Snapshot>(
|
144
|
-
subscribe: (onStoreChange: () => void) => () => void,
|
145
|
-
getSnapshot: () => Snapshot,
|
146
|
-
getServerSnapshot?: () => Snapshot,
|
147
|
-
): Snapshot;
|
148
|
-
}
|