@types/react 16.7.19 → 16.8.0

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 (3) hide show
  1. react/README.md +3 -3
  2. react/index.d.ts +30 -26
  3. react/package.json +9 -4
react/README.md CHANGED
@@ -2,15 +2,15 @@
2
2
  > `npm install --save @types/react`
3
3
 
4
4
  # Summary
5
- This package contains type definitions for React (http://facebook.github.io/react/).
5
+ This package contains type definitions for React ( http://facebook.github.io/react/ ).
6
6
 
7
7
  # Details
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, 16 Jan 2019 07:33:16 GMT
11
+ * Last updated: Thu, 31 Jan 2019 16:41:25 GMT
12
12
  * Dependencies: @types/csstype, @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>, Tanguy Krotoff <https://github.com/tkrotoff>, Dovydas Navickas <https://github.com/DovydasNavickas>, Stéphane Goetz <https://github.com/onigoetz>, 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/Kovensky>, Paul Sherman <https://github.com/pshrmn>.
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>, Tanguy Krotoff <https://github.com/tkrotoff>, Dovydas Navickas <https://github.com/DovydasNavickas>, Stéphane Goetz <https://github.com/onigoetz>, 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>, Paul Sherman <https://github.com/pshrmn>, Sunil Pai <https://github.com/threepointone>.
react/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for React 16.7
1
+ // Type definitions for React 16.8
2
2
  // Project: http://facebook.github.io/react/
3
3
  // Definitions by: Asana <https://asana.com>
4
4
  // AssureSign <http://www.assuresign.com>
@@ -18,8 +18,9 @@
18
18
  // Olivier Pascal <https://github.com/pascaloliv>
19
19
  // Martin Hochel <https://github.com/hotell>
20
20
  // Frank Li <https://github.com/franklixuefei>
21
- // Jessica Franco <https://github.com/Kovensky>
21
+ // Jessica Franco <https://github.com/Jessidhia>
22
22
  // Paul Sherman <https://github.com/pshrmn>
23
+ // Sunil Pai <https://github.com/threepointone>
23
24
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
24
25
  // TypeScript Version: 2.8
25
26
 
@@ -57,6 +58,10 @@ declare namespace React {
57
58
  ComponentType<P>;
58
59
  type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>;
59
60
 
61
+ type JSXElementConstructor<P> =
62
+ | ((props: P) => ReactElement<any> | null)
63
+ | (new (props: P) => Component<P, any>);
64
+
60
65
  type Key = string | number;
61
66
 
62
67
  interface RefObject<T> {
@@ -78,33 +83,35 @@ declare namespace React {
78
83
  ref?: LegacyRef<T>;
79
84
  }
80
85
 
81
- interface ReactElement<P> {
82
- type: string | ComponentClass<P> | FunctionComponent<P>;
86
+ interface ReactElement<P, T extends string | JSXElementConstructor<any> = string | JSXElementConstructor<any>> {
87
+ type: T;
83
88
  props: P;
84
89
  key: Key | null;
85
90
  }
86
91
 
92
+ interface ReactComponentElement<
93
+ T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>,
94
+ P = Pick<ComponentProps<T>, Exclude<keyof ComponentProps<T>, 'key' | 'ref'>>
95
+ > extends ReactElement<P, T> { }
96
+
87
97
  /**
88
98
  * @deprecated Please use `FunctionComponentElement`
89
99
  */
90
100
  type SFCElement<P> = FunctionComponentElement<P>;
91
101
 
92
- interface FunctionComponentElement<P> extends ReactElement<P> {
93
- type: FunctionComponent<P>;
102
+ interface FunctionComponentElement<P> extends ReactElement<P, FunctionComponent<P>> {
94
103
  ref?: 'ref' extends keyof P ? P extends { ref?: infer R } ? R : never : never;
95
104
  }
96
105
 
97
106
  type CElement<P, T extends Component<P, ComponentState>> = ComponentElement<P, T>;
98
- interface ComponentElement<P, T extends Component<P, ComponentState>> extends ReactElement<P> {
99
- type: ComponentClass<P>;
107
+ interface ComponentElement<P, T extends Component<P, ComponentState>> extends ReactElement<P, ComponentClass<P>> {
100
108
  ref?: LegacyRef<T>;
101
109
  }
102
110
 
103
111
  type ClassicElement<P> = CElement<P, ClassicComponent<P, ComponentState>>;
104
112
 
105
113
  // string fallback for custom web-components
106
- interface DOMElement<P extends HTMLAttributes<T> | SVGAttributes<T>, T extends Element> extends ReactElement<P> {
107
- type: string;
114
+ interface DOMElement<P extends HTMLAttributes<T> | SVGAttributes<T>, T extends Element> extends ReactElement<P, string> {
108
115
  ref: LegacyRef<T>;
109
116
  }
110
117
 
@@ -469,7 +476,7 @@ declare namespace React {
469
476
  }
470
477
 
471
478
  interface RefForwardingComponent<T, P = {}> {
472
- (props: P & { children?: ReactNode }, ref: Ref<T> | null): ReactElement<any> | null;
479
+ (props: P & { children?: ReactNode }, ref: Ref<T>): ReactElement<any> | null;
473
480
  propTypes?: WeakValidationMap<P>;
474
481
  contextTypes?: ValidationMap<any>;
475
482
  defaultProps?: Partial<P>;
@@ -491,10 +498,6 @@ declare namespace React {
491
498
  getDefaultProps?(): P;
492
499
  }
493
500
 
494
- type JSXElementConstructor<P> =
495
- | ((props: P) => ReactElement<any> | null)
496
- | (new (props: P) => Component<P, any>);
497
-
498
501
  /**
499
502
  * We use an intersection type to infer multiple type parameters from
500
503
  * a single argument, which is useful for many top-level API defs.
@@ -867,15 +870,15 @@ declare namespace React {
867
870
  function useEffect(effect: EffectCallback, inputs?: InputIdentityList): void;
868
871
  // NOTE: this does not accept strings, but this will have to be fixed by removing strings from type Ref<T>
869
872
  /**
870
- * `useImperativeMethods` customizes the instance value that is exposed to parent components when using
873
+ * `useImperativeHandle` customizes the instance value that is exposed to parent components when using
871
874
  * `ref`. As always, imperative code using refs should be avoided in most cases.
872
875
  *
873
- * `useImperativeMethods` should be used with `React.forwardRef`.
876
+ * `useImperativeHandle` should be used with `React.forwardRef`.
874
877
  *
875
878
  * @version experimental
876
- * @see https://reactjs.org/docs/hooks-reference.html#useimperativemethods
879
+ * @see https://reactjs.org/docs/hooks-reference.html#useimperativehandle
877
880
  */
878
- function useImperativeMethods<T, R extends T>(ref: Ref<T>|undefined, init: () => R, inputs?: InputIdentityList): void;
881
+ function useImperativeHandle<T, R extends T>(ref: Ref<T>|undefined, init: () => R, inputs?: InputIdentityList): void;
879
882
  // I made 'inputs' required here and in useMemo as there's no point to memoizing without the memoization key
880
883
  // useCallback(X) is identical to just using X, useMemo(() => Y) is identical to just using Y.
881
884
  /**
@@ -2586,12 +2589,11 @@ declare namespace React {
2586
2589
  // ----------------------------------------------------------------------
2587
2590
 
2588
2591
  interface ReactChildren {
2589
- map<T, C extends ReactElement<any>>(children: C[], fn: (child: C, index: number) => T): T[];
2590
- map<T>(children: ReactNode, fn: (child: ReactChild, index: number) => T): T[];
2591
- forEach(children: ReactNode, fn: (child: ReactChild, index: number) => void): void;
2592
- count(children: ReactNode): number;
2593
- only(children: ReactNode): ReactElement<any>;
2594
- toArray(children: ReactNode): ReactChild[];
2592
+ map<T, C>(children: C | C[], fn: (child: C, index: number) => T): T[];
2593
+ forEach<C>(children: C | C[], fn: (child: C, index: number) => void): void;
2594
+ count(children: any): number;
2595
+ only<C>(children: C): C extends any[] ? never : C;
2596
+ toArray<C>(children: C | C[]): C[];
2595
2597
  }
2596
2598
 
2597
2599
  //
@@ -2670,7 +2672,7 @@ type ReactManagedAttributes<C, P> = C extends { propTypes: infer T; defaultProps
2670
2672
  declare global {
2671
2673
  namespace JSX {
2672
2674
  // tslint:disable-next-line:no-empty-interface
2673
- interface Element extends React.ReactElement<any> { }
2675
+ interface Element extends React.ReactElement<any, any> { }
2674
2676
  interface ElementClass extends React.Component<any> {
2675
2677
  render(): React.ReactNode;
2676
2678
  }
@@ -2812,6 +2814,7 @@ declare global {
2812
2814
  svg: React.SVGProps<SVGSVGElement>;
2813
2815
 
2814
2816
  animate: React.SVGProps<SVGElement>; // TODO: It is SVGAnimateElement but is not in TypeScript's lib.dom.d.ts for now.
2817
+ animateMotion: React.SVGProps<SVGElement>;
2815
2818
  animateTransform: React.SVGProps<SVGElement>; // TODO: It is SVGAnimateTransformElement but is not in TypeScript's lib.dom.d.ts for now.
2816
2819
  circle: React.SVGProps<SVGCircleElement>;
2817
2820
  clipPath: React.SVGProps<SVGClipPathElement>;
@@ -2851,6 +2854,7 @@ declare global {
2851
2854
  marker: React.SVGProps<SVGMarkerElement>;
2852
2855
  mask: React.SVGProps<SVGMaskElement>;
2853
2856
  metadata: React.SVGProps<SVGMetadataElement>;
2857
+ mpath: React.SVGProps<SVGElement>;
2854
2858
  path: React.SVGProps<SVGPathElement>;
2855
2859
  pattern: React.SVGProps<SVGPatternElement>;
2856
2860
  polygon: React.SVGProps<SVGPolygonElement>;
react/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react",
3
- "version": "16.7.19",
3
+ "version": "16.8.0",
4
4
  "description": "TypeScript definitions for React",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -93,13 +93,18 @@
93
93
  },
94
94
  {
95
95
  "name": "Jessica Franco",
96
- "url": "https://github.com/Kovensky",
97
- "githubUsername": "Kovensky"
96
+ "url": "https://github.com/Jessidhia",
97
+ "githubUsername": "Jessidhia"
98
98
  },
99
99
  {
100
100
  "name": "Paul Sherman",
101
101
  "url": "https://github.com/pshrmn",
102
102
  "githubUsername": "pshrmn"
103
+ },
104
+ {
105
+ "name": "Sunil Pai",
106
+ "url": "https://github.com/threepointone",
107
+ "githubUsername": "threepointone"
103
108
  }
104
109
  ],
105
110
  "main": "",
@@ -113,6 +118,6 @@
113
118
  "@types/prop-types": "*",
114
119
  "csstype": "^2.2.0"
115
120
  },
116
- "typesPublisherContentHash": "3209dc5b6c072d83d092485afa4545ac4fda8318818b78290cf8082a1f3ff09f",
121
+ "typesPublisherContentHash": "1acfcff0f8ab4e67ed6c1f0f7072674d2d41043f185eed50d09ca083c48a96ac",
117
122
  "typeScriptVersion": "2.8"
118
123
  }