@types/react 16.9.20 → 16.9.21

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 +1 -1
  2. react/index.d.ts +18 -5
  3. react/package.json +2 -2
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: Tue, 18 Feb 2020 01:23:08 GMT
11
+ * Last updated: Thu, 20 Feb 2020 00:44:06 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
 
react/index.d.ts CHANGED
@@ -522,14 +522,27 @@ declare namespace React {
522
522
  displayName?: string;
523
523
  }
524
524
 
525
- interface RefForwardingComponent<T, P = {}> {
525
+ interface ForwardRefRenderFunction<T, P = {}> {
526
526
  (props: PropsWithChildren<P>, ref: Ref<T>): ReactElement | null;
527
- propTypes?: WeakValidationMap<P>;
528
- contextTypes?: ValidationMap<any>;
529
- defaultProps?: Partial<P>;
530
527
  displayName?: string;
528
+ // explicit rejected with `never` required due to
529
+ // https://github.com/microsoft/TypeScript/issues/36826
530
+ /**
531
+ * defaultProps are not supported on render functions
532
+ */
533
+ defaultProps?: never;
534
+ /**
535
+ * propTypes are not supported on render functions
536
+ */
537
+ propTypes?: never;
531
538
  }
532
539
 
540
+ /**
541
+ * @deprecated Use ForwardRefRenderingFunction. forwardRef doesn't accept a
542
+ * "real" component.
543
+ */
544
+ interface RefForwardingComponent <T, P = {}> extends ForwardRefRenderFunction<T, P> {}
545
+
533
546
  interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
534
547
  new (props: P, context?: any): Component<P, S>;
535
548
  propTypes?: WeakValidationMap<P>;
@@ -750,7 +763,7 @@ declare namespace React {
750
763
  propTypes?: WeakValidationMap<P>;
751
764
  }
752
765
 
753
- function forwardRef<T, P = {}>(Component: RefForwardingComponent<T, P>): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
766
+ function forwardRef<T, P = {}>(render: ForwardRefRenderFunction<T, P>): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
754
767
 
755
768
  /** Ensures that the props do not include ref at all */
756
769
  type PropsWithoutRef<P> =
react/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react",
3
- "version": "16.9.20",
3
+ "version": "16.9.21",
4
4
  "description": "TypeScript definitions for React",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -124,6 +124,6 @@
124
124
  "@types/prop-types": "*",
125
125
  "csstype": "^2.2.0"
126
126
  },
127
- "typesPublisherContentHash": "600801dcf13e523088c16287ef5be3114a873b77294f87ecda54770774482edb",
127
+ "typesPublisherContentHash": "2995363f213d73aa3dd84369e03d4ce7c0eaf4486c859ad0083de971b9d85b02",
128
128
  "typeScriptVersion": "2.8"
129
129
  }