@pinuts/bsr-uikit-relaunch 0.2.9 → 0.2.11

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 (192) hide show
  1. package/dist/hooks/withFieldGroup.d.ts.map +1 -1
  2. package/dist/hooks/withFieldGroup.js +0 -1
  3. package/dist/index.js +2 -134
  4. package/dist/{main.js.LICENSE.txt → index.js.LICENSE.txt} +2 -2
  5. package/dist/items/BSRAddressSelector/BSRAddressSelector.d.ts.map +1 -1
  6. package/dist/items/BSRAddressSelector/BSRAddressSelector.js +1 -2
  7. package/dist/items/BSRAddressSelector/BSRStreetPlzSelector.d.ts.map +1 -1
  8. package/dist/items/BSRAddressSelector/BSRStreetPlzSelector.js +1 -2
  9. package/dist/styles/main.scss +5 -3
  10. package/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js +2 -2
  11. package/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +1 -1
  12. package/node_modules/@babel/runtime/helpers/esm/superPropGet.js +4 -4
  13. package/node_modules/@babel/runtime/helpers/esm/superPropSet.js +2 -2
  14. package/node_modules/@babel/runtime/helpers/objectWithoutProperties.js +2 -2
  15. package/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js +1 -1
  16. package/node_modules/@babel/runtime/helpers/superPropGet.js +4 -4
  17. package/node_modules/@babel/runtime/helpers/superPropSet.js +2 -2
  18. package/node_modules/@babel/runtime/package.json +1 -1
  19. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/cs/diagnosticMessages.generated.json +4 -16
  20. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/de/diagnosticMessages.generated.json +4 -16
  21. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/es/diagnosticMessages.generated.json +4 -16
  22. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/fr/diagnosticMessages.generated.json +4 -16
  23. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/it/diagnosticMessages.generated.json +4 -16
  24. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/ja/diagnosticMessages.generated.json +4 -16
  25. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/ko/diagnosticMessages.generated.json +4 -16
  26. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.decorators.d.ts +15 -13
  27. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.dom.d.ts +219 -1115
  28. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2015.core.d.ts +9 -9
  29. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2015.iterable.d.ts +27 -90
  30. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2015.symbol.wellknown.d.ts +10 -10
  31. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2016.array.include.d.ts +9 -9
  32. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2016.intl.d.ts +1 -1
  33. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2017.d.ts +2 -3
  34. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2017.sharedmemory.d.ts +14 -14
  35. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2017.typedarrays.d.ts +9 -9
  36. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2020.bigint.d.ts +50 -54
  37. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2020.intl.d.ts +36 -36
  38. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2020.sharedmemory.d.ts +11 -13
  39. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2020.string.d.ts +0 -2
  40. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2021.intl.d.ts +17 -17
  41. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2021.weakref.d.ts +0 -2
  42. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2022.array.d.ts +11 -11
  43. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2022.d.ts +2 -1
  44. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2022.error.d.ts +0 -2
  45. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2022.intl.d.ts +9 -9
  46. package/node_modules/{typescript/lib/lib.es2024.sharedmemory.d.ts → @pinuts/form-builder/node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts} +0 -29
  47. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2023.array.d.ts +99 -99
  48. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es5.d.ts +252 -252
  49. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.esnext.array.d.ts +1 -1
  50. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.esnext.collection.d.ts +11 -1
  51. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.esnext.d.ts +5 -1
  52. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.webworker.d.ts +34 -311
  53. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/pl/diagnosticMessages.generated.json +4 -16
  54. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/pt-br/diagnosticMessages.generated.json +4 -16
  55. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/ru/diagnosticMessages.generated.json +4 -16
  56. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/tr/diagnosticMessages.generated.json +4 -16
  57. package/node_modules/{typescript/lib/_tsc.js → @pinuts/form-builder/node_modules/typescript/lib/tsc.js} +1863 -3484
  58. package/node_modules/{typescript/lib/_tsserver.js → @pinuts/form-builder/node_modules/typescript/lib/tsserver.js} +1 -1
  59. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/typesMap.json +497 -497
  60. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/typescript.d.ts +22 -82
  61. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/typescript.js +2998 -5593
  62. package/node_modules/{typescript/lib/_typingsInstaller.js → @pinuts/form-builder/node_modules/typescript/lib/typingsInstaller.js} +16 -2
  63. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/zh-cn/diagnosticMessages.generated.json +5 -17
  64. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/zh-tw/diagnosticMessages.generated.json +4 -16
  65. package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/package.json +23 -22
  66. package/node_modules/@types/hoist-non-react-statics/README.md +13 -13
  67. package/node_modules/@types/hoist-non-react-statics/index.d.ts +12 -12
  68. package/node_modules/@types/hoist-non-react-statics/package.json +3 -4
  69. package/node_modules/@types/prop-types/LICENSE +21 -0
  70. package/node_modules/@types/prop-types/README.md +15 -0
  71. package/node_modules/@types/prop-types/index.d.ts +114 -0
  72. package/node_modules/@types/prop-types/package.json +35 -0
  73. package/node_modules/@types/react/README.md +3 -3
  74. package/node_modules/@types/react/canary.d.ts +118 -3
  75. package/node_modules/@types/react/experimental.d.ts +4 -89
  76. package/node_modules/@types/react/index.d.ts +772 -435
  77. package/node_modules/@types/react/package.json +9 -9
  78. package/node_modules/@types/react/ts5.0/canary.d.ts +118 -3
  79. package/node_modules/@types/react/ts5.0/experimental.d.ts +4 -89
  80. package/node_modules/@types/react/ts5.0/index.d.ts +768 -431
  81. package/node_modules/hoist-non-react-statics/CHANGELOG.md +37 -0
  82. package/node_modules/tslib/modules/index.d.ts +0 -1
  83. package/node_modules/tslib/modules/index.js +0 -2
  84. package/node_modules/tslib/package.json +1 -1
  85. package/node_modules/tslib/tslib.d.ts +0 -7
  86. package/node_modules/tslib/tslib.es6.js +1 -24
  87. package/node_modules/tslib/tslib.es6.mjs +1 -24
  88. package/node_modules/tslib/tslib.js +1 -56
  89. package/package.json +4 -5
  90. package/webpack.config.js +99 -109
  91. package/.nvmrc +0 -1
  92. package/dist/main.css +0 -4
  93. package/dist/main.js +0 -2
  94. package/dist/styles.css +0 -1
  95. package/dist/styles.js +0 -0
  96. package/node_modules/@types/react/compiler-runtime.d.ts +0 -4
  97. package/node_modules/@types/react/ts5.0/v18/global.d.ts +0 -160
  98. package/node_modules/@types/react/ts5.0/v18/index.d.ts +0 -4543
  99. package/node_modules/@types/react/ts5.0/v18/jsx-dev-runtime.d.ts +0 -45
  100. package/node_modules/@types/react/ts5.0/v18/jsx-runtime.d.ts +0 -36
  101. package/node_modules/@types/react/ts5.0/v18/ts5.0/global.d.ts +0 -160
  102. package/node_modules/@types/react/ts5.0/v18/ts5.0/index.d.ts +0 -4530
  103. package/node_modules/@types/react/ts5.0/v18/ts5.0/jsx-dev-runtime.d.ts +0 -44
  104. package/node_modules/@types/react/ts5.0/v18/ts5.0/jsx-runtime.d.ts +0 -35
  105. package/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +0 -21
  106. package/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +0 -65
  107. package/node_modules/typescript/lib/lib.es2024.collection.d.ts +0 -29
  108. package/node_modules/typescript/lib/lib.es2024.d.ts +0 -26
  109. package/node_modules/typescript/lib/lib.es2024.full.d.ts +0 -24
  110. package/node_modules/typescript/lib/tsc.js +0 -8
  111. package/node_modules/typescript/lib/tsserver.js +0 -8
  112. package/node_modules/typescript/lib/typingsInstaller.js +0 -8
  113. /package/dist/styles/{form.scss → _form.scss} +0 -0
  114. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/LICENSE.txt +0 -0
  115. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/README.md +0 -0
  116. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/SECURITY.md +0 -0
  117. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/ThirdPartyNoticeText.txt +0 -0
  118. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/bin/tsc +0 -0
  119. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/bin/tsserver +0 -0
  120. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/cancellationToken.js +0 -0
  121. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.d.ts +0 -0
  122. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.decorators.legacy.d.ts +0 -0
  123. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.dom.asynciterable.d.ts +0 -0
  124. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.dom.iterable.d.ts +0 -0
  125. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2015.collection.d.ts +0 -0
  126. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2015.d.ts +0 -0
  127. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2015.generator.d.ts +0 -0
  128. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2015.promise.d.ts +0 -0
  129. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2015.proxy.d.ts +0 -0
  130. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2015.reflect.d.ts +0 -0
  131. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2015.symbol.d.ts +0 -0
  132. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2016.d.ts +0 -0
  133. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2016.full.d.ts +0 -0
  134. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2017.date.d.ts +0 -0
  135. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2017.full.d.ts +0 -0
  136. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2017.intl.d.ts +0 -0
  137. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2017.object.d.ts +0 -0
  138. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2017.string.d.ts +0 -0
  139. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2018.asyncgenerator.d.ts +0 -0
  140. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2018.asynciterable.d.ts +0 -0
  141. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2018.d.ts +0 -0
  142. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2018.full.d.ts +0 -0
  143. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2018.intl.d.ts +0 -0
  144. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2018.promise.d.ts +0 -0
  145. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2018.regexp.d.ts +0 -0
  146. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2019.array.d.ts +0 -0
  147. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2019.d.ts +0 -0
  148. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2019.full.d.ts +0 -0
  149. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2019.intl.d.ts +0 -0
  150. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2019.object.d.ts +0 -0
  151. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2019.string.d.ts +0 -0
  152. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2019.symbol.d.ts +0 -0
  153. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2020.d.ts +0 -0
  154. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2020.date.d.ts +0 -0
  155. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2020.full.d.ts +0 -0
  156. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2020.number.d.ts +0 -0
  157. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2020.promise.d.ts +0 -0
  158. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2020.symbol.wellknown.d.ts +0 -0
  159. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2021.d.ts +0 -0
  160. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2021.full.d.ts +0 -0
  161. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2021.promise.d.ts +0 -0
  162. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2021.string.d.ts +0 -0
  163. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2022.full.d.ts +0 -0
  164. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2022.object.d.ts +0 -0
  165. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2022.regexp.d.ts +0 -0
  166. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2022.string.d.ts +0 -0
  167. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2023.collection.d.ts +0 -0
  168. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2023.d.ts +0 -0
  169. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2023.full.d.ts +0 -0
  170. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es2023.intl.d.ts +0 -0
  171. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.es6.d.ts +0 -0
  172. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.esnext.decorators.d.ts +0 -0
  173. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.esnext.disposable.d.ts +0 -0
  174. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.esnext.full.d.ts +0 -0
  175. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.esnext.intl.d.ts +0 -0
  176. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.esnext.iterator.d.ts +0 -0
  177. /package/node_modules/{typescript/lib/lib.es2024.object.d.ts → @pinuts/form-builder/node_modules/typescript/lib/lib.esnext.object.d.ts} +0 -0
  178. /package/node_modules/{typescript/lib/lib.es2024.promise.d.ts → @pinuts/form-builder/node_modules/typescript/lib/lib.esnext.promise.d.ts} +0 -0
  179. /package/node_modules/{typescript/lib/lib.es2024.regexp.d.ts → @pinuts/form-builder/node_modules/typescript/lib/lib.esnext.regexp.d.ts} +0 -0
  180. /package/node_modules/{typescript/lib/lib.es2024.string.d.ts → @pinuts/form-builder/node_modules/typescript/lib/lib.esnext.string.d.ts} +0 -0
  181. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.scripthost.d.ts +0 -0
  182. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.webworker.asynciterable.d.ts +0 -0
  183. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.webworker.importscripts.d.ts +0 -0
  184. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/lib.webworker.iterable.d.ts +0 -0
  185. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/tsserverlibrary.d.ts +0 -0
  186. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/tsserverlibrary.js +0 -0
  187. /package/node_modules/{typescript → @pinuts/form-builder/node_modules/typescript}/lib/watchGuard.js +0 -0
  188. /package/node_modules/{@babel/runtime/node_modules/regenerator-runtime → regenerator-runtime}/LICENSE +0 -0
  189. /package/node_modules/{@babel/runtime/node_modules/regenerator-runtime → regenerator-runtime}/README.md +0 -0
  190. /package/node_modules/{@babel/runtime/node_modules/regenerator-runtime → regenerator-runtime}/package.json +0 -0
  191. /package/node_modules/{@babel/runtime/node_modules/regenerator-runtime → regenerator-runtime}/path.js +0 -0
  192. /package/node_modules/{@babel/runtime/node_modules/regenerator-runtime → regenerator-runtime}/runtime.js +0 -0
