@types/react 17.0.35 → 17.0.39

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 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: Mon, 15 Nov 2021 22:01:26 GMT
11
+ * Last updated: Thu, 03 Feb 2022 14:01:28 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
- * @param subscribe
44
- * @param getSnapshot
45
- *
46
- * @see https://github.com/reactwg/react-18/discussions/86
47
- */
48
- // keep in sync with `useSyncExternalStore` from `use-sync-external-store`
49
- export function unstable_useSyncExternalStore<Snapshot>(
50
- subscribe: (onStoreChange: () => void) => () => void,
51
- getSnapshot: () => Snapshot,
52
- getServerSnapshot?: () => Snapshot,
53
- ): Snapshot;
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
- * @param effect Imperative function that can return a cleanup function
57
- * @param deps If present, effect will only activate if the values in the list change.
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://github.com/facebook/react/pull/21913
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
- export function unstable_useInsertionEffect(effect: EffectCallback, deps?: DependencyList): void;
95
+ export const SuspenseList: ExoticComponent<SuspenseListProps>;
62
96
  }
react/index.d.ts CHANGED
@@ -1113,18 +1113,6 @@ declare namespace React {
1113
1113
  /**
1114
1114
  * `useMemo` will only recompute the memoized value when one of the `deps` has changed.
1115
1115
  *
1116
- * Usage note: if calling `useMemo` with a referentially stable function, also give it as the input in
1117
- * the second argument.
1118
- *
1119
- * ```ts
1120
- * function expensive () { ... }
1121
- *
1122
- * function Component () {
1123
- * const expensiveResult = useMemo(expensive, [expensive])
1124
- * return ...
1125
- * }
1126
- * ```
1127
- *
1128
1116
  * @version 16.8.0
1129
1117
  * @see https://reactjs.org/docs/hooks-reference.html#usememo
1130
1118
  */
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
- const opaqueIdentifierBranding: unique symbol;
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.35",
3
+ "version": "17.0.39",
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": "cc91837b8e8126955f49bc8b3e6afbef0aa471bb70acff77bd4b1248170d686b",
150
- "typeScriptVersion": "3.7"
149
+ "typesPublisherContentHash": "2502bab5b8da6320218d069a439c8f59094f51037715ad51da9d4ced528d954f",
150
+ "typeScriptVersion": "3.8"
151
151
  }