@types/react 17.0.20 → 17.0.24

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 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: Sun, 05 Sep 2021 10:01:23 GMT
11
+ * Last updated: Tue, 21 Sep 2021 18:31:44 GMT
12
12
  * Dependencies: [@types/csstype](https://npmjs.com/package/@types/csstype), [@types/prop-types](https://npmjs.com/package/@types/prop-types), [@types/scheduler](https://npmjs.com/package/@types/scheduler)
13
13
  * Global values: `React`
14
14
 
react/experimental.d.ts CHANGED
@@ -38,4 +38,17 @@ import React = require('./next');
38
38
 
39
39
  export {};
40
40
 
41
- declare module '.' {}
41
+ declare module '.' {
42
+ /**
43
+ * @param subscribe
44
+ * @param getSnapshot
45
+ *
46
+ * @see https://github.com/reactwg/react-18/discussions/86
47
+ */
48
+ // keep in sync with `useSyncExternalStore` from `use-sync-external-store`
49
+ export function unstable_useSyncExternalStore<Snapshot>(
50
+ subscribe: (onStoreChange: () => void) => () => void,
51
+ getSnapshot: () => Snapshot,
52
+ getServerSnapshot?: () => Snapshot,
53
+ ): Snapshot;
54
+ }
react/index.d.ts CHANGED
@@ -805,11 +805,10 @@ declare namespace React {
805
805
 
806
806
  /** Ensures that the props do not include ref at all */
807
807
  type PropsWithoutRef<P> =
808
- // Just Pick would be sufficient for this, but I'm trying to avoid unnecessary mapping over union types
808
+ // Pick would not be sufficient for this. We'd like to avoid unnecessary mapping and need a distributive conditional to support unions.
809
+ // see: https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types
809
810
  // https://github.com/Microsoft/TypeScript/issues/28339
810
- 'ref' extends keyof P
811
- ? Pick<P, Exclude<keyof P, 'ref'>>
812
- : P;
811
+ P extends any ? ('ref' extends keyof P ? Pick<P, Exclude<keyof P, 'ref'>> : P) : P;
813
812
  /** Ensures that the props do not include string ref, which cannot be forwarded */
814
813
  type PropsWithRef<P> =
815
814
  // Just "P extends { ref?: infer R }" looks sufficient, but R will infer as {} if P is {}.
@@ -1900,7 +1899,7 @@ declare namespace React {
1900
1899
  autoComplete?: string | undefined;
1901
1900
  autoFocus?: boolean | undefined;
1902
1901
  autoPlay?: boolean | undefined;
1903
- capture?: boolean | string | undefined;
1902
+ capture?: boolean | 'user' | 'environment' | undefined;
1904
1903
  cellPadding?: number | string | undefined;
1905
1904
  cellSpacing?: number | string | undefined;
1906
1905
  charSet?: string | undefined;
@@ -2197,7 +2196,7 @@ declare namespace React {
2197
2196
  alt?: string | undefined;
2198
2197
  autoComplete?: string | undefined;
2199
2198
  autoFocus?: boolean | undefined;
2200
- capture?: boolean | string | undefined; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute
2199
+ capture?: boolean | 'user' | 'environment' | undefined; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute
2201
2200
  checked?: boolean | undefined;
2202
2201
  crossOrigin?: string | undefined;
2203
2202
  disabled?: boolean | undefined;
react/next.d.ts CHANGED
@@ -133,8 +133,8 @@ declare module '.' {
133
133
  *
134
134
  * The `useTransition` hook returns two values in an array.
135
135
  *
136
- * The first is boolean, React’s way of informing us whether we’re waiting for the transition to finish.
137
- * The seconda is a function that takes a callback. We can use it to tell React which state we want to defer.
136
+ * The first is a boolean, React’s way of informing us whether we’re waiting for the transition to finish.
137
+ * The second is a function that takes a callback. We can use it to tell React which state we want to defer.
138
138
  *
139
139
  * **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
140
140
  *
react/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react",
3
- "version": "17.0.20",
3
+ "version": "17.0.24",
4
4
  "description": "TypeScript definitions for React",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
6
6
  "license": "MIT",
@@ -146,6 +146,6 @@
146
146
  "@types/scheduler": "*",
147
147
  "csstype": "^3.0.2"
148
148
  },
149
- "typesPublisherContentHash": "b98539428aeb48bb4b954672f744bccb907e1934aa7ce9a24589803ca068a20f",
149
+ "typesPublisherContentHash": "3e4ee4aee8340bd8dc891c56ea875b60b5c6cd225b7eaed1577ac46890619a5d",
150
150
  "typeScriptVersion": "3.7"
151
151
  }