@@ -5,6 +5,7 @@
5
5
  /// <reference path="global.d.ts" />
6
6
 
7
7
  import * as CSS from "csstype";
8
+ import * as PropTypes from "prop-types";
8
9
 
9
10
  type NativeAnimationEvent = AnimationEvent;
10
11
  type NativeClipboardEvent = ClipboardEvent;
@@ -15,7 +16,6 @@ type NativeKeyboardEvent = KeyboardEvent;
15
16
  type NativeMouseEvent = MouseEvent;
16
17
  type NativeTouchEvent = TouchEvent;
17
18
  type NativePointerEvent = PointerEvent;
18
- type NativeToggleEvent = ToggleEvent;
19
19
  type NativeTransitionEvent = TransitionEvent;
20
20
  type NativeUIEvent = UIEvent;
21
21
  type NativeWheelEvent = WheelEvent;
@@ -33,25 +33,6 @@ type CrossOrigin = "anonymous" | "use-credentials" | "" | undefined;
33
33
 
34
34
  declare const UNDEFINED_VOID_ONLY: unique symbol;
35
35
 
36
- /**
37
- * @internal Use `Awaited<ReactNode>` instead
38
- */
39
- // Helper type to enable `Awaited<ReactNode>`.
40
- // Must be a copy of the non-thenables of `ReactNode`.
41
- type AwaitedReactNode =
42
- | React.ReactElement
43
- | string
44
- | number
45
- | bigint
46
- | Iterable<React.ReactNode>
47
- | React.ReactPortal
48
- | boolean
49
- | null
50
- | undefined
51
- | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES[
52
- keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES
53
- ];
54
-
55
36
  /**
56
37
  * The function returned from an effect passed to {@link React.useEffect useEffect},
57
38
  * which can be used to clean up the effect when the component unmounts.
@@ -112,7 +93,8 @@ declare namespace React {
112
93
  * Represents any user-defined component, either as a function or a class.
113
94
  *
114
95
  * Similar to {@link JSXElementConstructor}, but with extra properties like
115
- * {@link FunctionComponent.defaultProps defaultProps }.
96
+ * {@link FunctionComponent.defaultProps defaultProps } and
97
+ * {@link ComponentClass.contextTypes contextTypes}.
116
98
  *
117
99
  * @template P The props the component accepts.
118
100
  *
@@ -125,18 +107,34 @@ declare namespace React {
125
107
  * Represents any user-defined component, either as a function or a class.
126
108
  *
127
109
  * Similar to {@link ComponentType}, but without extra properties like
128
- * {@link FunctionComponent.defaultProps defaultProps }.
110
+ * {@link FunctionComponent.defaultProps defaultProps } and
111
+ * {@link ComponentClass.contextTypes contextTypes}.
129
112
  *
130
113
  * @template P The props the component accepts.
131
114
  */
132
115
  type JSXElementConstructor<P> =
133
116
  | ((
134
117
  props: P,
135
- ) => ReactNode | Promise<ReactNode>)
136
- // constructor signature must match React.Component
137
- | (new(props: P) => Component<any, any>);
118
+ /**
119
+ * @deprecated
120
+ *
121
+ * @see {@link https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-stateless-function-components React Docs}
122
+ */
123
+ deprecatedLegacyContext?: any,
124
+ ) => ReactNode)
125
+ | (new(
126
+ props: P,
127
+ /**
128
+ * @deprecated
129
+ *
130
+ * @see {@link https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods React Docs}
131
+ */
132
+ deprecatedLegacyContext?: any,
133
+ ) => Component<any, any>);
138
134
 
139
135
  /**
136
+ * A readonly ref container where {@link current} cannot be mutated.
137
+ *
140
138
  * Created by {@link createRef}, or {@link useRef} when passed `null`.
141
139
  *
142
140
  * @template T The type of the ref's value.
@@ -153,7 +151,7 @@ declare namespace React {
153
151
  /**
154
152
  * The current value of the ref.
155
153
  */
156
- current: T;
154
+ readonly current: T | null;
157
155
  }
158
156
 
