@types/react 16.9.48 → 16.9.49

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/experimental.d.ts +22 -0
  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: Wed, 26 Aug 2020 19:36:31 GMT
11
+ * Last updated: Mon, 31 Aug 2020 16:41:48 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/experimental.d.ts CHANGED
@@ -163,4 +163,26 @@ declare module '.' {
163
163
  * @see https://reactjs.org/docs/concurrent-mode-reference.html#usetransition
164
164
  */
165
165
  export function unstable_useTransition(config?: SuspenseConfig | null): [TransitionStartFunction, boolean];
166
+
167
+ /**
168
+ * @private
169
+ */
170
+ const opaqueIdentifierBranding: unique symbol;
171
+ /**
172
+ * WARNING: Don't use this as a `string`.
173
+ *
174
+ * This is an opaque type that is not supposed to type-check structurally.
175
+ * It is only valid if returned from React methods and passed to React e.g. `<button aria-labelledby={opaqueIdentifier} />`
176
+ */
177
+ // We can't create a type that would be rejected for string concatenation or `.toString()` calls.
178
+ // So in order to not have to add `string | OpaqueIdentifier` to every react-dom host prop we intersect it with `string`.
179
+ type OpaqueIdentifier = string & {
180
+ readonly [opaqueIdentifierBranding]: unknown;
181
+ // While this would cause `const stringified: string = opaqueIdentifier.toString()` to not type-check it also adds completions while typing.
182
+ // It would also still allow string concatenation.
183
+ // Unsure which is better. Not type-checking or not suggesting.
184
+ // toString(): void;
185
+ };
186
+
187
+ export function unstable_useOpaqueIdentifier(): OpaqueIdentifier;
166
188
  }
react/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react",
3
- "version": "16.9.48",
3
+ "version": "16.9.49",
4
4
  "description": "TypeScript definitions for React",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -144,6 +144,6 @@
144
144
  "@types/prop-types": "*",
145
145
  "csstype": "^3.0.2"
146
146
  },
147
- "typesPublisherContentHash": "f892a8f3578a4196f9b44230278818d9e2ca4f025267759ec2b03f8e91133279",
147
+ "typesPublisherContentHash": "b034149a5cda0dd4cd3ee0abc4fec00bfcaf5a2d7d57ac0b8097f45735912dd3",
148
148
  "typeScriptVersion": "3.1"
149
149
  }