@types/react 16.9.15 → 16.9.19
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 +2 -2
- react/index.d.ts +43 -2
- react/package.json +7 -2
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,
|
11
|
+
* Last updated: Wed, 22 Jan 2020 17:30:26 GMT
|
12
12
|
* Dependencies: [@types/csstype](https://npmjs.com/package/@types/csstype), [@types/prop-types](https://npmjs.com/package/@types/prop-types)
|
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),
|
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), and Cong Zhang (https://github.com/dancerphil).
|
react/index.d.ts
CHANGED
@@ -21,6 +21,7 @@
|
|
21
21
|
// Kanitkorn Sujautra <https://github.com/lukyth>
|
22
22
|
// Sebastian Silbermann <https://github.com/eps1lon>
|
23
23
|
// Kyle Scully <https://github.com/zieka>
|
24
|
+
// Cong Zhang <https://github.com/dancerphil>
|
24
25
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
25
26
|
// TypeScript Version: 2.8
|
26
27
|
|
@@ -822,13 +823,19 @@ declare namespace React {
|
|
822
823
|
// this technically does accept a second argument, but it's already under a deprecation warning
|
823
824
|
// and it's not even released so probably better to not define it.
|
824
825
|
type Dispatch<A> = (value: A) => void;
|
826
|
+
// Since action _can_ be undefined, dispatch may be called without any parameters.
|
827
|
+
type DispatchWithoutAction = () => void;
|
825
828
|
// Unlike redux, the actions _can_ be anything
|
826
829
|
type Reducer<S, A> = (prevState: S, action: A) => S;
|
830
|
+
// If useReducer accepts a reducer without action, dispatch may be called without any parameters.
|
831
|
+
type ReducerWithoutAction<S> = (prevState: S) => S;
|
827
832
|
// types used to try and prevent the compiler from reducing S
|
828
833
|
// to a supertype common with the second argument to useReducer()
|
829
834
|
type ReducerState<R extends Reducer<any, any>> = R extends Reducer<infer S, any> ? S : never;
|
830
835
|
type ReducerAction<R extends Reducer<any, any>> = R extends Reducer<any, infer A> ? A : never;
|
831
836
|
// The identity check is done with the SameValue algorithm (Object.is), which is stricter than ===
|
837
|
+
type ReducerStateWithoutAction<R extends ReducerWithoutAction<any>> =
|
838
|
+
R extends ReducerWithoutAction<infer S> ? S : never;
|
832
839
|
// TODO (TypeScript 3.0): ReadonlyArray<unknown>
|
833
840
|
type DependencyList = ReadonlyArray<any>;
|
834
841
|
|
@@ -864,6 +871,38 @@ declare namespace React {
|
|
864
871
|
* @see https://reactjs.org/docs/hooks-reference.html#usestate
|
865
872
|
*/
|
866
873
|
function useState<S = undefined>(): [S | undefined, Dispatch<SetStateAction<S | undefined>>];
|
874
|
+
/**
|
875
|
+
* An alternative to `useState`.
|
876
|
+
*
|
877
|
+
* `useReducer` is usually preferable to `useState` when you have complex state logic that involves
|
878
|
+
* multiple sub-values. It also lets you optimize performance for components that trigger deep
|
879
|
+
* updates because you can pass `dispatch` down instead of callbacks.
|
880
|
+
*
|
881
|
+
* @version 16.8.0
|
882
|
+
* @see https://reactjs.org/docs/hooks-reference.html#usereducer
|
883
|
+
*/
|
884
|
+
// overload where dispatch could accept 0 arguments.
|
885
|
+
function useReducer<R extends ReducerWithoutAction<any>, I>(
|
886
|
+
reducer: R,
|
887
|
+
initializerArg: I,
|
888
|
+
initializer: (arg: I) => ReducerStateWithoutAction<R>
|
889
|
+
): [ReducerStateWithoutAction<R>, DispatchWithoutAction];
|
890
|
+
/**
|
891
|
+
* An alternative to `useState`.
|
892
|
+
*
|
893
|
+
* `useReducer` is usually preferable to `useState` when you have complex state logic that involves
|
894
|
+
* multiple sub-values. It also lets you optimize performance for components that trigger deep
|
895
|
+
* updates because you can pass `dispatch` down instead of callbacks.
|
896
|
+
*
|
897
|
+
* @version 16.8.0
|
898
|
+
* @see https://reactjs.org/docs/hooks-reference.html#usereducer
|
899
|
+
*/
|
900
|
+
// overload where dispatch could accept 0 arguments.
|
901
|
+
function useReducer<R extends ReducerWithoutAction<any>>(
|
902
|
+
reducer: R,
|
903
|
+
initializerArg: ReducerStateWithoutAction<R>,
|
904
|
+
initializer?: undefined
|
905
|
+
): [ReducerStateWithoutAction<R>, DispatchWithoutAction];
|
867
906
|
/**
|
868
907
|
* An alternative to `useState`.
|
869
908
|
*
|
@@ -2259,6 +2298,7 @@ declare namespace React {
|
|
2259
2298
|
// Other HTML properties supported by SVG elements in browsers
|
2260
2299
|
role?: string;
|
2261
2300
|
tabIndex?: number;
|
2301
|
+
crossOrigin?: "anonymous" | "use-credentials" | "";
|
2262
2302
|
|
2263
2303
|
// SVG Specific attributes
|
2264
2304
|
accentHeight?: number | string;
|
@@ -2748,11 +2788,12 @@ declare namespace React {
|
|
2748
2788
|
// ----------------------------------------------------------------------
|
2749
2789
|
|
2750
2790
|
interface ReactChildren {
|
2751
|
-
map<T, C>(children: C | C[], fn: (child: C, index: number) => T):
|
2791
|
+
map<T, C>(children: C | C[], fn: (child: C, index: number) => T):
|
2792
|
+
C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>;
|
2752
2793
|
forEach<C>(children: C | C[], fn: (child: C, index: number) => void): void;
|
2753
2794
|
count(children: any): number;
|
2754
2795
|
only<C>(children: C): C extends any[] ? never : C;
|
2755
|
-
toArray
|
2796
|
+
toArray(children: ReactNode | ReactNode[]): Array<Exclude<ReactNode, boolean | null | undefined>>;
|
2756
2797
|
}
|
2757
2798
|
|
2758
2799
|
//
|
react/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/react",
|
3
|
-
"version": "16.9.
|
3
|
+
"version": "16.9.19",
|
4
4
|
"description": "TypeScript definitions for React",
|
5
5
|
"license": "MIT",
|
6
6
|
"contributors": [
|
@@ -105,6 +105,11 @@
|
|
105
105
|
"name": "Kyle Scully",
|
106
106
|
"url": "https://github.com/zieka",
|
107
107
|
"githubUsername": "zieka"
|
108
|
+
},
|
109
|
+
{
|
110
|
+
"name": "Cong Zhang",
|
111
|
+
"url": "https://github.com/dancerphil",
|
112
|
+
"githubUsername": "dancerphil"
|
108
113
|
}
|
109
114
|
],
|
110
115
|
"main": "",
|
@@ -119,6 +124,6 @@
|
|
119
124
|
"@types/prop-types": "*",
|
120
125
|
"csstype": "^2.2.0"
|
121
126
|
},
|
122
|
-
"typesPublisherContentHash": "
|
127
|
+
"typesPublisherContentHash": "2578868eff06740bf655198aa831dea1749873f5cbd0e1218e2cc15a6e7e8e6e",
|
123
128
|
"typeScriptVersion": "2.8"
|
124
129
|
}
|