@types/react 17.0.18 → 17.0.22
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/index.d.ts +37 -5
- react/next.d.ts +2 -2
- 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: Mon, 20 Sep 2021 06:31: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/index.d.ts
CHANGED
@@ -805,11 +805,10 @@ declare namespace React {
|
|
805
805
|
|
806
806
|
/** Ensures that the props do not include ref at all */
|
807
807
|
type PropsWithoutRef<P> =
|
808
|
-
//
|
808
|
+
// Pick would not be sufficient for this. We'd like to avoid unnecessary mapping and need a distributive conditional to support unions.
|
809
|
+
// see: https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types
|
809
810
|
// https://github.com/Microsoft/TypeScript/issues/28339
|
810
|
-
'ref' extends keyof P
|
811
|
-
? Pick<P, Exclude<keyof P, 'ref'>>
|
812
|
-
: P;
|
811
|
+
P extends any ? ('ref' extends keyof P ? Pick<P, Exclude<keyof P, 'ref'>> : P) : P;
|
813
812
|
/** Ensures that the props do not include string ref, which cannot be forwarded */
|
814
813
|
type PropsWithRef<P> =
|
815
814
|
// Just "P extends { ref?: infer R }" looks sufficient, but R will infer as {} if P is {}.
|
@@ -840,6 +839,14 @@ declare namespace React {
|
|
840
839
|
type ComponentPropsWithoutRef<T extends ElementType> =
|
841
840
|
PropsWithoutRef<ComponentProps<T>>;
|
842
841
|
|
842
|
+
type ComponentRef<T extends ElementType> = T extends NamedExoticComponent<
|
843
|
+
ComponentPropsWithoutRef<T> & RefAttributes<infer Method>
|
844
|
+
>
|
845
|
+
? Method
|
846
|
+
: ComponentPropsWithRef<T> extends RefAttributes<infer Method>
|
847
|
+
? Method
|
848
|
+
: never;
|
849
|
+
|
843
850
|
// will show `Memo(${Component.displayName || Component.name})` in devtools by default,
|
844
851
|
// but can be given its own specific name
|
845
852
|
type MemoExoticComponent<T extends ComponentType<any>> = NamedExoticComponent<ComponentPropsWithRef<T>> & {
|
@@ -2159,6 +2166,31 @@ declare namespace React {
|
|
2159
2166
|
dateTime?: string | undefined;
|
2160
2167
|
}
|
2161
2168
|
|
2169
|
+
type HTMLInputTypeAttribute =
|
2170
|
+
| 'button'
|
2171
|
+
| 'checkbox'
|
2172
|
+
| 'color'
|
2173
|
+
| 'date'
|
2174
|
+
| 'datetime-local'
|
2175
|
+
| 'email'
|
2176
|
+
| 'file'
|
2177
|
+
| 'hidden'
|
2178
|
+
| 'image'
|
2179
|
+
| 'month'
|
2180
|
+
| 'number'
|
2181
|
+
| 'password'
|
2182
|
+
| 'radio'
|
2183
|
+
| 'range'
|
2184
|
+
| 'reset'
|
2185
|
+
| 'search'
|
2186
|
+
| 'submit'
|
2187
|
+
| 'tel'
|
2188
|
+
| 'text'
|
2189
|
+
| 'time'
|
2190
|
+
| 'url'
|
2191
|
+
| 'week'
|
2192
|
+
| (string & {});
|
2193
|
+
|
2162
2194
|
interface InputHTMLAttributes<T> extends HTMLAttributes<T> {
|
2163
2195
|
accept?: string | undefined;
|
2164
2196
|
alt?: string | undefined;
|
@@ -2190,7 +2222,7 @@ declare namespace React {
|
|
2190
2222
|
size?: number | undefined;
|
2191
2223
|
src?: string | undefined;
|
2192
2224
|
step?: number | string | undefined;
|
2193
|
-
type?:
|
2225
|
+
type?: HTMLInputTypeAttribute | undefined;
|
2194
2226
|
value?: string | ReadonlyArray<string> | number | undefined;
|
2195
2227
|
width?: number | string | undefined;
|
2196
2228
|
|
react/next.d.ts
CHANGED
@@ -133,8 +133,8 @@ declare module '.' {
|
|
133
133
|
*
|
134
134
|
* The `useTransition` hook returns two values in an array.
|
135
135
|
*
|
136
|
-
* The first is boolean, React’s way of informing us whether we’re waiting for the transition to finish.
|
137
|
-
* The
|
136
|
+
* The first is a boolean, React’s way of informing us whether we’re waiting for the transition to finish.
|
137
|
+
* The second is a function that takes a callback. We can use it to tell React which state we want to defer.
|
138
138
|
*
|
139
139
|
* **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
|
140
140
|
*
|
react/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/react",
|
3
|
-
"version": "17.0.
|
3
|
+
"version": "17.0.22",
|
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": "3933860c16c33e1ceb21ae8552a161fcc03e06296516db1876ce75567f2b9071",
|
150
|
+
"typeScriptVersion": "3.7"
|
151
151
|
}
|