@types/react 16.14.0 → 16.14.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 → react v16.14}/LICENSE +0 -0
- react/README.md → react v16.14/README.md +2 -2
- {react → react v16.14}/global.d.ts +0 -0
- react/index.d.ts → react v16.14/index.d.ts +15 -6
- {react → react v16.14}/jsx-dev-runtime.d.ts +0 -0
- {react → react v16.14}/jsx-runtime.d.ts +0 -0
- react/package.json → react v16.14/package.json +3 -3
- react/experimental.d.ts +0 -189
{react → react v16.14}/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/v16.
|
9
9
|
|
10
10
|
### Additional Details
|
11
|
-
* Last updated: Fri,
|
11
|
+
* Last updated: Fri, 12 Feb 2021 18:02:48 GMT
|
12
12
|
* Dependencies: [@types/csstype](https://npmjs.com/package/@types/csstype), [@types/prop-types](https://npmjs.com/package/@types/prop-types)
|
13
13
|
* Global values: `React`
|
14
14
|
|
File without changes
|
@@ -61,6 +61,10 @@ interface SchedulerInteraction {
|
|
61
61
|
timestamp: number;
|
62
62
|
}
|
63
63
|
|
64
|
+
declare const UNDEFINED_VOID_ONLY: unique symbol;
|
65
|
+
// Destructors are only allowed to return void.
|
66
|
+
type Destructor = () => void | { [UNDEFINED_VOID_ONLY]: never };
|
67
|
+
|
64
68
|
// tslint:disable-next-line:export-just-namespace
|
65
69
|
export = React;
|
66
70
|
export as namespace React;
|
@@ -82,7 +86,7 @@ declare namespace React {
|
|
82
86
|
type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>;
|
83
87
|
|
84
88
|
type JSXElementConstructor<P> =
|
85
|
-
| ((props: P) => ReactElement | null)
|
89
|
+
| ((props: P) => ReactElement<any, any> | null)
|
86
90
|
| (new (props: P) => Component<P, any>);
|
87
91
|
|
88
92
|
interface RefObject<T> {
|
@@ -176,6 +180,7 @@ declare namespace React {
|
|
176
180
|
}
|
177
181
|
|
178
182
|
// ReactHTML for ReactHTMLElement
|
183
|
+
// tslint:disable-next-line:no-empty-interface
|
179
184
|
interface ReactHTMLElement<T extends HTMLElement> extends DetailedReactHTMLElement<AllHTMLAttributes<T>, T> { }
|
180
185
|
|
181
186
|
interface DetailedReactHTMLElement<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMElement<P, T> {
|
@@ -214,6 +219,7 @@ declare namespace React {
|
|
214
219
|
type DOMFactory<P extends DOMAttributes<T>, T extends Element> =
|
215
220
|
(props?: ClassAttributes<T> & P | null, ...children: ReactNode[]) => DOMElement<P, T>;
|
216
221
|
|
222
|
+
// tslint:disable-next-line:no-empty-interface
|
217
223
|
interface HTMLFactory<T extends HTMLElement> extends DetailedHTMLFactory<AllHTMLAttributes<T>, T> {}
|
218
224
|
|
219
225
|
interface DetailedHTMLFactory<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMFactory<P, T> {
|
@@ -429,6 +435,7 @@ declare namespace React {
|
|
429
435
|
type ReactInstance = Component<any> | Element;
|
430
436
|
|
431
437
|
// Base component for plain JS classes
|
438
|
+
// tslint:disable-next-line:no-empty-interface
|
432
439
|
interface Component<P = {}, S = {}, SS = any> extends ComponentLifecycle<P, S, SS> { }
|
433
440
|
class Component<P, S> {
|
434
441
|
// tslint won't let me format the sample code in a way that vscode likes it :(
|
@@ -558,10 +565,8 @@ declare namespace React {
|
|
558
565
|
displayName?: string;
|
559
566
|
}
|
560
567
|
|
561
|
-
type ForwardedRef<T> = ((instance: T | null) => void) | MutableRefObject<T | null> | null;
|
562
|
-
|
563
568
|
interface ForwardRefRenderFunction<T, P = {}> {
|
564
|
-
(props: PropsWithChildren<P>, ref:
|
569
|
+
(props: PropsWithChildren<P>, ref: ((instance: T | null) => void) | MutableRefObject<T | null> | null): ReactElement | null;
|
565
570
|
displayName?: string;
|
566
571
|
// explicit rejected with `never` required due to
|
567
572
|
// https://github.com/microsoft/TypeScript/issues/36826
|
@@ -891,8 +896,7 @@ declare namespace React {
|
|
891
896
|
type DependencyList = ReadonlyArray<any>;
|
892
897
|
|
893
898
|
// NOTE: callbacks are _only_ allowed to return either void, or a destructor.
|
894
|
-
|
895
|
-
type EffectCallback = () => (void | (() => void | undefined));
|
899
|
+
type EffectCallback = () => (void | Destructor);
|
896
900
|
|
897
901
|
interface MutableRefObject<T> {
|
898
902
|
current: T;
|
@@ -1195,6 +1199,7 @@ declare namespace React {
|
|
1195
1199
|
target: EventTarget & T;
|
1196
1200
|
}
|
1197
1201
|
|
1202
|
+
// tslint:disable-next-line:no-empty-interface
|
1198
1203
|
interface FormEvent<T = Element> extends SyntheticEvent<T> {
|
1199
1204
|
}
|
1200
1205
|
|
@@ -1942,6 +1947,7 @@ declare namespace React {
|
|
1942
1947
|
referrerPolicy?: HTMLAttributeReferrerPolicy;
|
1943
1948
|
}
|
1944
1949
|
|
1950
|
+
// tslint:disable-next-line:no-empty-interface
|
1945
1951
|
interface AudioHTMLAttributes<T> extends MediaHTMLAttributes<T> {}
|
1946
1952
|
|
1947
1953
|
interface AreaHTMLAttributes<T> extends HTMLAttributes<T> {
|
@@ -2966,6 +2972,7 @@ type ReactManagedAttributes<C, P> = C extends { propTypes: infer T; defaultProps
|
|
2966
2972
|
|
2967
2973
|
declare global {
|
2968
2974
|
namespace JSX {
|
2975
|
+
// tslint:disable-next-line:no-empty-interface
|
2969
2976
|
interface Element extends React.ReactElement<any, any> { }
|
2970
2977
|
interface ElementClass extends React.Component<any> {
|
2971
2978
|
render(): React.ReactNode;
|
@@ -2981,7 +2988,9 @@ declare global {
|
|
2981
2988
|
: ReactManagedAttributes<T, P>
|
2982
2989
|
: ReactManagedAttributes<C, P>;
|
2983
2990
|
|
2991
|
+
// tslint:disable-next-line:no-empty-interface
|
2984
2992
|
interface IntrinsicAttributes extends React.Attributes { }
|
2993
|
+
// tslint:disable-next-line:no-empty-interface
|
2985
2994
|
interface IntrinsicClassAttributes<T> extends React.ClassAttributes<T> { }
|
2986
2995
|
|
2987
2996
|
interface IntrinsicElements {
|
File without changes
|
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/react",
|
3
|
-
"version": "16.14.
|
3
|
+
"version": "16.14.4",
|
4
4
|
"description": "TypeScript definitions for React",
|
5
5
|
"license": "MIT",
|
6
6
|
"contributors": [
|
@@ -144,6 +144,6 @@
|
|
144
144
|
"@types/prop-types": "*",
|
145
145
|
"csstype": "^3.0.2"
|
146
146
|
},
|
147
|
-
"typesPublisherContentHash": "
|
148
|
-
"typeScriptVersion": "3.
|
147
|
+
"typesPublisherContentHash": "fe61a2fd3f98961570899034e6de539579e385542cdc7142518fca624f5965bb",
|
148
|
+
"typeScriptVersion": "3.4"
|
149
149
|
}
|
react/experimental.d.ts
DELETED
@@ -1,189 +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('.');
|
38
|
-
|
39
|
-
export {};
|
40
|
-
|
41
|
-
declare module '.' {
|
42
|
-
export interface SuspenseProps {
|
43
|
-
/**
|
44
|
-
* The presence of this prop indicates that the content is computationally expensive to render.
|
45
|
-
* In other words, the tree is CPU bound and not I/O bound (e.g. due to fetching data).
|
46
|
-
* @see {@link https://github.com/facebook/react/pull/19936}
|
47
|
-
*/
|
48
|
-
unstable_expectedLoadTime?: number;
|
49
|
-
}
|
50
|
-
|
51
|
-
export type SuspenseListRevealOrder = 'forwards' | 'backwards' | 'together';
|
52
|
-
export type SuspenseListTailMode = 'collapsed' | 'hidden';
|
53
|
-
|
54
|
-
export interface SuspenseListCommonProps {
|
55
|
-
/**
|
56
|
-
* Note that SuspenseList require more than one child;
|
57
|
-
* it is a runtime warning to provide only a single child.
|
58
|
-
*
|
59
|
-
* It does, however, allow those children to be wrapped inside a single
|
60
|
-
* level of `<React.Fragment>`.
|
61
|
-
*/
|
62
|
-
children: ReactElement | Iterable<ReactElement>;
|
63
|
-
}
|
64
|
-
|
65
|
-
interface DirectionalSuspenseListProps extends SuspenseListCommonProps {
|
66
|
-
/**
|
67
|
-
* Defines the order in which the `SuspenseList` children should be revealed.
|
68
|
-
*/
|
69
|
-
revealOrder: 'forwards' | 'backwards';
|
70
|
-
/**
|
71
|
-
* Dictates how unloaded items in a SuspenseList is shown.
|
72
|
-
*
|
73
|
-
* - By default, `SuspenseList` will show all fallbacks in the list.
|
74
|
-
* - `collapsed` shows only the next fallback in the list.
|
75
|
-
* - `hidden` doesn’t show any unloaded items.
|
76
|
-
*/
|
77
|
-
tail?: SuspenseListTailMode;
|
78
|
-
}
|
79
|
-
|
80
|
-
interface NonDirectionalSuspenseListProps extends SuspenseListCommonProps {
|
81
|
-
/**
|
82
|
-
* Defines the order in which the `SuspenseList` children should be revealed.
|
83
|
-
*/
|
84
|
-
revealOrder?: Exclude<SuspenseListRevealOrder, DirectionalSuspenseListProps['revealOrder']>;
|
85
|
-
/**
|
86
|
-
* The tail property is invalid when not using the `forwards` or `backwards` reveal orders.
|
87
|
-
*/
|
88
|
-
tail?: never;
|
89
|
-
}
|
90
|
-
|
91
|
-
export type SuspenseListProps = DirectionalSuspenseListProps | NonDirectionalSuspenseListProps;
|
92
|
-
|
93
|
-
/**
|
94
|
-
* `SuspenseList` helps coordinate many components that can suspend by orchestrating the order
|
95
|
-
* in which these components are revealed to the user.
|
96
|
-
*
|
97
|
-
* When multiple components need to fetch data, this data may arrive in an unpredictable order.
|
98
|
-
* However, if you wrap these items in a `SuspenseList`, React will not show an item in the list
|
99
|
-
* until previous items have been displayed (this behavior is adjustable).
|
100
|
-
*
|
101
|
-
* @see https://reactjs.org/docs/concurrent-mode-reference.html#suspenselist
|
102
|
-
* @see https://reactjs.org/docs/concurrent-mode-patterns.html#suspenselist
|
103
|
-
*/
|
104
|
-
export const unstable_SuspenseList: ExoticComponent<SuspenseListProps>;
|
105
|
-
|
106
|
-
export interface SuspenseConfig {
|
107
|
-
busyDelayMs?: number;
|
108
|
-
busyMinDurationMs?: number;
|
109
|
-
}
|
110
|
-
|
111
|
-
// undocumented, considered for removal
|
112
|
-
export function unstable_withSuspenseConfig(
|
113
|
-
scope: () => void | undefined,
|
114
|
-
config: SuspenseConfig | null | undefined,
|
115
|
-
): void;
|
116
|
-
|
117
|
-
// must be synchronous
|
118
|
-
export type TransitionFunction = () => void | undefined;
|
119
|
-
// strange definition to allow vscode to show documentation on the invocation
|
120
|
-
export interface TransitionStartFunction {
|
121
|
-
/**
|
122
|
-
* State updates caused inside the callback are allowed to be deferred.
|
123
|
-
*
|
124
|
-
* **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
|
125
|
-
*
|
126
|
-
* @param callback A _synchronous_ function which causes state updates that can be deferred.
|
127
|
-
*/
|
128
|
-
(callback: TransitionFunction): void;
|
129
|
-
}
|
130
|
-
|
131
|
-
/**
|
132
|
-
* Returns a deferred version of the value that may “lag behind” it for at most `timeoutMs`.
|
133
|
-
*
|
134
|
-
* This is commonly used to keep the interface responsive when you have something that renders immediately
|
135
|
-
* based on user input and something that needs to wait for a data fetch.
|
136
|
-
*
|
137
|
-
* A good example of this is a text input.
|
138
|
-
*
|
139
|
-
* @param value The value that is going to be deferred
|
140
|
-
*
|
141
|
-
* @see https://reactjs.org/docs/concurrent-mode-reference.html#usedeferredvalue
|
142
|
-
*/
|
143
|
-
export function unstable_useDeferredValue<T>(value: T): T;
|
144
|
-
|
145
|
-
/**
|
146
|
-
* Allows components to avoid undesirable loading states by waiting for content to load
|
147
|
-
* before transitioning to the next screen. It also allows components to defer slower,
|
148
|
-
* data fetching updates until subsequent renders so that more crucial updates can be
|
149
|
-
* rendered immediately.
|
150
|
-
*
|
151
|
-
* The `useTransition` hook returns two values in an array.
|
152
|
-
*
|
153
|
-
* The first is a function that takes a callback. We can use it to tell React which state we want to defer.
|
154
|
-
* The seconda boolean. It’s React’s way of informing us whether we’re waiting for the transition to finish.
|
155
|
-
*
|
156
|
-
* **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
|
157
|
-
*
|
158
|
-
* @param config An optional object with `timeoutMs`
|
159
|
-
*
|
160
|
-
* @see https://reactjs.org/docs/concurrent-mode-reference.html#usetransition
|
161
|
-
*/
|
162
|
-
export function unstable_useTransition(config?: SuspenseConfig | null): [TransitionStartFunction, boolean];
|
163
|
-
|
164
|
-
const opaqueIdentifierBranding: unique symbol;
|
165
|
-
/**
|
166
|
-
* WARNING: Don't use this as a `string`.
|
167
|
-
*
|
168
|
-
* This is an opaque type that is not supposed to type-check structurally.
|
169
|
-
* It is only valid if returned from React methods and passed to React e.g. `<button aria-labelledby={opaqueIdentifier} />`
|
170
|
-
*/
|
171
|
-
// We can't create a type that would be rejected for string concatenation or `.toString()` calls.
|
172
|
-
// So in order to not have to add `string | OpaqueIdentifier` to every react-dom host prop we intersect it with `string`.
|
173
|
-
type OpaqueIdentifier = string & {
|
174
|
-
readonly [opaqueIdentifierBranding]: unknown;
|
175
|
-
// While this would cause `const stringified: string = opaqueIdentifier.toString()` to not type-check it also adds completions while typing.
|
176
|
-
// It would also still allow string concatenation.
|
177
|
-
// Unsure which is better. Not type-checking or not suggesting.
|
178
|
-
// toString(): void;
|
179
|
-
};
|
180
|
-
|
181
|
-
export function unstable_useOpaqueIdentifier(): OpaqueIdentifier;
|
182
|
-
|
183
|
-
/**
|
184
|
-
* Similar to `useTransition` but allows uses where hooks are not available.
|
185
|
-
*
|
186
|
-
* @param callback A _synchronous_ function which causes state updates that can be deferred.
|
187
|
-
*/
|
188
|
-
export function unstable_startTransition(scope: TransitionFunction): void;
|
189
|
-
}
|