@types/react 16.9.10 → 16.9.11
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 +1 -1
- react/experimental.d.ts +166 -0
- react/index.d.ts +10 -0
- react/package.json +2 -2
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:
|
11
|
+
* Last updated: Fri, 25 Oct 2019 08:56:09 GMT
|
12
12
|
* Dependencies: @types/csstype, @types/prop-types
|
13
13
|
* Global values: React
|
14
14
|
|
react/experimental.d.ts
ADDED
@@ -0,0 +1,166 @@
|
|
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 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;
|
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']>;
|
76
|
+
/**
|
77
|
+
* The tail property is invalid when not using the `forwards` or `backwards` reveal orders.
|
78
|
+
*/
|
79
|
+
tail?: never;
|
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
|
+
|
97
|
+
export interface SuspenseConfig extends TimeoutConfig {
|
98
|
+
busyDelayMs?: number;
|
99
|
+
busyMinDurationMs?: number;
|
100
|
+
}
|
101
|
+
|
102
|
+
// undocumented, considered for removal
|
103
|
+
export function unstable_withSuspenseConfig(
|
104
|
+
scope: () => void | undefined,
|
105
|
+
config: SuspenseConfig | null | undefined,
|
106
|
+
): void;
|
107
|
+
|
108
|
+
export interface TimeoutConfig {
|
109
|
+
/**
|
110
|
+
* This timeout (in milliseconds) tells React how long to wait before showing the next state.
|
111
|
+
*
|
112
|
+
* React will always try to use a shorter lag when network and device allows it.
|
113
|
+
*
|
114
|
+
* **NOTE: We recommend that you share Suspense Config between different modules.**
|
115
|
+
*/
|
116
|
+
timeoutMs: number;
|
117
|
+
}
|
118
|
+
|
119
|
+
// must be synchronous
|
120
|
+
export type TransitionFunction = () => void | undefined;
|
121
|
+
// strange definition to allow vscode to show documentation on the invocation
|
122
|
+
export interface TransitionStartFunction {
|
123
|
+
/**
|
124
|
+
* State updates caused inside the callback are allowed to be deferred.
|
125
|
+
*
|
126
|
+
* **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
|
127
|
+
*
|
128
|
+
* @param callback A _synchronous_ function which causes state updates that can be deferred.
|
129
|
+
*/
|
130
|
+
(callback: TransitionFunction): void;
|
131
|
+
}
|
132
|
+
|
133
|
+
/**
|
134
|
+
* Returns a deferred version of the value that may “lag behind” it for at most `timeoutMs`.
|
135
|
+
*
|
136
|
+
* This is commonly used to keep the interface responsive when you have something that renders immediately
|
137
|
+
* based on user input and something that needs to wait for a data fetch.
|
138
|
+
*
|
139
|
+
* A good example of this is a text input.
|
140
|
+
*
|
141
|
+
* @param value The value that is going to be deferred
|
142
|
+
* @param config An optional object with `timeoutMs`
|
143
|
+
*
|
144
|
+
* @see https://reactjs.org/docs/concurrent-mode-reference.html#usedeferredvalue
|
145
|
+
*/
|
146
|
+
export function useDeferredValue<T>(value: T, config?: TimeoutConfig | null): T;
|
147
|
+
|
148
|
+
/**
|
149
|
+
* Allows components to avoid undesirable loading states by waiting for content to load
|
150
|
+
* before transitioning to the next screen. It also allows components to defer slower,
|
151
|
+
* data fetching updates until subsequent renders so that more crucial updates can be
|
152
|
+
* rendered immediately.
|
153
|
+
*
|
154
|
+
* The `useTransition` hook returns two values in an array.
|
155
|
+
*
|
156
|
+
* The first is a function that takes a callback. We can use it to tell React which state we want to defer.
|
157
|
+
* The seconda boolean. It’s React’s way of informing us whether we’re waiting for the transition to finish.
|
158
|
+
*
|
159
|
+
* **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
|
160
|
+
*
|
161
|
+
* @param config An optional object with `timeoutMs`
|
162
|
+
*
|
163
|
+
* @see https://reactjs.org/docs/concurrent-mode-reference.html#usetransition
|
164
|
+
*/
|
165
|
+
export function useTransition(config?: SuspenseConfig | null): [TransitionStartFunction, boolean];
|
166
|
+
}
|
react/index.d.ts
CHANGED
@@ -24,6 +24,10 @@
|
|
24
24
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
25
25
|
// TypeScript Version: 2.8
|
26
26
|
|
27
|
+
// NOTE: Users of the `experimental` builds of React should add a reference
|
28
|
+
// to 'react/experimental' in their project. See experimental.d.ts's top comment
|
29
|
+
// for reference and documentation on how exactly to do it.
|
30
|
+
|
27
31
|
/// <reference path="global.d.ts" />
|
28
32
|
|
29
33
|
import * as CSS from 'csstype';
|
@@ -355,6 +359,12 @@ declare namespace React {
|
|
355
359
|
|
356
360
|
/** A fallback react tree to show when a Suspense child (like React.lazy) suspends */
|
357
361
|
fallback: NonNullable<ReactNode>|null;
|
362
|
+
/**
|
363
|
+
* Tells React whether to “skip” revealing this boundary during the initial load.
|
364
|
+
* This API will likely be removed in a future release.
|
365
|
+
*/
|
366
|
+
// NOTE: this is unflagged and is respected even in stable builds
|
367
|
+
unstable_avoidThisFallback?: boolean;
|
358
368
|
}
|
359
369
|
/**
|
360
370
|
* This feature is not yet available for server-side rendering.
|
react/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/react",
|
3
|
-
"version": "16.9.
|
3
|
+
"version": "16.9.11",
|
4
4
|
"description": "TypeScript definitions for React",
|
5
5
|
"license": "MIT",
|
6
6
|
"contributors": [
|
@@ -119,6 +119,6 @@
|
|
119
119
|
"@types/prop-types": "*",
|
120
120
|
"csstype": "^2.2.0"
|
121
121
|
},
|
122
|
-
"typesPublisherContentHash": "
|
122
|
+
"typesPublisherContentHash": "59a76ac3cf8d9766c117506cb0118cf5b72d6dfded31ffa59a86c43a2ff80faa",
|
123
123
|
"typeScriptVersion": "2.8"
|
124
124
|
}
|