@types/react 17.0.34 → 17.0.38
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 +50 -16
- react/index.d.ts +1 -1
- react/next.d.ts +22 -73
- react/package.json +3 -3
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: Thu, 23 Dec 2021 09:01:24 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,24 +39,58 @@ import React = require('./next');
|
|
39
39
|
export {};
|
40
40
|
|
41
41
|
declare module '.' {
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
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;
|
54
83
|
|
55
84
|
/**
|
56
|
-
*
|
57
|
-
*
|
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).
|
58
91
|
*
|
59
|
-
* @see https://
|
92
|
+
* @see https://reactjs.org/docs/concurrent-mode-reference.html#suspenselist
|
93
|
+
* @see https://reactjs.org/docs/concurrent-mode-patterns.html#suspenselist
|
60
94
|
*/
|
61
|
-
|
95
|
+
export const SuspenseList: ExoticComponent<SuspenseListProps>;
|
62
96
|
}
|
react/index.d.ts
CHANGED
@@ -839,7 +839,7 @@ declare namespace React {
|
|
839
839
|
? JSX.IntrinsicElements[T]
|
840
840
|
: {};
|
841
841
|
type ComponentPropsWithRef<T extends ElementType> =
|
842
|
-
T extends
|
842
|
+
T extends (new (props: infer P) => Component<any, any>)
|
843
843
|
? PropsWithoutRef<P> & RefAttributes<InstanceType<T>>
|
844
844
|
: PropsWithRef<ComponentProps<T>>;
|
845
845
|
type ComponentPropsWithoutRef<T extends ElementType> =
|
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
|
@@ -151,24 +96,7 @@ declare module '.' {
|
|
151
96
|
*/
|
152
97
|
export function startTransition(scope: TransitionFunction): void;
|
153
98
|
|
154
|
-
|
155
|
-
/**
|
156
|
-
* WARNING: Don't use this as a `string`.
|
157
|
-
*
|
158
|
-
* This is an opaque type that is not supposed to type-check structurally.
|
159
|
-
* It is only valid if returned from React methods and passed to React e.g. `<button aria-labelledby={opaqueIdentifier} />`
|
160
|
-
*/
|
161
|
-
// We can't create a type that would be rejected for string concatenation or `.toString()` calls.
|
162
|
-
// So in order to not have to add `string | OpaqueIdentifier` to every react-dom host prop we intersect it with `string`.
|
163
|
-
type OpaqueIdentifier = string & {
|
164
|
-
readonly [opaqueIdentifierBranding]: unknown;
|
165
|
-
// While this would cause `const stringified: string = opaqueIdentifier.toString()` to not type-check it also adds completions while typing.
|
166
|
-
// It would also still allow string concatenation.
|
167
|
-
// Unsure which is better. Not type-checking or not suggesting.
|
168
|
-
// toString(): void;
|
169
|
-
};
|
170
|
-
|
171
|
-
export function unstable_useOpaqueIdentifier(): OpaqueIdentifier;
|
99
|
+
export function useId(): string;
|
172
100
|
|
173
101
|
/**
|
174
102
|
* this should be an internal type
|
@@ -196,4 +124,25 @@ declare module '.' {
|
|
196
124
|
* @see https://github.com/reactjs/rfcs/blob/master/text/0147-use-mutable-source.md
|
197
125
|
*/
|
198
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;
|
199
148
|
}
|
react/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/react",
|
3
|
-
"version": "17.0.
|
3
|
+
"version": "17.0.38",
|
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": "
|
150
|
-
"typeScriptVersion": "3.
|
149
|
+
"typesPublisherContentHash": "1015b508f5c5489fee390a311f2806cc4363420c3aa9b2e66226ce23c4b0c9d9",
|
150
|
+
"typeScriptVersion": "3.8"
|
151
151
|
}
|