@types/react 17.0.9 → 17.0.13

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,9 +8,9 @@ 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: Wed, 02 Jun 2021 02:01:32 GMT
11
+ * Last updated: Thu, 01 Jul 2021 10:31:23 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
 
15
15
  # Credits
16
- These definitions were written by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com), [John Reilly](https://github.com/johnnyreilly), [Benoit Benezech](https://github.com/bbenezech), [Patricio Zavolinsky](https://github.com/pzavolinsky), [Digiguru](https://github.com/digiguru), [Eric Anderson](https://github.com/ericanderson), [Dovydas Navickas](https://github.com/DovydasNavickas), [Josh Rutherford](https://github.com/theruther4d), [Guilherme Hübner](https://github.com/guilhermehubner), [Ferdy Budhidharma](https://github.com/ferdaber), [Johann Rakotoharisoa](https://github.com/jrakotoharisoa), [Olivier Pascal](https://github.com/pascaloliv), [Martin Hochel](https://github.com/hotell), [Frank Li](https://github.com/franklixuefei), [Jessica Franco](https://github.com/Jessidhia), [Saransh Kataria](https://github.com/saranshkataria), [Kanitkorn Sujautra](https://github.com/lukyth), [Sebastian Silbermann](https://github.com/eps1lon), [Kyle Scully](https://github.com/zieka), [Cong Zhang](https://github.com/dancerphil), [Dimitri Mitropoulos](https://github.com/dimitropoulos), [JongChan Choi](https://github.com/disjukr), [Victor Magalhães](https://github.com/vhfmag), [Dale Tan](https://github.com/hellatan), and [Priyanshu Rav](https://github.com/priyanshurav).
16
+ These definitions were written by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com), [John Reilly](https://github.com/johnnyreilly), [Benoit Benezech](https://github.com/bbenezech), [Patricio Zavolinsky](https://github.com/pzavolinsky), [Eric Anderson](https://github.com/ericanderson), [Dovydas Navickas](https://github.com/DovydasNavickas), [Josh Rutherford](https://github.com/theruther4d), [Guilherme Hübner](https://github.com/guilhermehubner), [Ferdy Budhidharma](https://github.com/ferdaber), [Johann Rakotoharisoa](https://github.com/jrakotoharisoa), [Olivier Pascal](https://github.com/pascaloliv), [Martin Hochel](https://github.com/hotell), [Frank Li](https://github.com/franklixuefei), [Jessica Franco](https://github.com/Jessidhia), [Saransh Kataria](https://github.com/saranshkataria), [Kanitkorn Sujautra](https://github.com/lukyth), [Sebastian Silbermann](https://github.com/eps1lon), [Kyle Scully](https://github.com/zieka), [Cong Zhang](https://github.com/dancerphil), [Dimitri Mitropoulos](https://github.com/dimitropoulos), [JongChan Choi](https://github.com/disjukr), [Victor Magalhães](https://github.com/vhfmag), [Dale Tan](https://github.com/hellatan), and [Priyanshu Rav](https://github.com/priyanshurav).
react/experimental.d.ts CHANGED
@@ -34,148 +34,8 @@
34
34
  //
35
35
  // Suspense-related handling can be found in ReactFiberThrow.js.
36
36
 
37
- import React = require('.');
37
+ import React = require('./next');
38
38
 
39
39
  export {};
40
40
 
41
- declare const UNDEFINED_VOID_ONLY: unique symbol;
42
- type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
43
-
44
- declare module '.' {
45
- export interface SuspenseProps {
46
- /**
47
- * The presence of this prop indicates that the content is computationally expensive to render.
48
- * In other words, the tree is CPU bound and not I/O bound (e.g. due to fetching data).
49
- * @see {@link https://github.com/facebook/react/pull/19936}
50
- */
51
- unstable_expectedLoadTime?: number;
52
- }
53
-
54
- export type SuspenseListRevealOrder = 'forwards' | 'backwards' | 'together';
55
- export type SuspenseListTailMode = 'collapsed' | 'hidden';
56
-
57
- export interface SuspenseListCommonProps {
58
- /**
59
- * Note that SuspenseList require more than one child;
60
- * it is a runtime warning to provide only a single child.
61
- *
62
- * It does, however, allow those children to be wrapped inside a single
63
- * level of `<React.Fragment>`.
64
- */
65
- children: ReactElement | Iterable<ReactElement>;
66
- }
67
-
68
- interface DirectionalSuspenseListProps extends SuspenseListCommonProps {
69
- /**
70
- * Defines the order in which the `SuspenseList` children should be revealed.
71
- */
72
- revealOrder: 'forwards' | 'backwards';
73
- /**
74
- * Dictates how unloaded items in a SuspenseList is shown.
75
- *
76
- * - By default, `SuspenseList` will show all fallbacks in the list.
77
- * - `collapsed` shows only the next fallback in the list.
78
- * - `hidden` doesn’t show any unloaded items.
79
- */
80
- tail?: SuspenseListTailMode;
81
- }
82
-
83
- interface NonDirectionalSuspenseListProps extends SuspenseListCommonProps {
84
- /**
85
- * Defines the order in which the `SuspenseList` children should be revealed.
86
- */
87
- revealOrder?: Exclude<SuspenseListRevealOrder, DirectionalSuspenseListProps['revealOrder']>;
88
- /**
89
- * The tail property is invalid when not using the `forwards` or `backwards` reveal orders.
90
- */
91
- tail?: never;
92
- }
93
-
94
- export type SuspenseListProps = DirectionalSuspenseListProps | NonDirectionalSuspenseListProps;
95
-
96
- /**
97
- * `SuspenseList` helps coordinate many components that can suspend by orchestrating the order
98
- * in which these components are revealed to the user.
99
- *
100
- * When multiple components need to fetch data, this data may arrive in an unpredictable order.
101
- * However, if you wrap these items in a `SuspenseList`, React will not show an item in the list
102
- * until previous items have been displayed (this behavior is adjustable).
103
- *
104
- * @see https://reactjs.org/docs/concurrent-mode-reference.html#suspenselist
105
- * @see https://reactjs.org/docs/concurrent-mode-patterns.html#suspenselist
106
- */
107
- export const SuspenseList: ExoticComponent<SuspenseListProps>;
108
-
109
- // must be synchronous
110
- export type TransitionFunction = () => VoidOrUndefinedOnly;
111
- // strange definition to allow vscode to show documentation on the invocation
112
- export interface TransitionStartFunction {
113
- /**
114
- * State updates caused inside the callback are allowed to be deferred.
115
- *
116
- * **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
117
- *
118
- * @param callback A _synchronous_ function which causes state updates that can be deferred.
119
- */
120
- (callback: TransitionFunction): void;
121
- }
122
-
123
- /**
124
- * Returns a deferred version of the value that may “lag behind” it for at most `timeoutMs`.
125
- *
126
- * This is commonly used to keep the interface responsive when you have something that renders immediately
127
- * based on user input and something that needs to wait for a data fetch.
128
- *
129
- * A good example of this is a text input.
130
- *
131
- * @param value The value that is going to be deferred
132
- *
133
- * @see https://reactjs.org/docs/concurrent-mode-reference.html#usedeferredvalue
134
- */
135
- export function useDeferredValue<T>(value: T): T;
136
-
137
- /**
138
- * Allows components to avoid undesirable loading states by waiting for content to load
139
- * before transitioning to the next screen. It also allows components to defer slower,
140
- * data fetching updates until subsequent renders so that more crucial updates can be
141
- * rendered immediately.
142
- *
143
- * The `useTransition` hook returns two values in an array.
144
- *
145
- * The first is boolean, React’s way of informing us whether we’re waiting for the transition to finish.
146
- * The seconda is a function that takes a callback. We can use it to tell React which state we want to defer.
147
- *
148
- * **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
149
- *
150
- * @param config An optional object with `timeoutMs`
151
- *
152
- * @see https://reactjs.org/docs/concurrent-mode-reference.html#usetransition
153
- */
154
- export function useTransition(): [boolean, TransitionStartFunction];
155
-
156
- const opaqueIdentifierBranding: unique symbol;
157
- /**
158
- * WARNING: Don't use this as a `string`.
159
- *
160
- * This is an opaque type that is not supposed to type-check structurally.
161
- * It is only valid if returned from React methods and passed to React e.g. `<button aria-labelledby={opaqueIdentifier} />`
162
- */
163
- // We can't create a type that would be rejected for string concatenation or `.toString()` calls.
164
- // So in order to not have to add `string | OpaqueIdentifier` to every react-dom host prop we intersect it with `string`.
165
- type OpaqueIdentifier = string & {
166
- readonly [opaqueIdentifierBranding]: unknown;
167
- // While this would cause `const stringified: string = opaqueIdentifier.toString()` to not type-check it also adds completions while typing.
168
- // It would also still allow string concatenation.
169
- // Unsure which is better. Not type-checking or not suggesting.
170
- // toString(): void;
171
- };
172
-
173
- export function unstable_useOpaqueIdentifier(): OpaqueIdentifier;
174
-
175
- /**
176
- * Similar to `useTransition` but allows uses where hooks are not available.
177
- *
178
- * @param callback A _synchronous_ function which causes state updates that can be deferred.
179
- */
180
- export function startTransition(scope: TransitionFunction): void;
181
- }
41
+ declare module '.' {}
react/index.d.ts CHANGED
@@ -6,7 +6,6 @@
6
6
  // John Reilly <https://github.com/johnnyreilly>
7
7
  // Benoit Benezech <https://github.com/bbenezech>
8
8
  // Patricio Zavolinsky <https://github.com/pzavolinsky>
9
- // Digiguru <https://github.com/digiguru>
10
9
  // Eric Anderson <https://github.com/ericanderson>
11
10
  // Dovydas Navickas <https://github.com/DovydasNavickas>
12
11
  // Josh Rutherford <https://github.com/theruther4d>
@@ -30,6 +29,10 @@
30
29
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
31
30
  // TypeScript Version: 2.8
32
31
 
32
+ // NOTE: Users of the upcoming React 18 release should add a reference
33
+ // to 'react/next' in their project. See next.d.ts's top comment
34
+ // for reference and documentation on how exactly to do it.
35
+
33
36
  // NOTE: Users of the `experimental` builds of React should add a reference
34
37
  // to 'react/experimental' in their project. See experimental.d.ts's top comment
35
38
  // for reference and documentation on how exactly to do it.
@@ -1997,6 +2000,13 @@ declare namespace React {
1997
2000
  | 'strict-origin-when-cross-origin'
1998
2001
  | 'unsafe-url';
1999
2002
 
2003
+ type HTMLAttributeAnchorTarget =
2004
+ | '_self'
2005
+ | '_blank'
2006
+ | '_parent'
2007
+ | '_top'
2008
+ | (string & {});
2009
+
2000
2010
  interface AnchorHTMLAttributes<T> extends HTMLAttributes<T> {
2001
2011
  download?: any;
2002
2012
  href?: string;
@@ -2004,7 +2014,7 @@ declare namespace React {
2004
2014
  media?: string;
2005
2015
  ping?: string;
2006
2016
  rel?: string;
2007
- target?: string;
2017
+ target?: HTMLAttributeAnchorTarget;
2008
2018
  type?: string;
2009
2019
  referrerPolicy?: HTMLAttributeReferrerPolicy;
2010
2020
  }
react/next.d.ts ADDED
@@ -0,0 +1,199 @@
1
+ /**
2
+ * These are types for things that are present in the upcoming React 18 release.
3
+ *
4
+ * Once React 18 is released they can just be moved to the main index file.
5
+ *
6
+ * To load the types declared here in an actual project, there are three ways. The easiest one,
7
+ * if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section,
8
+ * is to add `"react/next"` to the `"types"` array.
9
+ *
10
+ * Alternatively, a specific import syntax can to be used from a typescript file.
11
+ * This module does not exist in reality, which is why the {} is important:
12
+ *
13
+ * ```ts
14
+ * import {} from 'react/next'
15
+ * ```
16
+ *
17
+ * It is also possible to include it through a triple-slash reference:
18
+ *
19
+ * ```ts
20
+ * /// <reference types="react/next" />
21
+ * ```
22
+ *
23
+ * Either the import or the reference only needs to appear once, anywhere in the project.
24
+ */
25
+
26
+ // See https://github.com/facebook/react/blob/master/packages/react/src/React.js to see how the exports are declared,
27
+
28
+ import React = require('.');
29
+
30
+ export {};
31
+
32
+ declare const UNDEFINED_VOID_ONLY: unique symbol;
33
+ type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
34
+
35
+ declare module '.' {
36
+ export interface SuspenseProps {
37
+ /**
38
+ * The presence of this prop indicates that the content is computationally expensive to render.
39
+ * In other words, the tree is CPU bound and not I/O bound (e.g. due to fetching data).
40
+ * @see {@link https://github.com/facebook/react/pull/19936}
41
+ */
42
+ unstable_expectedLoadTime?: number;
43
+ }
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;
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']>;
79
+ /**
80
+ * The tail property is invalid when not using the `forwards` or `backwards` reveal orders.
81
+ */
82
+ tail?: never;
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
+ // must be synchronous
101
+ export type TransitionFunction = () => VoidOrUndefinedOnly;
102
+ // strange definition to allow vscode to show documentation on the invocation
103
+ export interface TransitionStartFunction {
104
+ /**
105
+ * State updates caused inside the callback are allowed to be deferred.
106
+ *
107
+ * **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
108
+ *
109
+ * @param callback A _synchronous_ function which causes state updates that can be deferred.
110
+ */
111
+ (callback: TransitionFunction): void;
112
+ }
113
+
114
+ /**
115
+ * Returns a deferred version of the value that may “lag behind” it for at most `timeoutMs`.
116
+ *
117
+ * This is commonly used to keep the interface responsive when you have something that renders immediately
118
+ * based on user input and something that needs to wait for a data fetch.
119
+ *
120
+ * A good example of this is a text input.
121
+ *
122
+ * @param value The value that is going to be deferred
123
+ *
124
+ * @see https://reactjs.org/docs/concurrent-mode-reference.html#usedeferredvalue
125
+ */
126
+ export function useDeferredValue<T>(value: T): T;
127
+
128
+ /**
129
+ * Allows components to avoid undesirable loading states by waiting for content to load
130
+ * before transitioning to the next screen. It also allows components to defer slower,
131
+ * data fetching updates until subsequent renders so that more crucial updates can be
132
+ * rendered immediately.
133
+ *
134
+ * The `useTransition` hook returns two values in an array.
135
+ *
136
+ * The first is boolean, React’s way of informing us whether we’re waiting for the transition to finish.
137
+ * The seconda is a function that takes a callback. We can use it to tell React which state we want to defer.
138
+ *
139
+ * **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
140
+ *
141
+ * @param config An optional object with `timeoutMs`
142
+ *
143
+ * @see https://reactjs.org/docs/concurrent-mode-reference.html#usetransition
144
+ */
145
+ export function useTransition(): [boolean, TransitionStartFunction];
146
+
147
+ /**
148
+ * Similar to `useTransition` but allows uses where hooks are not available.
149
+ *
150
+ * @param callback A _synchronous_ function which causes state updates that can be deferred.
151
+ */
152
+ export function startTransition(scope: TransitionFunction): void;
153
+
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;
172
+
173
+ /**
174
+ * this should be an internal type
175
+ */
176
+ interface MutableSource<T> {
177
+ _source: T;
178
+ }
179
+
180
+ export type MutableSourceSubscribe<T> = (source: T, callback: () => void) => () => void;
181
+
182
+ /**
183
+ * @param source A source could be anything as long as they can be subscribed to and have a "version".
184
+ * @param getVersion A function returns a value which will change whenever part of the source changes.
185
+ */
186
+ export function unstable_createMutableSource<T>(source: T, getVersion: () => any): MutableSource<T>;
187
+
188
+ /**
189
+ * useMutableSource() enables React components to safely and efficiently read from a mutable external source in Concurrent Mode.
190
+ * The API will detect mutations that occur during a render to avoid tearing
191
+ * and it will automatically schedule updates when the source is mutated.
192
+ * @param MutableSource
193
+ * @param getSnapshot
194
+ * @param subscribe
195
+ *
196
+ * @see https://github.com/reactjs/rfcs/blob/master/text/0147-use-mutable-source.md
197
+ */
198
+ export function unstable_useMutableSource<T, TResult extends unknown>(MutableSource: MutableSource<T>, getSnapshot: (source: T) => TResult, subscribe: MutableSourceSubscribe<T>): TResult;
199
+ }
react/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react",
3
- "version": "17.0.9",
3
+ "version": "17.0.13",
4
4
  "description": "TypeScript definitions for React",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
6
6
  "license": "MIT",
@@ -32,11 +32,6 @@
32
32
  "url": "https://github.com/pzavolinsky",
33
33
  "githubUsername": "pzavolinsky"
34
34
  },
35
- {
36
- "name": "Digiguru",
37
- "url": "https://github.com/digiguru",
38
- "githubUsername": "digiguru"
39
- },
40
35
  {
41
36
  "name": "Eric Anderson",
42
37
  "url": "https://github.com/ericanderson",
@@ -151,6 +146,6 @@
151
146
  "@types/scheduler": "*",
152
147
  "csstype": "^3.0.2"
153
148
  },
154
- "typesPublisherContentHash": "038ae5d73fcd277965868acc0a792295891497f18063a518274a7dd89d756c2d",
149
+ "typesPublisherContentHash": "4d6f67b8ef8c547a3191a64dddc8a776e2cd4013ede28dfe7c7c0eb0be2944d0",
155
150
  "typeScriptVersion": "3.6"
156
151
  }