159
157
  interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES {
@@ -176,7 +174,6 @@ declare namespace React {
176
174
  instance: T | null,
177
175
  ):
178
176
  | void
179
- | (() => VoidOrUndefinedOnly)
180
177
  | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[
181
178
  keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES
182
179
  ];
@@ -189,15 +186,22 @@ declare namespace React {
189
186
  * @see {@link RefObject}
190
187
  */
191
188
 
192
- type Ref<T> = RefCallback<T> | RefObject<T | null> | null;
189
+ type Ref<T> = RefCallback<T> | RefObject<T> | null;
193
190
  /**
194
- * @deprecated Use `Ref` instead. String refs are no longer supported.
195
- * If you're typing a library with support for React versions with string refs, use `RefAttributes<T>['ref']` instead.
191
+ * A legacy implementation of refs where you can pass a string to a ref prop.
192
+ *
193
+ * @see {@link https://react.dev/reference/react/Component#refs React Docs}
194
+ *
195
+ * @example
196
+ *
197
+ * ```tsx
198
+ * <div ref="myRef" />
199
+ * ```
196
200
  */
197
- type LegacyRef<T> = Ref<T>;
201
+ // TODO: Remove the string ref special case from `PropsWithRef` once we remove LegacyRef
202
+ type LegacyRef<T> = string | Ref<T>;
203
+
198
204
  /**
199
- * @deprecated Use `ComponentRef<T>` instead
200
- *
201
205
  * Retrieves the type of the 'ref' prop for a given component type or tag name.
202
206
  *
203
207
  * @template C The component type.
@@ -218,9 +222,17 @@ declare namespace React {
218
222
  C extends
219
223
  | ForwardRefExoticComponent<any>
220
224
  | { new(props: any): Component<any> }
221
- | ((props: any) => ReactNode)
225
+ | ((props: any, deprecatedLegacyContext?: any) => ReactNode)
222
226
  | keyof JSX.IntrinsicElements,
223
- > = ComponentRef<C>;
227
+ > =
228
+ // need to check first if `ref` is a valid prop for ts@3.0
229
+ // otherwise it will infer `{}` instead of `never`
230
+ "ref" extends keyof ComponentPropsWithRef<C>
231
+ ? NonNullable<ComponentPropsWithRef<C>["ref"]> extends RefAttributes<
232
+ infer Instance
233
+ >["ref"] ? Instance
234
+ : never
235
+ : never;
224
236
 
225
237
  type ComponentState = any;
226
238
 
@@ -288,7 +300,7 @@ declare namespace React {
288
300
  *
289
301
  * @see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}
290
302
  */
291
- ref?: Ref<T> | undefined;
303
+ ref?: LegacyRef<T> | undefined;
292
304
  }
293
305
 
294
306
  /**
@@ -313,7 +325,7 @@ declare namespace React {
313
325
  * ```
314
326
  */
315
327
  interface ReactElement<
316
- P = unknown,
328
+ P = any,
317
329
  T extends string | JSXElementConstructor<any> = string | JSXElementConstructor<any>,
318
330
  > {
319
331
  type: T;
@@ -329,28 +341,13 @@ declare namespace React {
329
341
  P = Pick<ComponentProps<T>, Exclude<keyof ComponentProps<T>, "key" | "ref">>,
330
342
  > extends ReactElement<P, Exclude<T, number>> {}
331
343
 
332
- /**
333
- * @deprecated Use `ReactElement<P, React.FunctionComponent<P>>`
334
- */
335
344
  interface FunctionComponentElement<P> extends ReactElement<P, FunctionComponent<P>> {
336
- /**
337
- * @deprecated Use `element.props.ref` instead.
338
- */
339
345
  ref?: ("ref" extends keyof P ? P extends { ref?: infer R | undefined } ? R : never : never) | undefined;
340
346
  }
341
347
 
342
- /**
343
- * @deprecated Use `ReactElement<P, React.ComponentClass<P>>`
344
- */
345
348
  type CElement<P, T extends Component<P, ComponentState>> = ComponentElement<P, T>;
346
- /**
347
- * @deprecated Use `ReactElement<P, React.ComponentClass<P>>`
348
- */
349
349
  interface ComponentElement<P, T extends Component<P, ComponentState>> extends ReactElement<P, ComponentClass<P>> {
350
- /**
351
- * @deprecated Use `element.props.ref` instead.
352
- */
353
- ref?: Ref<T> | undefined;
350
+ ref?: LegacyRef<T> | undefined;
354
351
  }
355
352
 
356
353
  /**
@@ -359,34 +356,89 @@ declare namespace React {
359
356
  type ClassicElement<P> = CElement<P, ClassicComponent<P, ComponentState>>;
360
357
 
361
358
  // string fallback for custom web-components
362
- /**
363
- * @deprecated Use `ReactElement<P, string>`
364
- */
365
359
  interface DOMElement<P extends HTMLAttributes<T> | SVGAttributes<T>, T extends Element>
366
360
  extends ReactElement<P, string>
367
361
  {
368
- /**
369
- * @deprecated Use `element.props.ref` instead.
370
- */
371
- ref: Ref<T>;
362
+ ref: LegacyRef<T>;
372
363
  }
373
364
 
374
365
  // ReactHTML for ReactHTMLElement
375
366
  interface ReactHTMLElement<T extends HTMLElement> extends DetailedReactHTMLElement<AllHTMLAttributes<T>, T> {}
376
367
 
377
368
  interface DetailedReactHTMLElement<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMElement<P, T> {
378
- type: HTMLElementType;
369
+ type: keyof ReactHTML;
379
370
  }
380
371
 
381
372
  // ReactSVG for ReactSVGElement
382
373
  interface ReactSVGElement extends DOMElement<SVGAttributes<SVGElement>, SVGElement> {
383
- type: SVGElementType;
374
+ type: keyof ReactSVG;
384
375
  }
385
376
 
386
377
  interface ReactPortal extends ReactElement {
387
378
  children: ReactNode;
388
379
  }
389
380
 
381
+ //
382
+ // Factories
383
+ // ----------------------------------------------------------------------
384
+
385
+ type Factory<P> = (props?: Attributes & P, ...children: ReactNode[]) => ReactElement<P>;
386
+
387
+ /**
388
+ * @deprecated Please use `FunctionComponentFactory`
389
+ */
390
+ type SFCFactory<P> = FunctionComponentFactory<P>;
391
+
392
+ type FunctionComponentFactory<P> = (
393
+ props?: Attributes & P,
394
+ ...children: ReactNode[]
395
+ ) => FunctionComponentElement<P>;
396
+
397
+ type ComponentFactory<P, T extends Component<P, ComponentState>> = (
398
+ props?: ClassAttributes<T> & P,
399
+ ...children: ReactNode[]
400
+ ) => CElement<P, T>;
401
+
402
+ type CFactory<P, T extends Component<P, ComponentState>> = ComponentFactory<P, T>;
403
+ type ClassicFactory<P> = CFactory<P, ClassicComponent<P, ComponentState>>;
404
+
405
+ type DOMFactory<P extends DOMAttributes<T>, T extends Element> = (
406
+ props?: ClassAttributes<T> & P | null,
407
+ ...children: ReactNode[]
408
+ ) => DOMElement<P, T>;
409
+
410
+ interface HTMLFactory<T extends HTMLElement> extends DetailedHTMLFactory<AllHTMLAttributes<T>, T> {}
411
+
412
+ interface DetailedHTMLFactory<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMFactory<P, T> {
413
+ (props?: ClassAttributes<T> & P | null, ...children: ReactNode[]): DetailedReactHTMLElement<P, T>;
414
+ }
415
+
416
+ interface SVGFactory extends DOMFactory<SVGAttributes<SVGElement>, SVGElement> {
417
+ (
418
+ props?: ClassAttributes<SVGElement> & SVGAttributes<SVGElement> | null,
419
+ ...children: ReactNode[]
420
+ ): ReactSVGElement;
421
+ }
422
+
423
+ /**
424
+ * @deprecated - This type is not relevant when using React. Inline the type instead to make the intent clear.
425
+ */
426
+ type ReactText = string | number;
427
+ /**
428
+ * @deprecated - This type is not relevant when using React. Inline the type instead to make the intent clear.
429
+ */
430
+ type ReactChild = ReactElement | string | number;
431
+
432
+ /**
433
+ * @deprecated Use either `ReactNode[]` if you need an array or `Iterable<ReactNode>` if its passed to a host component.
434
+ */
435
+ interface ReactNodeArray extends ReadonlyArray<ReactNode> {}
436
+ /**
437
+ * WARNING: Not related to `React.Fragment`.
438
+ * @deprecated This type is not relevant when using React. Inline the type instead to make the intent clear.
439
+ */
440
+ type ReactFragment = Iterable<ReactNode>;
441
+
390
442
  /**
391
443
  * Different release channels declare additional types of ReactNode this particular release channel accepts.
392
444
  * App or library types should never augment this interface.
@@ -427,7 +479,6 @@ declare namespace React {
427
479
  | ReactElement
428
480
  | string
429
481
  | number
430
- | bigint
431
482
  | Iterable<ReactNode>
432
483
  | ReactPortal
433
484
  | boolean
@@ -435,13 +486,36 @@ declare namespace React {
435
486
  | undefined
436
487
  | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES[
437
488
  keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES
438
- ]
439
- | Promise<AwaitedReactNode>;
489
+ ];
440
490
 
441
491
  //
442
492
  // Top Level API
443
493
  // ----------------------------------------------------------------------
444
494
 
495
+ // DOM Elements
496
+ /** @deprecated */
497
+ function createFactory<T extends HTMLElement>(
498
+ type: keyof ReactHTML,
499
+ ): HTMLFactory<T>;
500
+ /** @deprecated */
501
+ function createFactory(
502
+ type: keyof ReactSVG,
503
+ ): SVGFactory;
504
+ /** @deprecated */
505
+ function createFactory<P extends DOMAttributes<T>, T extends Element>(
506
+ type: string,
507
+ ): DOMFactory<P, T>;
508
+
509
+ // Custom components
510
+ /** @deprecated */
511
+ function createFactory<P>(type: FunctionComponent<P>): FunctionComponentFactory<P>;
512
+ /** @deprecated */
513
+ function createFactory<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>>(
514
+ type: ClassType<P, T, C>,
515
+ ): CFactory<P, T>;
516
+ /** @deprecated */
517
+ function createFactory<P>(type: ComponentClass<P>): Factory<P>;
518
+
445
519
  // DOM Elements
446
520
  // TODO: generalize this to everything in `keyof ReactHTML`, not just "input"
447
521
  function createElement(
@@ -450,12 +524,12 @@ declare namespace React {
450
524
  ...children: ReactNode[]
451
525
  ): DetailedReactHTMLElement<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
452
526
  function createElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
453
- type: HTMLElementType,
527
+ type: keyof ReactHTML,
454
528
  props?: ClassAttributes<T> & P | null,
455
529
  ...children: ReactNode[]
456
530
  ): DetailedReactHTMLElement<P, T>;
457
531
  function createElement<P extends SVGAttributes<T>, T extends SVGElement>(
458
- type: SVGElementType,
532
+ type: keyof ReactSVG,
459
533
  props?: ClassAttributes<T> & P | null,
460
534
  ...children: ReactNode[]
461
535
  ): ReactSVGElement;
@@ -584,6 +658,7 @@ declare namespace React {
584
658
  * @template P The props the component accepts.
585
659
  */
586
660
  interface ProviderExoticComponent<P> extends ExoticComponent<P> {
661
+ propTypes?: WeakValidationMap<P> | undefined;
587
662
  }
588
663
 
589
664
  /**
@@ -665,7 +740,7 @@ declare namespace React {
665
740
  * const ThemeContext = createContext('light');
666
741
  * ```
667
742
  */
668
- interface Context<T> extends Provider<T> {
743
+ interface Context<T> {
669
744
  Provider: Provider<T>;
670
745
  Consumer: Consumer<T>;
671
746
  /**
@@ -694,13 +769,6 @@ declare namespace React {
694
769
  * import { createContext } from 'react';
695
770
  *
696
771
  * const ThemeContext = createContext('light');
697
- * function App() {
698
- * return (
699
- * <ThemeContext value="dark">
700
- * <Toolbar />
701
- * </ThemeContext>
702
- * );
703
- * }
704
772
  * ```
705
773
  */
706
774
  function createContext<T>(
@@ -711,6 +779,9 @@ declare namespace React {
711
779
 
712
780
  function isValidElement<P>(object: {} | null | undefined): object is ReactElement<P>;
713
781
 
782
+ /**
783
+ * Maintainer's note: Sync with {@link ReactChildren} until {@link ReactChildren} is removed.
784
+ */
714
785
  const Children: {
715
786
  map<T, C>(
716
787
  children: C | readonly C[],
@@ -916,12 +987,6 @@ declare namespace React {
916
987
  */
917
988
  static contextType?: Context<any> | undefined;
918
989
 
919
- /**
920
- * Ignored by React.
921
- * @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release.
922
- */
923
- static propTypes?: any;
924
-
925
990
  /**
926
991
  * If using the new style context, re-declare this in your class to be the
927
992
  * `React.ContextType` of your `static contextType`.
@@ -940,8 +1005,12 @@ declare namespace React {
940
1005
  */
941
1006
  context: unknown;
942
1007
 
943
- // Keep in sync with constructor signature of JSXElementConstructor and ComponentClass.
944
1008
  constructor(props: P);
1009
+ /**
1010
+ * @deprecated
1011
+ * @see {@link https://legacy.reactjs.org/docs/legacy-context.html React Docs}
1012
+ */
1013
+ constructor(props: P, context: any);
945
1014
 
946
1015
  // We MUST keep setState() as a unified signature because it allows proper checking of the method return type.
947
1016
  // See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257
@@ -956,6 +1025,14 @@ declare namespace React {
956
1025
 
957
1026
  readonly props: Readonly<P>;
958
1027
  state: Readonly<S>;
1028
+ /**
1029
+ * @deprecated
1030
+ *
1031
+ * @see {@link https://legacy.reactjs.org/docs/refs-and-the-dom.html#legacy-api-string-refs Legacy React Docs}
1032
+ */
1033
+ refs: {
1034
+ [key: string]: ReactInstance;
1035
+ };
959
1036
  }
960
1037
 
961
1038
  class PureComponent<P = {}, S = {}, SS = any> extends Component<P, S, SS> {}
@@ -972,6 +1049,10 @@ declare namespace React {
972
1049
  getInitialState?(): S;
973
1050
  }
974
1051
 
1052
+ interface ChildContextProvider<CC> {
1053
+ getChildContext(): CC;
1054
+ }
1055
+
975
1056
  //
976
1057
  // Class Interfaces
977
1058
  // ----------------------------------------------------------------------
@@ -1036,12 +1117,58 @@ declare namespace React {
1036
1117
  * ```
1037
1118
  */
1038
1119
  interface FunctionComponent<P = {}> {
1039
- (props: P): ReactNode | Promise<ReactNode>;
1120
+ (
1121
+ props: P,
1122
+ /**
1123
+ * @deprecated
1124
+ *
1125
+ * @see {@link https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods React Docs}
1126
+ */
1127
+ deprecatedLegacyContext?: any,
1128
+ ): ReactNode;
1129
+ /**
1130
+ * Used to declare the types of the props accepted by the
1131
+ * component. These types will be checked during rendering
1132
+ * and in development only.
1133
+ *
1134
+ * We recommend using TypeScript instead of checking prop
1135
+ * types at runtime.
1136
+ *
1137
+ * @see {@link https://react.dev/reference/react/Component#static-proptypes React Docs}
1138
+ */
1139
+ propTypes?: WeakValidationMap<P> | undefined;
1040
1140
  /**
1041
- * Ignored by React.
1042
- * @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release.
1141
+ * @deprecated
1142
+ *
1143
+ * Lets you specify which legacy context is consumed by
1144
+ * this component.
1145
+ *
1146
+ * @see {@link https://legacy.reactjs.org/docs/legacy-context.html Legacy React Docs}
1043
1147
  */
1044
- propTypes?: any;
1148
+ contextTypes?: ValidationMap<any> | undefined;
1149
+ /**
1150
+ * Used to define default values for the props accepted by
1151
+ * the component.
1152
+ *
1153
+ * @see {@link https://react.dev/reference/react/Component#static-defaultprops React Docs}
1154
+ *
1155
+ * @example
1156
+ *
1157
+ * ```tsx
1158
+ * type Props = { name?: string }
1159
+ *
1160
+ * const MyComponent: FC<Props> = (props) => {
1161
+ * return <div>{props.name}</div>
1162
+ * }
1163
+ *
1164
+ * MyComponent.defaultProps = {
1165
+ * name: 'John Doe'
1166
+ * }
1167
+ * ```
1168
+ *
1169
+ * @deprecated Use {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#default_value|default values for destructuring assignments instead}.
1170
+ */
1171
+ defaultProps?: Partial<P> | undefined;
1045
1172
  /**
1046
1173
  * Used in debugging messages. You might want to set it
1047
1174
  * explicitly if you want to display a different name for
@@ -1063,14 +1190,44 @@ declare namespace React {
1063
1190
  displayName?: string | undefined;
1064
1191
  }
1065
1192
 
1193
+ /**
1194
+ * @deprecated - Equivalent to {@link React.FunctionComponent}.
1195
+ *
1196
+ * @see {@link React.FunctionComponent}
1197
+ * @alias {@link VoidFunctionComponent}
1198
+ */
1199
+ type VFC<P = {}> = VoidFunctionComponent<P>;
1200
+
1201
+ /**
1202
+ * @deprecated - Equivalent to {@link React.FunctionComponent}.
1203
+ *
1204
+ * @see {@link React.FunctionComponent}
1205
+ */
1206
+ interface VoidFunctionComponent<P = {}> {
1207
+ (
1208
+ props: P,
1209
+ /**
1210
+ * @deprecated
1211
+ *
1212
+ * @see {@link https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods React Docs}
1213
+ */
1214
+ deprecatedLegacyContext?: any,
1215
+ ): ReactNode;
1216
+ propTypes?: WeakValidationMap<P> | undefined;
1217
+ contextTypes?: ValidationMap<any> | undefined;
1218
+ /**
1219
+ * @deprecated Use {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#default_value|default values for destructuring assignments instead}.
1220
+ */
1221
+ defaultProps?: Partial<P> | undefined;
1222
+ displayName?: string | undefined;
1223
+ }
1224
+
1066
1225
  /**
1067
1226
  * The type of the ref received by a {@link ForwardRefRenderFunction}.
1068
1227
  *
1069
1228
  * @see {@link ForwardRefRenderFunction}
1070
1229
  */
1071
- // Making T nullable is assuming the refs will be managed by React or the component impl will write it somewhere else.
1072
- // But this isn't necessarily true. We haven't heard complains about it yet and hopefully `forwardRef` is removed from React before we do.
1073
- type ForwardedRef<T> = ((instance: T | null) => void) | RefObject<T | null> | null;
1230
+ type ForwardedRef<T> = ((instance: T | null) => void) | MutableRefObject<T | null> | null;
1074
1231
 
1075
1232
  /**
1076
1233
  * The type of the function passed to {@link forwardRef}. This is considered different
@@ -1099,10 +1256,19 @@ declare namespace React {
1099
1256
  */
1100
1257
  displayName?: string | undefined;
1101
1258
  /**
1102
- * Ignored by React.
1103
- * @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release.
1259
+ * defaultProps are not supported on render functions passed to forwardRef.
1260
+ *
1261
+ * @see {@link https://github.com/microsoft/TypeScript/issues/36826 linked GitHub issue} for context
1262
+ * @see {@link https://react.dev/reference/react/Component#static-defaultprops React Docs}
1104
1263
  */
1105
- propTypes?: any;
1264
+ defaultProps?: never | undefined;
1265
+ /**
1266
+ * propTypes are not supported on render functions passed to forwardRef.
1267
+ *
1268
+ * @see {@link https://github.com/microsoft/TypeScript/issues/36826 linked GitHub issue} for context
1269
+ * @see {@link https://react.dev/reference/react/Component#static-proptypes React Docs}
1270
+ */
1271
+ propTypes?: never | undefined;
1106
1272
  }
1107
1273
 
1108
1274
  /**
@@ -1112,14 +1278,48 @@ declare namespace React {
1112
1278
  * @template S The internal state of the component.
1113
1279
  */
1114
1280
  interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
1115
- // constructor signature must match React.Component
1116
- new(props: P): Component<P, S>;
1281
+ new(
1282
+ props: P,
1283
+ /**
1284
+ * @deprecated
1285
+ *
1286
+ * @see {@link https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods React Docs}
1287
+ */
1288
+ deprecatedLegacyContext?: any,
1289
+ ): Component<P, S>;
1117
1290
  /**
1118
- * Ignored by React.
1119
- * @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release.
1291
+ * Used to declare the types of the props accepted by the
1292
+ * component. These types will be checked during rendering
1293
+ * and in development only.
1294
+ *
1295
+ * We recommend using TypeScript instead of checking prop
1296
+ * types at runtime.
1297
+ *
1298
+ * @see {@link https://react.dev/reference/react/Component#static-proptypes React Docs}
1120
1299
  */
1121
- propTypes?: any;
1300
+ propTypes?: WeakValidationMap<P> | undefined;
1122
1301
  contextType?: Context<any> | undefined;
1302
+ /**
1303
+ * @deprecated use {@link ComponentClass.contextType} instead
1304
+ *
1305
+ * Lets you specify which legacy context is consumed by
1306
+ * this component.
1307
+ *
1308
+ * @see {@link https://legacy.reactjs.org/docs/legacy-context.html Legacy React Docs}
1309
+ */
1310
+ contextTypes?: ValidationMap<any> | undefined;
1311
+ /**
1312
+ * @deprecated
1313
+ *
1314
+ * @see {@link https://legacy.reactjs.org/docs/legacy-context.html#how-to-use-context Legacy React Docs}
1315
+ */
1316
+ childContextTypes?: ValidationMap<any> | undefined;
1317
+ /**
1318
+ * Used to define default values for the props accepted by
1319
+ * the component.
1320
+ *
1321
+ * @see {@link https://react.dev/reference/react/Component#static-defaultprops React Docs}
1322
+ */
1123
1323
  defaultProps?: Partial<P> | undefined;
1124
1324
  /**
1125
1325
  * Used in debugging messages. You might want to set it
@@ -1138,7 +1338,7 @@ declare namespace React {
1138
1338
  * @see {@link https://www.npmjs.com/package/create-react-class `create-react-class` on npm}
1139
1339
  */
1140
1340
  interface ClassicComponentClass<P = {}> extends ComponentClass<P> {
1141
- new(props: P): ClassicComponent<P, ComponentState>;
1341
+ new(props: P, deprecatedLegacyContext?: any): ClassicComponent<P, ComponentState>;
1142
1342
  getDefaultProps?(): P;
1143
1343
  }
1144
1344
 
@@ -1153,7 +1353,7 @@ declare namespace React {
1153
1353
  */
1154
1354
  type ClassType<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>> =
1155
1355
  & C
1156
- & (new(props: P) => T);
1356
+ & (new(props: P, deprecatedLegacyContext?: any) => T);
1157
1357
 
1158
1358
  //
1159
1359
  // Component Specs and Lifecycle
@@ -1177,7 +1377,7 @@ declare namespace React {
1177
1377
  * If false is returned, {@link Component.render}, `componentWillUpdate`
1178
1378
  * and `componentDidUpdate` will not be called.
1179
1379
  */
1180
- shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>): boolean;
1380
+ shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): boolean;
1181
1381
  /**
1182
1382
  * Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as
1183
1383
  * cancelled network requests, or cleaning up any DOM elements created in `componentDidMount`.
@@ -1276,7 +1476,7 @@ declare namespace React {
1276
1476
  * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props}
1277
1477
  * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
1278
1478
  */
1279
- componentWillReceiveProps?(nextProps: Readonly<P>): void;
1479
+ componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
1280
1480
  /**
1281
1481
  * Called when the component may be receiving new props.
1282
1482
  * React may call this even if props have not changed, so be sure to compare new and existing
@@ -1294,7 +1494,7 @@ declare namespace React {
1294
1494
  * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props}
1295
1495
  * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
1296
1496
  */
1297
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P>): void;
1497
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
1298
1498
  /**
1299
1499
  * Called immediately before rendering when new props or state is received. Not called for the initial render.
1300
1500
  *
@@ -1308,7 +1508,7 @@ declare namespace React {
1308
1508
  * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update}
1309
1509
  * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
1310
1510
  */
1311
- componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>): void;
1511
+ componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void;
1312
1512
  /**
1313
1513
  * Called immediately before rendering when new props or state is received. Not called for the initial render.
1314
1514
  *
@@ -1324,10 +1524,41 @@ declare namespace React {
1324
1524
  * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update}
1325
1525
  * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
1326
1526
  */
1327
- UNSAFE_componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>): void;
1527
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void;
1528
+ }
1529
+
1530
+ /**
1531
+ * @deprecated
1532
+ *
1533
+ * @see {@link https://legacy.reactjs.org/blog/2016/07/13/mixins-considered-harmful.html Mixins Considered Harmful}
1534
+ */
1535
+ interface Mixin<P, S> extends ComponentLifecycle<P, S> {
1536
+ mixins?: Array<Mixin<P, S>> | undefined;
1537
+ statics?: {
1538
+ [key: string]: any;
1539
+ } | undefined;
1540
+
1541
+ displayName?: string | undefined;
1542
+ propTypes?: ValidationMap<any> | undefined;
1543
+ contextTypes?: ValidationMap<any> | undefined;
1544
+ childContextTypes?: ValidationMap<any> | undefined;
1545
+
1546
+ getDefaultProps?(): P;
1547
+ getInitialState?(): S;
1328
1548
  }
1329
1549
 
1330
- function createRef<T>(): RefObject<T | null>;
1550
+ /**
1551
+ * @deprecated
1552
+ *
1553
+ * @see {@link https://legacy.reactjs.org/blog/2016/07/13/mixins-considered-harmful.html Mixins Considered Harmful}
1554
+ */
1555
+ interface ComponentSpec<P, S> extends Mixin<P, S> {
1556
+ render(): ReactNode;
1557
+
1558
+ [propertyName: string]: any;
1559
+ }
1560
+
1561
+ function createRef<T>(): RefObject<T>;
1331
1562
 
1332
1563
  /**
1333
1564
  * The type of the component returned from {@link forwardRef}.
@@ -1338,10 +1569,10 @@ declare namespace React {
1338
1569
  */
1339
1570
  interface ForwardRefExoticComponent<P> extends NamedExoticComponent<P> {
1340
1571
  /**
1341
- * Ignored by React.
1342
- * @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release.
1572
+ * @deprecated Use {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#default_value|default values for destructuring assignments instead}.
1343
1573
  */
1344
- propTypes?: any;
1574
+ defaultProps?: Partial<P> | undefined;
1575
+ propTypes?: WeakValidationMap<P> | undefined;
1345
1576
  }
1346
1577
 
1347
1578
  /**
@@ -1378,18 +1609,23 @@ declare namespace React {
1378
1609
  /**
1379
1610
  * Omits the 'ref' attribute from the given props object.
1380
1611
  *
1381
- * @template Props The props object type.
1612
+ * @template P The props object type.
1382
1613
  */
1383
- type PropsWithoutRef<Props> =
1614
+ type PropsWithoutRef<P> =
1384
1615
  // Omit would not be sufficient for this. We'd like to avoid unnecessary mapping and need a distributive conditional to support unions.
1385
1616
  // see: https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types
1386
1617
  // https://github.com/Microsoft/TypeScript/issues/28339
1387
- Props extends any ? ("ref" extends keyof Props ? Omit<Props, "ref"> : Props) : Props;
1388
- /**
1389
- * Ensures that the props do not include string ref, which cannot be forwarded
1390
- * @deprecated Use `Props` directly. `PropsWithRef<Props>` is just an alias for `Props`
1391
- */
1392
- type PropsWithRef<Props> = Props;
1618
+ P extends any ? ("ref" extends keyof P ? Omit<P, "ref"> : P) : P;
1619
+ /** Ensures that the props do not include string ref, which cannot be forwarded */
1620
+ type PropsWithRef<P> =
1621
+ // Note: String refs can be forwarded. We can't fix this bug without breaking a bunch of libraries now though.
1622
+ // Just "P extends { ref?: infer R }" looks sufficient, but R will infer as {} if P is {}.
1623
+ "ref" extends keyof P
1624
+ ? P extends { ref?: infer R | undefined }
1625
+ ? string extends R ? PropsWithoutRef<P> & { ref?: Exclude<R, string> | undefined }
1626
+ : P
1627
+ : P
1628
+ : P;
1393
1629
 
1394
1630
  type PropsWithChildren<P = unknown> = P & { children?: ReactNode | undefined };
1395
1631
 
@@ -1421,7 +1657,7 @@ declare namespace React {
1421
1657
  * ```
1422
1658
  */
1423
1659
  type ComponentProps<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = T extends
1424
- JSXElementConstructor<infer Props> ? Props
1660
+ JSXElementConstructor<infer P> ? P
1425
1661
  : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T]
1426
1662
  : {};
1427
1663
 
@@ -1448,11 +1684,9 @@ declare namespace React {
1448
1684
  * type MyComponentPropsWithRef = React.ComponentPropsWithRef<typeof MyComponent>;
1449
1685
  * ```
1450
1686
  */
1451
- type ComponentPropsWithRef<T extends ElementType> = T extends JSXElementConstructor<infer Props>
1452
- // If it's a class i.e. newable we're dealing with a class component
1453
- ? T extends abstract new(args: any) => any ? PropsWithoutRef<Props> & RefAttributes<InstanceType<T>>
1454
- : Props
1455
- : ComponentProps<T>;
1687
+ type ComponentPropsWithRef<T extends ElementType> = T extends (new(props: infer P) => Component<any, any>)
1688
+ ? PropsWithoutRef<P> & RefAttributes<InstanceType<T>>
1689
+ : PropsWithRef<ComponentProps<T>>;
1456
1690
  /**
1457
1691
  * Used to retrieve the props a custom component accepts with its ref.
1458
1692
  *
@@ -1469,10 +1703,9 @@ declare namespace React {
1469
1703
  * type MyComponentPropsWithRef = React.CustomComponentPropsWithRef<typeof MyComponent>;
1470
1704
  * ```
1471
1705
  */
1472
- type CustomComponentPropsWithRef<T extends ComponentType> = T extends JSXElementConstructor<infer Props>
1473
- // If it's a class i.e. newable we're dealing with a class component
1474
- ? T extends abstract new(args: any) => any ? PropsWithoutRef<Props> & RefAttributes<InstanceType<T>>
1475
- : Props
1706
+ type CustomComponentPropsWithRef<T extends ComponentType> = T extends (new(props: infer P) => Component<any, any>)
1707
+ ? (PropsWithoutRef<P> & RefAttributes<InstanceType<T>>)
1708
+ : T extends ((props: infer P, legacyContext?: any) => ReactNode) ? PropsWithRef<P>
1476
1709
  : never;
1477
1710
 
1478
1711
  /**
@@ -1500,24 +1733,10 @@ declare namespace React {
1500
1733
  */
1501
1734
  type ComponentPropsWithoutRef<T extends ElementType> = PropsWithoutRef<ComponentProps<T>>;
1502
1735
 
1503
- /**
1504
- * Retrieves the type of the 'ref' prop for a given component type or tag name.
1505
- *
1506
- * @template C The component type.
1507
- *
1508
- * @example
1509
- *
1510
- * ```tsx
1511
- * type MyComponentRef = React.ComponentRef<typeof MyComponent>;
1512
- * ```
1513
- *
1514
- * @example
1515
- *
1516
- * ```tsx
1517
- * type DivRef = React.ComponentRef<'div'>;
1518
- * ```
1519
- */
1520
- type ComponentRef<T extends ElementType> = ComponentPropsWithRef<T> extends RefAttributes<infer Method> ? Method
1736
+ type ComponentRef<T extends ElementType> = T extends NamedExoticComponent<
1737
+ ComponentPropsWithoutRef<T> & RefAttributes<infer Method>
1738
+ > ? Method
1739
+ : ComponentPropsWithRef<T> extends RefAttributes<infer Method> ? Method
1521
1740
  : never;
1522
1741
 
1523
1742
  // will show `Memo(${Component.displayName || Component.name})` in devtools by default,
@@ -1618,11 +1837,6 @@ declare namespace React {
1618
1837
  * A {@link Dispatch} function can sometimes be called without any arguments.
1619
1838
  */
1620
1839
  type DispatchWithoutAction = () => void;
1621
- // Limit the reducer to accept only 0 or 1 action arguments
1622
- // eslint-disable-next-line @definitelytyped/no-single-element-tuple-type
1623
- type AnyActionArg = [] | [any];
1624
- // Get the dispatch type from the reducer arguments (captures optional action argument correctly)
1625
- type ActionDispatch<ActionArg extends AnyActionArg> = (...args: ActionArg) => void;
1626
1840
  // Unlike redux, the actions _can_ be anything
1627
1841
  type Reducer<S, A> = (prevState: S, action: A) => S;
1628
1842
  // If useReducer accepts a reducer without action, dispatch may be called without any parameters.
@@ -1630,14 +1844,15 @@ declare namespace React {
1630
1844
  // types used to try and prevent the compiler from reducing S
1631
1845
  // to a supertype common with the second argument to useReducer()
1632
1846
  type ReducerState<R extends Reducer<any, any>> = R extends Reducer<infer S, any> ? S : never;
1847
+ type ReducerAction<R extends Reducer<any, any>> = R extends Reducer<any, infer A> ? A : never;
1848
+ // The identity check is done with the SameValue algorithm (Object.is), which is stricter than ===
1849
+ type ReducerStateWithoutAction<R extends ReducerWithoutAction<any>> = R extends ReducerWithoutAction<infer S> ? S
1850
+ : never;
1633
1851
  type DependencyList = readonly unknown[];
1634
1852
 
1635
1853
  // NOTE: callbacks are _only_ allowed to return either void, or a destructor.
1636
1854
  type EffectCallback = () => void | Destructor;
1637
1855
 
1638
- /**
1639
- * @deprecated Use `RefObject` instead.
1640
- */
1641
1856
  interface MutableRefObject<T> {
1642
1857
  current: T;
1643
1858
  }
@@ -1676,10 +1891,12 @@ declare namespace React {
1676
1891
  * @version 16.8.0
1677
1892
  * @see {@link https://react.dev/reference/react/useReducer}
1678
1893
  */
1679
- function useReducer<S, A extends AnyActionArg>(
1680
- reducer: (prevState: S, ...args: A) => S,
1681
- initialState: S,
1682
- ): [S, ActionDispatch<A>];
1894
+ // overload where dispatch could accept 0 arguments.
1895
+ function useReducer<R extends ReducerWithoutAction<any>, I>(
1896
+ reducer: R,
1897
+ initializerArg: I,
1898
+ initializer: (arg: I) => ReducerStateWithoutAction<R>,
1899
+ ): [ReducerStateWithoutAction<R>, DispatchWithoutAction];
1683
1900
  /**
1684
1901
  * An alternative to `useState`.
1685
1902
  *
@@ -1690,10 +1907,12 @@ declare namespace React {
1690
1907
  * @version 16.8.0
1691
1908
  * @see {@link https://react.dev/reference/react/useReducer}
1692
1909
  */
1693
- function useReducer<S, A extends AnyActionArg>(
1694
- reducer: (prevState: S, ...args: A) => S,
1695
- initialState: S,
1696
- ): [S, ActionDispatch<A>];
1910
+ // overload where dispatch could accept 0 arguments.
1911
+ function useReducer<R extends ReducerWithoutAction<any>>(
1912
+ reducer: R,
1913
+ initializerArg: ReducerStateWithoutAction<R>,
1914
+ initializer?: undefined,
1915
+ ): [ReducerStateWithoutAction<R>, DispatchWithoutAction];
1697
1916
  /**
1698
1917
  * An alternative to `useState`.
1699
1918
  *
@@ -1704,11 +1923,55 @@ declare namespace React {
1704
1923
  * @version 16.8.0
1705
1924
  * @see {@link https://react.dev/reference/react/useReducer}
1706
1925
  */
1707
- function useReducer<S, I, A extends AnyActionArg>(
1708
- reducer: (prevState: S, ...args: A) => S,
1709
- initialArg: I,
1710
- init: (i: I) => S,
1711
- ): [S, ActionDispatch<A>];
1926
+ // overload where "I" may be a subset of ReducerState<R>; used to provide autocompletion.
1927
+ // If "I" matches ReducerState<R> exactly then the last overload will allow initializer to be omitted.
1928
+ // the last overload effectively behaves as if the identity function (x => x) is the initializer.
1929
+ function useReducer<R extends Reducer<any, any>, I>(
1930
+ reducer: R,
1931
+ initializerArg: I & ReducerState<R>,
1932
+ initializer: (arg: I & ReducerState<R>) => ReducerState<R>,
1933
+ ): [ReducerState<R>, Dispatch<ReducerAction<R>>];
1934
+ /**
1935
+ * An alternative to `useState`.
1936
+ *
1937
+ * `useReducer` is usually preferable to `useState` when you have complex state logic that involves
1938
+ * multiple sub-values. It also lets you optimize performance for components that trigger deep
1939
+ * updates because you can pass `dispatch` down instead of callbacks.
1940
+ *
1941
+ * @version 16.8.0
1942
+ * @see {@link https://react.dev/reference/react/useReducer}
1943
+ */
1944
+ // overload for free "I"; all goes as long as initializer converts it into "ReducerState<R>".
1945
+ function useReducer<R extends Reducer<any, any>, I>(
1946
+ reducer: R,
1947
+ initializerArg: I,
1948
+ initializer: (arg: I) => ReducerState<R>,
1949
+ ): [ReducerState<R>, Dispatch<ReducerAction<R>>];
1950
+ /**
1951
+ * An alternative to `useState`.
1952
+ *
1953
+ * `useReducer` is usually preferable to `useState` when you have complex state logic that involves
1954
+ * multiple sub-values. It also lets you optimize performance for components that trigger deep
1955
+ * updates because you can pass `dispatch` down instead of callbacks.
1956
+ *
1957
+ * @version 16.8.0
1958
+ * @see {@link https://react.dev/reference/react/useReducer}
1959
+ */
1960
+
1961
+ // I'm not sure if I keep this 2-ary or if I make it (2,3)-ary; it's currently (2,3)-ary.
1962
+ // The Flow types do have an overload for 3-ary invocation with undefined initializer.
1963
+
1964
+ // NOTE: without the ReducerState indirection, TypeScript would reduce S to be the most common
1965
+ // supertype between the reducer's return type and the initialState (or the initializer's return type),
1966
+ // which would prevent autocompletion from ever working.
1967
+
1968
+ // TODO: double-check if this weird overload logic is necessary. It is possible it's either a bug
1969
+ // in older versions, or a regression in newer versions of the typescript completion service.
1970
+ function useReducer<R extends Reducer<any, any>>(
1971
+ reducer: R,
1972
+ initialState: ReducerState<R>,
1973
+ initializer?: undefined,
1974
+ ): [ReducerState<R>, Dispatch<ReducerAction<R>>];
1712
1975
  /**
1713
1976
  * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument
1714
1977
  * (`initialValue`). The returned object will persist for the full lifetime of the component.
@@ -1719,7 +1982,7 @@ declare namespace React {
1719
1982
  * @version 16.8.0
1720
1983
  * @see {@link https://react.dev/reference/react/useRef}
1721
1984
  */
1722
- function useRef<T>(initialValue: T): RefObject<T>;
1985
+ function useRef<T>(initialValue: T): MutableRefObject<T>;
1723
1986
  // convenience overload for refs given as a ref prop as they typically start with a null value
1724
1987
  /**
1725
1988
  * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument
@@ -1728,11 +1991,15 @@ declare namespace React {
1728
1991
  * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable
1729
1992
  * value around similar to how you’d use instance fields in classes.
1730
1993
  *
1994
+ * Usage note: if you need the result of useRef to be directly mutable, include `| null` in the type
1995
+ * of the generic argument.
1996
+ *
1731
1997
  * @version 16.8.0
1732
1998
  * @see {@link https://react.dev/reference/react/useRef}
1733
1999
  */
1734
- function useRef<T>(initialValue: T | null): RefObject<T | null>;
1735
- // convenience overload for undefined initialValue
2000
+ function useRef<T>(initialValue: T | null): RefObject<T>;
2001
+ // convenience overload for potentially undefined initialValue / call with 0 arguments
2002
+ // has a default to stop it from defaulting to {} instead
1736
2003
  /**
1737
2004
  * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument
1738
2005
  * (`initialValue`). The returned object will persist for the full lifetime of the component.
@@ -1743,7 +2010,7 @@ declare namespace React {
1743
2010
  * @version 16.8.0
1744
2011
  * @see {@link https://react.dev/reference/react/useRef}
1745
2012
  */
1746
- function useRef<T>(initialValue: T | undefined): RefObject<T | undefined>;
2013
+ function useRef<T = undefined>(): MutableRefObject<T | undefined>;
1747
2014
  /**
1748
2015
  * The signature is identical to `useEffect`, but it fires synchronously after all DOM mutations.
1749
2016
  * Use this to read layout from the DOM and synchronously re-render. Updates scheduled inside
@@ -1790,7 +2057,7 @@ declare namespace React {
1790
2057
  */
1791
2058
  // A specific function type would not trigger implicit any.
1792
2059
  // See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/52873#issuecomment-845806435 for a comparison between `Function` and more specific types.
1793
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
2060
+ // eslint-disable-next-line @typescript-eslint/ban-types
1794
2061
  function useCallback<T extends Function>(callback: T, deps: DependencyList): T;
1795
2062
  /**
1796
2063
  * `useMemo` will only recompute the memoized value when one of the `deps` has changed.
@@ -1813,7 +2080,8 @@ declare namespace React {
1813
2080
  // it's just the function name without the "use" prefix.
1814
2081
  function useDebugValue<T>(value: T, format?: (value: T) => any): void;
1815
2082
 
1816
- export type TransitionFunction = () => VoidOrUndefinedOnly | Promise<VoidOrUndefinedOnly>;
2083
+ // must be synchronous
2084
+ export type TransitionFunction = () => VoidOrUndefinedOnly;
1817
2085
  // strange definition to allow vscode to show documentation on the invocation
1818
2086
  export interface TransitionStartFunction {
1819
2087
  /**
@@ -1821,7 +2089,7 @@ declare namespace React {
1821
2089
  *
1822
2090
  * **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
1823
2091
  *
1824
- * @param callback A function which causes state updates that can be deferred.
2092
+ * @param callback A _synchronous_ function which causes state updates that can be deferred.
1825
2093
  */
1826
2094
  (callback: TransitionFunction): void;
1827
2095
  }
@@ -1835,11 +2103,10 @@ declare namespace React {
1835
2103
  * A good example of this is a text input.
1836
2104
  *
1837
2105
  * @param value The value that is going to be deferred
1838
- * @param initialValue A value to use during the initial render of a component. If this option is omitted, `useDeferredValue` will not defer during the initial render, because there’s no previous version of `value` that it can render instead.
1839
2106
  *
1840
2107
  * @see {@link https://react.dev/reference/react/useDeferredValue}
1841
2108
  */
1842
- export function useDeferredValue<T>(value: T, initialValue?: T): T;
2109
+ export function useDeferredValue<T>(value: T): T;
1843
2110
 
1844
2111
  /**
1845
2112
  * Allows components to avoid undesirable loading states by waiting for content to load
@@ -1861,7 +2128,7 @@ declare namespace React {
1861
2128
  /**
1862
2129
  * Similar to `useTransition` but allows uses where hooks are not available.
1863
2130
  *
1864
- * @param callback A function which causes state updates that can be deferred.
2131
+ * @param callback A _synchronous_ function which causes state updates that can be deferred.
1865
2132
  */
1866
2133
  export function startTransition(scope: TransitionFunction): void;
1867
2134
 
@@ -1876,11 +2143,6 @@ declare namespace React {
1876
2143
  *
1877
2144
  * @see https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks
1878
2145
  */
1879
- // NOTES
1880
- // - the order of these signatures matters - typescript will check the signatures in source order.
1881
- // If the `() => VoidOrUndefinedOnly` signature is first, it'll erroneously match a Promise returning function for users with
1882
- // `strictNullChecks: false`.
1883
- // - VoidOrUndefinedOnly is there to forbid any non-void return values for users with `strictNullChecks: true`
1884
2146
  // While act does always return Thenable, if a void function is passed, we pretend the return value is also void to not trigger dangling Promise lint rules.
1885
2147
  export function act(callback: () => VoidOrUndefinedOnly): void;
1886
2148
  export function act<T>(callback: () => T | Promise<T>): Promise<T>;
@@ -1908,32 +2170,6 @@ declare namespace React {
1908
2170
  getServerSnapshot?: () => Snapshot,
1909
2171
  ): Snapshot;
1910
2172
 
1911
- export function useOptimistic<State>(
1912
- passthrough: State,
1913
- ): [State, (action: State | ((pendingState: State) => State)) => void];
1914
- export function useOptimistic<State, Action>(
1915
- passthrough: State,
1916
- reducer: (state: State, action: Action) => State,
1917
- ): [State, (action: Action) => void];
1918
-
1919
- export type Usable<T> = PromiseLike<T> | Context<T>;
1920
-
1921
- export function use<T>(usable: Usable<T>): T;
1922
-
1923
- export function useActionState<State>(
1924
- action: (state: Awaited<State>) => State | Promise<State>,
1925
- initialState: Awaited<State>,
1926
- permalink?: string,
1927
- ): [state: Awaited<State>, dispatch: () => void, isPending: boolean];
1928
- export function useActionState<State, Payload>(
1929
- action: (state: Awaited<State>, payload: Payload) => State | Promise<State>,
1930
- initialState: Awaited<State>,
1931
- permalink?: string,
1932
- ): [state: Awaited<State>, dispatch: (payload: Payload) => void, isPending: boolean];
1933
-
1934
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
1935
- export function cache<CachedFunction extends Function>(fn: CachedFunction): CachedFunction;
1936
-
1937
2173
  //
1938
2174
  // Event System
1939
2175
  // ----------------------------------------------------------------------
@@ -2101,11 +2337,6 @@ declare namespace React {
2101
2337
  pseudoElement: string;
2102
2338
  }
2103
2339
 
2104
- interface ToggleEvent<T = Element> extends SyntheticEvent<T, NativeToggleEvent> {
2105
- oldState: "closed" | "open";
2106
- newState: "closed" | "open";
2107
- }
2108
-
2109
2340
  interface TransitionEvent<T = Element> extends SyntheticEvent<T, NativeTransitionEvent> {
2110
2341
  elapsedTime: number;
2111
2342
  propertyName: string;
@@ -2133,7 +2364,6 @@ declare namespace React {
2133
2364
  type UIEventHandler<T = Element> = EventHandler<UIEvent<T>>;
2134
2365
  type WheelEventHandler<T = Element> = EventHandler<WheelEvent<T>>;
2135
2366
  type AnimationEventHandler<T = Element> = EventHandler<AnimationEvent<T>>;
2136
- type ToggleEventHandler<T = Element> = EventHandler<ToggleEvent<T>>;
2137
2367
  type TransitionEventHandler<T = Element> = EventHandler<TransitionEvent<T>>;
2138
2368
 
2139
2369
  //
@@ -2347,19 +2577,9 @@ declare namespace React {
2347
2577
  onAnimationIteration?: AnimationEventHandler<T> | undefined;
2348
2578
  onAnimationIterationCapture?: AnimationEventHandler<T> | undefined;
2349
2579
 
2350
- // Toggle Events
2351
- onToggle?: ToggleEventHandler<T> | undefined;
2352
- onBeforeToggle?: ToggleEventHandler<T> | undefined;
2353
-
2354
2580
  // Transition Events
2355
- onTransitionCancel?: TransitionEventHandler<T> | undefined;
2356
- onTransitionCancelCapture?: TransitionEventHandler<T> | undefined;
2357
2581
  onTransitionEnd?: TransitionEventHandler<T> | undefined;
2358
2582
  onTransitionEndCapture?: TransitionEventHandler<T> | undefined;
2359
- onTransitionRun?: TransitionEventHandler<T> | undefined;
2360
- onTransitionRunCapture?: TransitionEventHandler<T> | undefined;
2361
- onTransitionStart?: TransitionEventHandler<T> | undefined;
2362
- onTransitionStartCapture?: TransitionEventHandler<T> | undefined;
2363
2583
  }
2364
2584
 
2365
2585
  export interface CSSProperties extends CSS.Properties<string | number> {
@@ -2679,7 +2899,6 @@ declare namespace React {
2679
2899
 
2680
2900
  // Standard HTML Attributes
2681
2901
  accessKey?: string | undefined;
2682
- autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
2683
2902
  autoFocus?: boolean | undefined;
2684
2903
  className?: string | undefined;
2685
2904
  contentEditable?: Booleanish | "inherit" | "plaintext-only" | undefined;
@@ -2718,6 +2937,7 @@ declare namespace React {
2718
2937
  vocab?: string | undefined;
2719
2938
 
2720
2939
  // Non-standard Attributes
2940
+ autoCapitalize?: string | undefined;
2721
2941
  autoCorrect?: string | undefined;
2722
2942
  autoSave?: string | undefined;
2723
2943
  color?: string | undefined;
@@ -2730,16 +2950,7 @@ declare namespace React {
2730
2950
  security?: string | undefined;
2731
2951
  unselectable?: "on" | "off" | undefined;
2732
2952
 
2733
- // Popover API
2734
- popover?: "" | "auto" | "manual" | undefined;
2735
- popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
2736
- popoverTarget?: string | undefined;
2737
-
2738
2953
  // Living Standard
2739
- /**
2740
- * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert
2741
- */
2742
- inert?: boolean | undefined;
2743
2954
  /**
2744
2955
  * Hints at the type of data that might be entered by the user while editing the element or its contents
2745
2956
  * @see {@link https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute}
@@ -2766,7 +2977,6 @@ declare namespace React {
2766
2977
  action?:
2767
2978
  | string
2768
2979
  | undefined
2769
- | ((formData: FormData) => void | Promise<void>)
2770
2980
  | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
2771
2981
  keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
2772
2982
  ];
@@ -2801,7 +3011,6 @@ declare namespace React {
2801
3011
  formAction?:
2802
3012
  | string
2803
3013
  | undefined
2804
- | ((formData: FormData) => void | Promise<void>)
2805
3014
  | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
2806
3015
  keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
2807
3016
  ];
@@ -2934,7 +3143,6 @@ declare namespace React {
2934
3143
  form?: string | undefined;
2935
3144
  formAction?:
2936
3145
  | string
2937
- | ((formData: FormData) => void | Promise<void>)
2938
3146
  | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
2939
3147
  keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
2940
3148
  ]
@@ -2968,6 +3176,7 @@ declare namespace React {
2968
3176
 
2969
3177
  interface DetailsHTMLAttributes<T> extends HTMLAttributes<T> {
2970
3178
  open?: boolean | undefined;
3179
+ onToggle?: ReactEventHandler<T> | undefined;
2971
3180
  name?: string | undefined;
2972
3181
  }
2973
3182
 
@@ -3000,7 +3209,6 @@ declare namespace React {
3000
3209
  action?:
3001
3210
  | string
3002
3211
  | undefined
3003
- | ((formData: FormData) => void | Promise<void>)
3004
3212
  | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
3005
3213
  keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
3006
3214
  ];
@@ -3156,7 +3364,6 @@ declare namespace React {
3156
3364
  form?: string | undefined;
3157
3365
  formAction?:
3158
3366
  | string
3159
- | ((formData: FormData) => void | Promise<void>)
3160
3367
  | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
3161
3368
  keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
3162
3369
  ]
@@ -3219,9 +3426,6 @@ declare namespace React {
3219
3426
  sizes?: string | undefined;
3220
3427
  type?: string | undefined;
3221
3428
  charSet?: string | undefined;
3222
-
3223
- // React props
3224
- precedence?: string | undefined;
3225
3429
  }
3226
3430
 
3227
3431
  interface MapHTMLAttributes<T> extends HTMLAttributes<T> {
@@ -3356,10 +3560,6 @@ declare namespace React {
3356
3560
  media?: string | undefined;
3357
3561
  scoped?: boolean | undefined;
3358
3562
  type?: string | undefined;
3359
-
3360
- // React props
3361
- href?: string | undefined;
3362
- precedence?: string | undefined;
3363
3563
  }
3364
3564
 
3365
3565
  interface TableHTMLAttributes<T> extends HTMLAttributes<T> {
@@ -3747,184 +3947,259 @@ declare namespace React {
3747
3947
  webpreferences?: string | undefined;
3748
3948
  }
3749
3949
 
3750
- // TODO: Move to react-dom
3751
- type HTMLElementType =
3752
- | "a"
3753
- | "abbr"
3754
- | "address"
3755
- | "area"
3756
- | "article"
3757
- | "aside"
3758
- | "audio"
3759
- | "b"
3760
- | "base"
3761
- | "bdi"
3762
- | "bdo"
3763
- | "big"
3764
- | "blockquote"
3765
- | "body"
3766
- | "br"
3767
- | "button"
3768
- | "canvas"
3769
- | "caption"
3770
- | "center"
3771
- | "cite"
3772
- | "code"
3773
- | "col"
3774
- | "colgroup"
3775
- | "data"
3776
- | "datalist"
3777
- | "dd"
3778
- | "del"
3779
- | "details"
3780
- | "dfn"
3781
- | "dialog"
3782
- | "div"
3783
- | "dl"
3784
- | "dt"
3785
- | "em"
3786
- | "embed"
3787
- | "fieldset"
3788
- | "figcaption"
3789
- | "figure"
3790
- | "footer"
3791
- | "form"
3792
- | "h1"
3793
- | "h2"
3794
- | "h3"
3795
- | "h4"
3796
- | "h5"
3797
- | "h6"
3798
- | "head"
3799
- | "header"
3800
- | "hgroup"
3801
- | "hr"
3802
- | "html"
3803
- | "i"
3804
- | "iframe"
3805
- | "img"
3806
- | "input"
3807
- | "ins"
3808
- | "kbd"
3809
- | "keygen"
3810
- | "label"
3811
- | "legend"
3812
- | "li"
3813
- | "link"
3814
- | "main"
3815
- | "map"
3816
- | "mark"
3817
- | "menu"
3818
- | "menuitem"
3819
- | "meta"
3820
- | "meter"
3821
- | "nav"
3822
- | "noscript"
3823
- | "object"
3824
- | "ol"
3825
- | "optgroup"
3826
- | "option"
3827
- | "output"
3828
- | "p"
3829
- | "param"
3830
- | "picture"
3831
- | "pre"
3832
- | "progress"
3833
- | "q"
3834
- | "rp"
3835
- | "rt"
3836
- | "ruby"
3837
- | "s"
3838
- | "samp"
3839
- | "search"
3840
- | "slot"
3841
- | "script"
3842
- | "section"
3843
- | "select"
3844
- | "small"
3845
- | "source"
3846
- | "span"
3847
- | "strong"
3848
- | "style"
3849
- | "sub"
3850
- | "summary"
3851
- | "sup"
3852
- | "table"
3853
- | "template"
3854
- | "tbody"
3855
- | "td"
3856
- | "textarea"
3857
- | "tfoot"
3858
- | "th"
3859
- | "thead"
3860
- | "time"
3861
- | "title"
3862
- | "tr"
3863
- | "track"
3864
- | "u"
3865
- | "ul"
3866
- | "var"
3867
- | "video"
3868
- | "wbr"
3869
- | "webview";
3870
-
3871
- // TODO: Move to react-dom
3872
- type SVGElementType =
3873
- | "animate"
3874
- | "circle"
3875
- | "clipPath"
3876
- | "defs"
3877
- | "desc"
3878
- | "ellipse"
3879
- | "feBlend"
3880
- | "feColorMatrix"
3881
- | "feComponentTransfer"
3882
- | "feComposite"
3883
- | "feConvolveMatrix"
3884
- | "feDiffuseLighting"
3885
- | "feDisplacementMap"
3886
- | "feDistantLight"
3887
- | "feDropShadow"
3888
- | "feFlood"
3889
- | "feFuncA"
3890
- | "feFuncB"
3891
- | "feFuncG"
3892
- | "feFuncR"
3893
- | "feGaussianBlur"
3894
- | "feImage"
3895
- | "feMerge"
3896
- | "feMergeNode"
3897
- | "feMorphology"
3898
- | "feOffset"
3899
- | "fePointLight"
3900
- | "feSpecularLighting"
3901
- | "feSpotLight"
3902
- | "feTile"
3903
- | "feTurbulence"
3904
- | "filter"
3905
- | "foreignObject"
3906
- | "g"
3907
- | "image"
3908
- | "line"
3909
- | "linearGradient"
3910
- | "marker"
3911
- | "mask"
3912
- | "metadata"
3913
- | "path"
3914
- | "pattern"
3915
- | "polygon"
3916
- | "polyline"
3917
- | "radialGradient"
3918
- | "rect"
3919
- | "stop"
3920
- | "svg"
3921
- | "switch"
3922
- | "symbol"
3923
- | "text"
3924
- | "textPath"
3925
- | "tspan"
3926
- | "use"
3927
- | "view";
3950
+ //
3951
+ // React.DOM
3952
+ // ----------------------------------------------------------------------
3953
+
3954
+ interface ReactHTML {
3955
+ a: DetailedHTMLFactory<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
3956
+ abbr: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
3957
+ address: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
3958
+ area: DetailedHTMLFactory<AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>;
3959
+ article: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
3960
+ aside: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
3961
+ audio: DetailedHTMLFactory<AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>;
3962
+ b: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
3963
+ base: DetailedHTMLFactory<BaseHTMLAttributes<HTMLBaseElement>, HTMLBaseElement>;
3964
+ bdi: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
3965
+ bdo: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
3966
+ big: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
3967
+ blockquote: DetailedHTMLFactory<BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
3968
+ body: DetailedHTMLFactory<HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>;
3969
+ br: DetailedHTMLFactory<HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
3970
+ button: DetailedHTMLFactory<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
3971
+ canvas: DetailedHTMLFactory<CanvasHTMLAttributes<HTMLCanvasElement>, HTMLCanvasElement>;
3972
+ caption: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
3973
+ center: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
3974
+ cite: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
3975
+ code: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
3976
+ col: DetailedHTMLFactory<ColHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
3977
+ colgroup: DetailedHTMLFactory<ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
3978
+ data: DetailedHTMLFactory<DataHTMLAttributes<HTMLDataElement>, HTMLDataElement>;
3979
+ datalist: DetailedHTMLFactory<HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>;
3980
+ dd: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
3981
+ del: DetailedHTMLFactory<DelHTMLAttributes<HTMLModElement>, HTMLModElement>;
3982
+ details: DetailedHTMLFactory<DetailsHTMLAttributes<HTMLDetailsElement>, HTMLDetailsElement>;
3983
+ dfn: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
3984
+ dialog: DetailedHTMLFactory<DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>;
3985
+ div: DetailedHTMLFactory<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
3986
+ dl: DetailedHTMLFactory<HTMLAttributes<HTMLDListElement>, HTMLDListElement>;
3987
+ dt: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
3988
+ em: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
3989
+ embed: DetailedHTMLFactory<EmbedHTMLAttributes<HTMLEmbedElement>, HTMLEmbedElement>;
3990
+ fieldset: DetailedHTMLFactory<FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>;
3991
+ figcaption: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
3992
+ figure: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
3993
+ footer: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
3994
+ form: DetailedHTMLFactory<FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>;
3995
+ h1: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
3996
+ h2: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
3997
+ h3: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
3998
+ h4: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
3999
+ h5: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
4000
+ h6: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
4001
+ head: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLHeadElement>;
4002
+ header: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4003
+ hgroup: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4004
+ hr: DetailedHTMLFactory<HTMLAttributes<HTMLHRElement>, HTMLHRElement>;
4005
+ html: DetailedHTMLFactory<HtmlHTMLAttributes<HTMLHtmlElement>, HTMLHtmlElement>;
4006
+ i: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4007
+ iframe: DetailedHTMLFactory<IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement>;
4008
+ img: DetailedHTMLFactory<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>;
4009
+ input: DetailedHTMLFactory<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
4010
+ ins: DetailedHTMLFactory<InsHTMLAttributes<HTMLModElement>, HTMLModElement>;
4011
+ kbd: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4012
+ keygen: DetailedHTMLFactory<KeygenHTMLAttributes<HTMLElement>, HTMLElement>;
4013
+ label: DetailedHTMLFactory<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>;
4014
+ legend: DetailedHTMLFactory<HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>;
4015
+ li: DetailedHTMLFactory<LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>;
4016
+ link: DetailedHTMLFactory<LinkHTMLAttributes<HTMLLinkElement>, HTMLLinkElement>;
4017
+ main: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4018
+ map: DetailedHTMLFactory<MapHTMLAttributes<HTMLMapElement>, HTMLMapElement>;
4019
+ mark: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4020
+ menu: DetailedHTMLFactory<MenuHTMLAttributes<HTMLElement>, HTMLElement>;
4021
+ menuitem: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4022
+ meta: DetailedHTMLFactory<MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>;
4023
+ meter: DetailedHTMLFactory<MeterHTMLAttributes<HTMLMeterElement>, HTMLMeterElement>;
4024
+ nav: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4025
+ noscript: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4026
+ object: DetailedHTMLFactory<ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>;
4027
+ ol: DetailedHTMLFactory<OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>;
4028
+ optgroup: DetailedHTMLFactory<OptgroupHTMLAttributes<HTMLOptGroupElement>, HTMLOptGroupElement>;
4029
+ option: DetailedHTMLFactory<OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>;
4030
+ output: DetailedHTMLFactory<OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>;
4031
+ p: DetailedHTMLFactory<HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>;
4032
+ param: DetailedHTMLFactory<ParamHTMLAttributes<HTMLParamElement>, HTMLParamElement>;
4033
+ picture: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4034
+ pre: DetailedHTMLFactory<HTMLAttributes<HTMLPreElement>, HTMLPreElement>;
4035
+ progress: DetailedHTMLFactory<ProgressHTMLAttributes<HTMLProgressElement>, HTMLProgressElement>;
4036
+ q: DetailedHTMLFactory<QuoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
4037
+ rp: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4038
+ rt: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4039
+ ruby: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4040
+ s: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4041
+ samp: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4042
+ search: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4043
+ slot: DetailedHTMLFactory<SlotHTMLAttributes<HTMLSlotElement>, HTMLSlotElement>;
4044
+ script: DetailedHTMLFactory<ScriptHTMLAttributes<HTMLScriptElement>, HTMLScriptElement>;
4045
+ section: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4046
+ select: DetailedHTMLFactory<SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>;
4047
+ small: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4048
+ source: DetailedHTMLFactory<SourceHTMLAttributes<HTMLSourceElement>, HTMLSourceElement>;
4049
+ span: DetailedHTMLFactory<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>;
4050
+ strong: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4051
+ style: DetailedHTMLFactory<StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>;
4052
+ sub: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4053
+ summary: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4054
+ sup: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4055
+ table: DetailedHTMLFactory<TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>;
4056
+ template: DetailedHTMLFactory<HTMLAttributes<HTMLTemplateElement>, HTMLTemplateElement>;
4057
+ tbody: DetailedHTMLFactory<HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
4058
+ td: DetailedHTMLFactory<TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>;
4059
+ textarea: DetailedHTMLFactory<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>;
4060
+ tfoot: DetailedHTMLFactory<HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
4061
+ th: DetailedHTMLFactory<ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>;
4062
+ thead: DetailedHTMLFactory<HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
4063
+ time: DetailedHTMLFactory<TimeHTMLAttributes<HTMLTimeElement>, HTMLTimeElement>;
4064
+ title: DetailedHTMLFactory<HTMLAttributes<HTMLTitleElement>, HTMLTitleElement>;
4065
+ tr: DetailedHTMLFactory<HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>;
4066
+ track: DetailedHTMLFactory<TrackHTMLAttributes<HTMLTrackElement>, HTMLTrackElement>;
4067
+ u: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4068
+ ul: DetailedHTMLFactory<HTMLAttributes<HTMLUListElement>, HTMLUListElement>;
4069
+ "var": DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4070
+ video: DetailedHTMLFactory<VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>;
4071
+ wbr: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
4072
+ webview: DetailedHTMLFactory<WebViewHTMLAttributes<HTMLWebViewElement>, HTMLWebViewElement>;
4073
+ }
4074
+
4075
+ interface ReactSVG {
4076
+ animate: SVGFactory;
4077
+ circle: SVGFactory;
4078
+ clipPath: SVGFactory;
4079
+ defs: SVGFactory;
4080
+ desc: SVGFactory;
4081
+ ellipse: SVGFactory;
4082
+ feBlend: SVGFactory;
4083
+ feColorMatrix: SVGFactory;
4084
+ feComponentTransfer: SVGFactory;
4085
+ feComposite: SVGFactory;
4086
+ feConvolveMatrix: SVGFactory;
4087
+ feDiffuseLighting: SVGFactory;
4088
+ feDisplacementMap: SVGFactory;
4089
+ feDistantLight: SVGFactory;
4090
+ feDropShadow: SVGFactory;
4091
+ feFlood: SVGFactory;
4092
+ feFuncA: SVGFactory;
4093
+ feFuncB: SVGFactory;
4094
+ feFuncG: SVGFactory;
4095
+ feFuncR: SVGFactory;
4096
+ feGaussianBlur: SVGFactory;
4097
+ feImage: SVGFactory;
4098
+ feMerge: SVGFactory;
4099
+ feMergeNode: SVGFactory;
4100
+ feMorphology: SVGFactory;
4101
+ feOffset: SVGFactory;
4102
+ fePointLight: SVGFactory;
4103
+ feSpecularLighting: SVGFactory;
4104
+ feSpotLight: SVGFactory;
4105
+ feTile: SVGFactory;
4106
+ feTurbulence: SVGFactory;
4107
+ filter: SVGFactory;
4108
+ foreignObject: SVGFactory;
4109
+ g: SVGFactory;
4110
+ image: SVGFactory;
4111
+ line: SVGFactory;
4112
+ linearGradient: SVGFactory;
4113
+ marker: SVGFactory;
4114
+ mask: SVGFactory;
4115
+ metadata: SVGFactory;
4116
+ path: SVGFactory;
4117
+ pattern: SVGFactory;
4118
+ polygon: SVGFactory;
4119
+ polyline: SVGFactory;
4120
+ radialGradient: SVGFactory;
4121
+ rect: SVGFactory;
4122
+ stop: SVGFactory;
4123
+ svg: SVGFactory;
4124
+ switch: SVGFactory;
4125
+ symbol: SVGFactory;
4126
+ text: SVGFactory;
4127
+ textPath: SVGFactory;
4128
+ tspan: SVGFactory;
4129
+ use: SVGFactory;
4130
+ view: SVGFactory;
4131
+ }
4132
+
4133
+ interface ReactDOM extends ReactHTML, ReactSVG {}
4134
+
4135
+ //
4136
+ // React.PropTypes
4137
+ // ----------------------------------------------------------------------
4138
+
4139
+ /**
4140
+ * @deprecated Use `Validator` from the ´prop-types` instead.
4141
+ */
4142
+ type Validator<T> = PropTypes.Validator<T>;
4143
+
4144
+ /**
4145
+ * @deprecated Use `Requireable` from the ´prop-types` instead.
4146
+ */
4147
+ type Requireable<T> = PropTypes.Requireable<T>;
4148
+
4149
+ /**
4150
+ * @deprecated Use `ValidationMap` from the ´prop-types` instead.
4151
+ */
4152
+ type ValidationMap<T> = PropTypes.ValidationMap<T>;
4153
+
4154
+ /**
4155
+ * @deprecated Use `WeakValidationMap` from the ´prop-types` instead.
4156
+ */
4157
+ type WeakValidationMap<T> = {
4158
+ [K in keyof T]?: null extends T[K] ? Validator<T[K] | null | undefined>
4159
+ : undefined extends T[K] ? Validator<T[K] | null | undefined>
4160
+ : Validator<T[K]>;
4161
+ };
4162
+
4163
+ /**
4164
+ * @deprecated Use `PropTypes.*` where `PropTypes` comes from `import * as PropTypes from 'prop-types'` instead.
4165
+ */
4166
+ interface ReactPropTypes {
4167
+ any: typeof PropTypes.any;
4168
+ array: typeof PropTypes.array;
4169
+ bool: typeof PropTypes.bool;
4170
+ func: typeof PropTypes.func;
4171
+ number: typeof PropTypes.number;
4172
+ object: typeof PropTypes.object;
4173
+ string: typeof PropTypes.string;
4174
+ node: typeof PropTypes.node;
4175
+ element: typeof PropTypes.element;
4176
+ instanceOf: typeof PropTypes.instanceOf;
4177
+ oneOf: typeof PropTypes.oneOf;
4178
+ oneOfType: typeof PropTypes.oneOfType;
4179
+ arrayOf: typeof PropTypes.arrayOf;
4180
+ objectOf: typeof PropTypes.objectOf;
4181
+ shape: typeof PropTypes.shape;
4182
+ exact: typeof PropTypes.exact;
4183
+ }
4184
+
4185
+ //
4186
+ // React.Children
4187
+ // ----------------------------------------------------------------------
4188
+
4189
+ /**
4190
+ * @deprecated - Use `typeof React.Children` instead.
4191
+ */
4192
+ // Sync with type of `const Children`.
4193
+ interface ReactChildren {
4194
+ map<T, C>(
4195
+ children: C | readonly C[],
4196
+ fn: (child: C, index: number) => T,
4197
+ ): C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>;
4198
+ forEach<C>(children: C | readonly C[], fn: (child: C, index: number) => void): void;
4199
+ count(children: any): number;
4200
+ only<C>(children: C): C extends any[] ? never : C;
4201
+ toArray(children: ReactNode | ReactNode[]): Array<Exclude<ReactNode, boolean | null | undefined>>;
4202
+ }
3928
4203
 
3929
4204
  //
3930
4205
  // Browser Interfaces
@@ -3966,6 +4241,68 @@ declare namespace React {
3966
4241
  }
3967
4242
 
3968
4243
  // Keep in sync with JSX namespace in ./jsx-runtime.d.ts and ./jsx-dev-runtime.d.ts
4244
+ namespace JSX {
4245
+ type ElementType = GlobalJSXElementType;
4246
+ interface Element extends GlobalJSXElement {}
4247
+ interface ElementClass extends GlobalJSXElementClass {}
4248
+ interface ElementAttributesProperty extends GlobalJSXElementAttributesProperty {}
4249
+ interface ElementChildrenAttribute extends GlobalJSXElementChildrenAttribute {}
4250
+
4251
+ type LibraryManagedAttributes<C, P> = GlobalJSXLibraryManagedAttributes<C, P>;
4252
+
4253
+ interface IntrinsicAttributes extends GlobalJSXIntrinsicAttributes {}
4254
+ interface IntrinsicClassAttributes<T> extends GlobalJSXIntrinsicClassAttributes<T> {}
4255
+ interface IntrinsicElements extends GlobalJSXIntrinsicElements {}
4256
+ }
4257
+ }
4258
+
4259
+ // naked 'any' type in a conditional type will short circuit and union both the then/else branches
4260
+ // so boolean is only resolved for T = any
4261
+ type IsExactlyAny<T> = boolean extends (T extends never ? true : false) ? true : false;
4262
+
4263
+ type ExactlyAnyPropertyKeys<T> = { [K in keyof T]: IsExactlyAny<T[K]> extends true ? K : never }[keyof T];
4264
+ type NotExactlyAnyPropertyKeys<T> = Exclude<keyof T, ExactlyAnyPropertyKeys<T>>;
4265
+
4266
+ // Try to resolve ill-defined props like for JS users: props can be any, or sometimes objects with properties of type any
4267
+ type MergePropTypes<P, T> =
4268
+ // Distribute over P in case it is a union type
4269
+ P extends any
4270
+ // If props is type any, use propTypes definitions
4271
+ ? IsExactlyAny<P> extends true ? T
4272
+ // If declared props have indexed properties, ignore inferred props entirely as keyof gets widened
4273
+ : string extends keyof P ? P
4274
+ // Prefer declared types which are not exactly any
4275
+ :
4276
+ & Pick<P, NotExactlyAnyPropertyKeys<P>>
4277
+ // For props which are exactly any, use the type inferred from propTypes if present
4278
+ & Pick<T, Exclude<keyof T, NotExactlyAnyPropertyKeys<P>>>
4279
+ // Keep leftover props not specified in propTypes
4280
+ & Pick<P, Exclude<keyof P, keyof T>>
4281
+ : never;
4282
+
4283
+ type InexactPartial<T> = { [K in keyof T]?: T[K] | undefined };
4284
+
4285
+ // Any prop that has a default prop becomes optional, but its type is unchanged
4286
+ // Undeclared default props are augmented into the resulting allowable attributes
4287
+ // If declared props have indexed properties, ignore default props entirely as keyof gets widened
4288
+ // Wrap in an outer-level conditional type to allow distribution over props that are unions
4289
+ type Defaultize<P, D> = P extends any ? string extends keyof P ? P
4290
+ :
4291
+ & Pick<P, Exclude<keyof P, keyof D>>
4292
+ & InexactPartial<Pick<P, Extract<keyof P, keyof D>>>
4293
+ & InexactPartial<Pick<D, Exclude<keyof D, keyof P>>>
4294
+ : never;
4295
+
4296
+ type ReactManagedAttributes<C, P> = C extends { propTypes: infer T; defaultProps: infer D }
4297
+ ? Defaultize<MergePropTypes<P, PropTypes.InferProps<T>>, D>
4298
+ : C extends { propTypes: infer T } ? MergePropTypes<P, PropTypes.InferProps<T>>
4299
+ : C extends { defaultProps: infer D } ? Defaultize<P, D>
4300
+ : P;
4301
+
4302
+ declare global {
4303
+ /**
4304
+ * @deprecated Use `React.JSX` instead of the global `JSX` namespace.
4305
+ */
3969
4306
  namespace JSX {
3970
4307
  // We don't just alias React.ElementType because React.ElementType
3971
4308
  // historically does more than we need it to.
@@ -4189,18 +4526,18 @@ declare namespace React {
4189
4526
  }
4190
4527
  }
4191
4528
 
4192
- type InexactPartial<T> = { [K in keyof T]?: T[K] | undefined };
4529
+ // React.JSX needs to point to global.JSX to keep global module augmentations intact.
4530
+ // But we can't access global.JSX so we need to create these aliases instead.
4531
+ // Once the global JSX namespace will be removed we replace React.JSX with the contents of global.JSX
4532
+ type GlobalJSXElementType = JSX.ElementType;
4533
+ interface GlobalJSXElement extends JSX.Element {}
4534
+ interface GlobalJSXElementClass extends JSX.ElementClass {}
4535
+ interface GlobalJSXElementAttributesProperty extends JSX.ElementAttributesProperty {}
4536
+ interface GlobalJSXElementChildrenAttribute extends JSX.ElementChildrenAttribute {}
4193
4537
 
4194
- // Any prop that has a default prop becomes optional, but its type is unchanged
4195
- // Undeclared default props are augmented into the resulting allowable attributes
4196
- // If declared props have indexed properties, ignore default props entirely as keyof gets widened
4197
- // Wrap in an outer-level conditional type to allow distribution over props that are unions
4198
- type Defaultize<P, D> = P extends any ? string extends keyof P ? P
4199
- :
4200
- & Pick<P, Exclude<keyof P, keyof D>>
4201
- & InexactPartial<Pick<P, Extract<keyof P, keyof D>>>
4202
- & InexactPartial<Pick<D, Exclude<keyof D, keyof P>>>
4203
- : never;
4538
+ type GlobalJSXLibraryManagedAttributes<C, P> = JSX.LibraryManagedAttributes<C, P>;
4204
4539
 
4205
- type ReactManagedAttributes<C, P> = C extends { defaultProps: infer D } ? Defaultize<P, D>
4206
- : P;
4540
+ interface GlobalJSXIntrinsicAttributes extends JSX.IntrinsicAttributes {}
4541
+ interface GlobalJSXIntrinsicClassAttributes<T> extends JSX.IntrinsicClassAttributes<T> {}
4542
+
4543
+ interface GlobalJSXIntrinsicElements extends JSX.IntrinsicElements {}