@types/react 16.8.12 → 16.8.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 +1 -1
- react/index.d.ts +14 -9
- react/package.json +2 -2
react/README.md
CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for React ( http://facebook.github.io/rea
|
|
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, 08 Apr 2019 04:24:39 GMT
|
12
12
|
* Dependencies: @types/csstype, @types/prop-types
|
13
13
|
* Global values: React
|
14
14
|
|
react/index.d.ts
CHANGED
@@ -2764,16 +2764,21 @@ declare namespace React {
|
|
2764
2764
|
// so boolean is only resolved for T = any
|
2765
2765
|
type IsExactlyAny<T> = boolean extends (T extends never ? true : false) ? true : false;
|
2766
2766
|
|
2767
|
+
type ExactlyAnyPropertyKeys<T> = { [K in keyof T]: IsExactlyAny<T[K]> extends true ? K : never }[keyof T];
|
2768
|
+
type NotExactlyAnyPropertyKeys<T> = Exclude<keyof T, ExactlyAnyPropertyKeys<T>>;
|
2769
|
+
|
2767
2770
|
// Try to resolve ill-defined props like for JS users: props can be any, or sometimes objects with properties of type any
|
2768
|
-
|
2769
|
-
// If
|
2770
|
-
|
2771
|
-
|
2772
|
-
|
2773
|
-
|
2774
|
-
|
2775
|
-
|
2776
|
-
|
2771
|
+
type MergePropTypes<P, T> =
|
2772
|
+
// If props is type any, use propTypes definitions
|
2773
|
+
IsExactlyAny<P> extends true ? T :
|
2774
|
+
// If declared props have indexed properties, ignore inferred props entirely as keyof gets widened
|
2775
|
+
string extends keyof P ? P :
|
2776
|
+
// Prefer declared types which are not exactly any
|
2777
|
+
& Pick<P, NotExactlyAnyPropertyKeys<P>>
|
2778
|
+
// For props which are exactly any, use the type inferred from propTypes if present
|
2779
|
+
& Pick<T, Exclude<keyof T, NotExactlyAnyPropertyKeys<P>>>
|
2780
|
+
// Keep leftover props not specified in propTypes
|
2781
|
+
& Pick<P, Exclude<keyof P, keyof T>>;
|
2777
2782
|
|
2778
2783
|
// Any prop that has a default prop becomes optional, but its type is unchanged
|
2779
2784
|
// Undeclared default props are augmented into the resulting allowable attributes
|
react/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/react",
|
3
|
-
"version": "16.8.
|
3
|
+
"version": "16.8.13",
|
4
4
|
"description": "TypeScript definitions for React",
|
5
5
|
"license": "MIT",
|
6
6
|
"contributors": [
|
@@ -129,6 +129,6 @@
|
|
129
129
|
"@types/prop-types": "*",
|
130
130
|
"csstype": "^2.2.0"
|
131
131
|
},
|
132
|
-
"typesPublisherContentHash": "
|
132
|
+
"typesPublisherContentHash": "53d31798b997bfdad69e11ba927c3df23f4f9df1aa3888dfb9b4d665e7a2e946",
|
133
133
|
"typeScriptVersion": "2.8"
|
134
134
|
}
|