@types/react 16.9.13 → 16.9.17

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.
Files changed (4) hide show
  1. react/README.md +2 -2
  2. react/global.d.ts +1 -0
  3. react/index.d.ts +48 -7
  4. 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: Sat, 23 Nov 2019 20:10:45 GMT
11
+ * Last updated: Fri, 20 Dec 2019 07:06:52 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), and Kyle Scully (https://github.com/zieka).
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/global.d.ts CHANGED
@@ -146,3 +146,4 @@ interface SVGViewElement extends SVGElement { }
146
146
  interface Text { }
147
147
  interface TouchList { }
148
148
  interface WebGLRenderingContext { }
149
+ interface WebGL2RenderingContext { }
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
 
@@ -45,6 +46,7 @@ type NativePointerEvent = PointerEvent;
45
46
  type NativeTransitionEvent = TransitionEvent;
46
47
  type NativeUIEvent = UIEvent;
47
48
  type NativeWheelEvent = WheelEvent;
49
+ type Booleanish = boolean | 'true' | 'false';
48
50
 
49
51
  /**
50
52
  * defined in scheduler/tracing
@@ -821,13 +823,19 @@ declare namespace React {
821
823
  // this technically does accept a second argument, but it's already under a deprecation warning
822
824
  // and it's not even released so probably better to not define it.
823
825
  type Dispatch<A> = (value: A) => void;
826
+ // Since action _can_ be undefined, dispatch may be called without any parameters.
827
+ type DispatchWithoutAction = () => void;
824
828
  // Unlike redux, the actions _can_ be anything
825
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;
826
832
  // types used to try and prevent the compiler from reducing S
827
833
  // to a supertype common with the second argument to useReducer()
828
834
  type ReducerState<R extends Reducer<any, any>> = R extends Reducer<infer S, any> ? S : never;
829
835
  type ReducerAction<R extends Reducer<any, any>> = R extends Reducer<any, infer A> ? A : never;
830
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;
831
839
  // TODO (TypeScript 3.0): ReadonlyArray<unknown>
832
840
  type DependencyList = ReadonlyArray<any>;
833
841
 
@@ -863,6 +871,38 @@ declare namespace React {
863
871
  * @see https://reactjs.org/docs/hooks-reference.html#usestate
864
872
  */
865
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];
866
906
  /**
867
907
  * An alternative to `useState`.
868
908
  *
@@ -1656,16 +1696,16 @@ declare namespace React {
1656
1696
  // Standard HTML Attributes
1657
1697
  accessKey?: string;
1658
1698
  className?: string;
1659
- contentEditable?: boolean;
1699
+ contentEditable?: Booleanish | "inherit";
1660
1700
  contextMenu?: string;
1661
1701
  dir?: string;
1662
- draggable?: boolean;
1702
+ draggable?: Booleanish;
1663
1703
  hidden?: boolean;
1664
1704
  id?: string;
1665
1705
  lang?: string;
1666
1706
  placeholder?: string;
1667
1707
  slot?: string;
1668
- spellCheck?: boolean;
1708
+ spellCheck?: Booleanish;
1669
1709
  style?: CSSProperties;
1670
1710
  tabIndex?: number;
1671
1711
  title?: string;
@@ -2258,6 +2298,7 @@ declare namespace React {
2258
2298
  // Other HTML properties supported by SVG elements in browsers
2259
2299
  role?: string;
2260
2300
  tabIndex?: number;
2301
+ crossOrigin?: "anonymous" | "use-credentials" | "";
2261
2302
 
2262
2303
  // SVG Specific attributes
2263
2304
  accentHeight?: number | string;
@@ -2272,7 +2313,7 @@ declare namespace React {
2272
2313
  ascent?: number | string;
2273
2314
  attributeName?: string;
2274
2315
  attributeType?: string;
2275
- autoReverse?: number | string;
2316
+ autoReverse?: Booleanish;
2276
2317
  azimuth?: number | string;
2277
2318
  baseFrequency?: number | string;
2278
2319
  baselineShift?: number | string;
@@ -2312,7 +2353,7 @@ declare namespace React {
2312
2353
  enableBackground?: number | string;
2313
2354
  end?: number | string;
2314
2355
  exponent?: number | string;
2315
- externalResourcesRequired?: number | string;
2356
+ externalResourcesRequired?: Booleanish;
2316
2357
  fill?: string;
2317
2358
  fillOpacity?: number | string;
2318
2359
  fillRule?: "nonzero" | "evenodd" | "inherit";
@@ -2321,7 +2362,7 @@ declare namespace React {
2321
2362
  filterUnits?: number | string;
2322
2363
  floodColor?: number | string;
2323
2364
  floodOpacity?: number | string;
2324
- focusable?: number | string;
2365
+ focusable?: Booleanish | "auto";
2325
2366
  fontFamily?: string;
2326
2367
  fontSize?: number | string;
2327
2368
  fontSizeAdjust?: number | string;
@@ -2399,7 +2440,7 @@ declare namespace React {
2399
2440
  pointsAtX?: number | string;
2400
2441
  pointsAtY?: number | string;
2401
2442
  pointsAtZ?: number | string;
2402
- preserveAlpha?: number | string;
2443
+ preserveAlpha?: Booleanish;
2403
2444
  preserveAspectRatio?: string;
2404
2445
  primitiveUnits?: number | string;
2405
2446
  r?: number | string;
react/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react",
3
- "version": "16.9.13",
3
+ "version": "16.9.17",
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": "8b210364cfb98b8b56a7788c5f8fa667ff53f93eb5c90934e24bf36e68ebc397",
127
+ "typesPublisherContentHash": "33aa32e48fbbb170b424b0f0b5aeb7a6d5107933a14e081994a389904942163c",
123
128
  "typeScriptVersion": "2.8"
124
129
  }