@types/react 17.0.36 → 17.0.37
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 +51 -9
- react/next.d.ts +13 -55
- 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: Wed, 24 Nov 2021 21:01:04 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
@@ -39,18 +39,60 @@ import React = require('./next');
|
|
39
39
|
export {};
|
40
40
|
|
41
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
|
+
|
42
84
|
/**
|
43
|
-
*
|
44
|
-
*
|
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).
|
45
91
|
*
|
46
|
-
* @see https://
|
92
|
+
* @see https://reactjs.org/docs/concurrent-mode-reference.html#suspenselist
|
93
|
+
* @see https://reactjs.org/docs/concurrent-mode-patterns.html#suspenselist
|
47
94
|
*/
|
48
|
-
|
49
|
-
export function unstable_useSyncExternalStore<Snapshot>(
|
50
|
-
subscribe: (onStoreChange: () => void) => () => void,
|
51
|
-
getSnapshot: () => Snapshot,
|
52
|
-
getServerSnapshot?: () => Snapshot,
|
53
|
-
): Snapshot;
|
95
|
+
export const SuspenseList: ExoticComponent<SuspenseListProps>;
|
54
96
|
|
55
97
|
/**
|
56
98
|
* @param effect Imperative function that can return a cleanup function
|
react/next.d.ts
CHANGED
@@ -42,61 +42,6 @@ declare module '.' {
|
|
42
42
|
unstable_expectedLoadTime?: number | undefined;
|
43
43
|
}
|
44
44
|
|
45
|
-
export type SuspenseListRevealOrder = 'forwards' | 'backwards' | 'together';
|
46
|
-
export type SuspenseListTailMode = 'collapsed' | 'hidden';
|
47
|
-
|
48
|
-
export interface SuspenseListCommonProps {
|
49
|
-
/**
|
50
|
-
* Note that SuspenseList require more than one child;
|
51
|
-
* it is a runtime warning to provide only a single child.
|
52
|
-
*
|
53
|
-
* It does, however, allow those children to be wrapped inside a single
|
54
|
-
* level of `<React.Fragment>`.
|
55
|
-
*/
|
56
|
-
children: ReactElement | Iterable<ReactElement>;
|
57
|
-
}
|
58
|
-
|
59
|
-
interface DirectionalSuspenseListProps extends SuspenseListCommonProps {
|
60
|
-
/**
|
61
|
-
* Defines the order in which the `SuspenseList` children should be revealed.
|
62
|
-
*/
|
63
|
-
revealOrder: 'forwards' | 'backwards';
|
64
|
-
/**
|
65
|
-
* Dictates how unloaded items in a SuspenseList is shown.
|
66
|
-
*
|
67
|
-
* - By default, `SuspenseList` will show all fallbacks in the list.
|
68
|
-
* - `collapsed` shows only the next fallback in the list.
|
69
|
-
* - `hidden` doesn’t show any unloaded items.
|
70
|
-
*/
|
71
|
-
tail?: SuspenseListTailMode | undefined;
|
72
|
-
}
|
73
|
-
|
74
|
-
interface NonDirectionalSuspenseListProps extends SuspenseListCommonProps {
|
75
|
-
/**
|
76
|
-
* Defines the order in which the `SuspenseList` children should be revealed.
|
77
|
-
*/
|
78
|
-
revealOrder?: Exclude<SuspenseListRevealOrder, DirectionalSuspenseListProps['revealOrder']> | undefined;
|
79
|
-
/**
|
80
|
-
* The tail property is invalid when not using the `forwards` or `backwards` reveal orders.
|
81
|
-
*/
|
82
|
-
tail?: never | undefined;
|
83
|
-
}
|
84
|
-
|
85
|
-
export type SuspenseListProps = DirectionalSuspenseListProps | NonDirectionalSuspenseListProps;
|
86
|
-
|
87
|
-
/**
|
88
|
-
* `SuspenseList` helps coordinate many components that can suspend by orchestrating the order
|
89
|
-
* in which these components are revealed to the user.
|
90
|
-
*
|
91
|
-
* When multiple components need to fetch data, this data may arrive in an unpredictable order.
|
92
|
-
* However, if you wrap these items in a `SuspenseList`, React will not show an item in the list
|
93
|
-
* until previous items have been displayed (this behavior is adjustable).
|
94
|
-
*
|
95
|
-
* @see https://reactjs.org/docs/concurrent-mode-reference.html#suspenselist
|
96
|
-
* @see https://reactjs.org/docs/concurrent-mode-patterns.html#suspenselist
|
97
|
-
*/
|
98
|
-
export const SuspenseList: ExoticComponent<SuspenseListProps>;
|
99
|
-
|
100
45
|
// must be synchronous
|
101
46
|
export type TransitionFunction = () => VoidOrUndefinedOnly;
|
102
47
|
// strange definition to allow vscode to show documentation on the invocation
|
@@ -179,4 +124,17 @@ declare module '.' {
|
|
179
124
|
* @see https://github.com/reactjs/rfcs/blob/master/text/0147-use-mutable-source.md
|
180
125
|
*/
|
181
126
|
export function unstable_useMutableSource<T, TResult extends unknown>(MutableSource: MutableSource<T>, getSnapshot: (source: T) => TResult, subscribe: MutableSourceSubscribe<T>): TResult;
|
127
|
+
|
128
|
+
/**
|
129
|
+
* @param subscribe
|
130
|
+
* @param getSnapshot
|
131
|
+
*
|
132
|
+
* @see https://github.com/reactwg/react-18/discussions/86
|
133
|
+
*/
|
134
|
+
// keep in sync with `useSyncExternalStore` from `use-sync-external-store`
|
135
|
+
export function useSyncExternalStore<Snapshot>(
|
136
|
+
subscribe: (onStoreChange: () => void) => () => void,
|
137
|
+
getSnapshot: () => Snapshot,
|
138
|
+
getServerSnapshot?: () => Snapshot,
|
139
|
+
): Snapshot;
|
182
140
|
}
|
react/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/react",
|
3
|
-
"version": "17.0.
|
3
|
+
"version": "17.0.37",
|
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": "91aa69834e615fe0e64009b964243f620503bdaf0c74f0a35b07b7f35b0f8de4",
|
150
150
|
"typeScriptVersion": "3.8"
|
151
151
|
}
|