@pinuts/bsr-uikit-relaunch 0.2.39 → 0.2.41
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.
- package/dist/hooks/withFieldGroup.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.LICENSE.txt +2 -2
- package/dist/items/Title/Title.d.ts +12 -0
- package/dist/items/Title/Title.d.ts.map +1 -0
- package/dist/items/Title/Title.js +42 -0
- package/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js +2 -2
- package/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +1 -1
- package/node_modules/@babel/runtime/helpers/esm/superPropGet.js +4 -4
- package/node_modules/@babel/runtime/helpers/esm/superPropSet.js +2 -2
- package/node_modules/@babel/runtime/helpers/esm/tsRewriteRelativeImportExtensions.js +6 -0
- package/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js +4 -3
- package/node_modules/@babel/runtime/helpers/objectWithoutProperties.js +2 -2
- package/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js +1 -1
- package/node_modules/@babel/runtime/helpers/superPropGet.js +4 -4
- package/node_modules/@babel/runtime/helpers/superPropSet.js +2 -2
- package/node_modules/@babel/runtime/helpers/tsRewriteRelativeImportExtensions.js +6 -0
- package/node_modules/@babel/runtime/helpers/wrapRegExp.js +4 -3
- package/node_modules/@babel/runtime/package.json +10 -1
- package/node_modules/@types/hoist-non-react-statics/README.md +13 -13
- package/node_modules/@types/hoist-non-react-statics/index.d.ts +12 -12
- package/node_modules/@types/hoist-non-react-statics/package.json +4 -3
- package/node_modules/@types/react/README.md +3 -3
- package/node_modules/@types/react/canary.d.ts +0 -122
- package/node_modules/@types/react/compiler-runtime.d.ts +4 -0
- package/node_modules/@types/react/experimental.d.ts +118 -4
- package/node_modules/@types/react/global.d.ts +4 -0
- package/node_modules/@types/react/index.d.ts +468 -770
- package/node_modules/@types/react/package.json +9 -9
- package/node_modules/@types/react/ts5.0/canary.d.ts +0 -122
- package/node_modules/@types/react/ts5.0/experimental.d.ts +118 -4
- package/node_modules/@types/react/ts5.0/global.d.ts +4 -0
- package/node_modules/@types/react/ts5.0/index.d.ts +464 -766
- package/node_modules/@types/react/ts5.0/v18/global.d.ts +160 -0
- package/node_modules/@types/react/ts5.0/v18/index.d.ts +4543 -0
- package/node_modules/@types/react/ts5.0/v18/jsx-dev-runtime.d.ts +45 -0
- package/node_modules/@types/react/ts5.0/v18/jsx-runtime.d.ts +36 -0
- package/node_modules/@types/react/ts5.0/v18/ts5.0/global.d.ts +160 -0
- package/node_modules/@types/react/ts5.0/v18/ts5.0/index.d.ts +4530 -0
- package/node_modules/@types/react/ts5.0/v18/ts5.0/jsx-dev-runtime.d.ts +44 -0
- package/node_modules/@types/react/ts5.0/v18/ts5.0/jsx-runtime.d.ts +35 -0
- package/node_modules/tslib/modules/index.d.ts +1 -0
- package/node_modules/tslib/modules/index.js +2 -0
- package/node_modules/tslib/package.json +1 -1
- package/node_modules/tslib/tslib.d.ts +7 -0
- package/node_modules/tslib/tslib.es6.js +24 -1
- package/node_modules/tslib/tslib.es6.mjs +24 -1
- package/node_modules/tslib/tslib.js +56 -1
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/README.md +1 -1
- package/node_modules/{@pinuts/form-builder/node_modules/typescript/lib/tsc.js → typescript/lib/_tsc.js} +4349 -2310
- package/node_modules/{@pinuts/form-builder/node_modules/typescript/lib/tsserver.js → typescript/lib/_tsserver.js} +44 -8
- package/node_modules/{@pinuts/form-builder/node_modules/typescript/lib/typingsInstaller.js → typescript/lib/_typingsInstaller.js} +2 -16
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/cs/diagnosticMessages.generated.json +30 -12
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/de/diagnosticMessages.generated.json +30 -12
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/es/diagnosticMessages.generated.json +30 -12
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/fr/diagnosticMessages.generated.json +30 -12
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/it/diagnosticMessages.generated.json +30 -12
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/ja/diagnosticMessages.generated.json +30 -12
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/ko/diagnosticMessages.generated.json +30 -12
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.decorators.d.ts +13 -15
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.dom.d.ts +1884 -361
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.dom.iterable.d.ts +9 -7
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2015.core.d.ts +9 -9
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2015.iterable.d.ts +114 -36
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2015.symbol.wellknown.d.ts +10 -10
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2016.array.include.d.ts +9 -9
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2016.intl.d.ts +1 -1
- package/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +21 -0
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2017.d.ts +3 -2
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2017.sharedmemory.d.ts +14 -14
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2017.typedarrays.d.ts +9 -9
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2020.bigint.d.ts +92 -54
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2020.intl.d.ts +36 -36
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2020.sharedmemory.d.ts +13 -11
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2020.string.d.ts +2 -0
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2021.intl.d.ts +17 -17
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2021.weakref.d.ts +2 -0
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2022.array.d.ts +11 -11
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2022.d.ts +1 -2
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2022.error.d.ts +2 -0
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2022.intl.d.ts +9 -9
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2023.array.d.ts +79 -79
- package/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +65 -0
- package/node_modules/typescript/lib/lib.es2024.collection.d.ts +29 -0
- package/node_modules/typescript/lib/lib.es2024.d.ts +26 -0
- package/node_modules/typescript/lib/lib.es2024.full.d.ts +24 -0
- package/node_modules/{@pinuts/form-builder/node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts → typescript/lib/lib.es2024.sharedmemory.d.ts} +29 -0
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es5.d.ts +312 -303
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.esnext.array.d.ts +1 -1
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.esnext.collection.d.ts +1 -11
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.esnext.d.ts +3 -5
- package/node_modules/typescript/lib/lib.esnext.float16.d.ts +443 -0
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.esnext.iterator.d.ts +1 -1
- package/node_modules/typescript/lib/lib.esnext.promise.d.ts +34 -0
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.webworker.d.ts +571 -87
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.webworker.iterable.d.ts +6 -7
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/pl/diagnosticMessages.generated.json +30 -12
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/pt-br/diagnosticMessages.generated.json +30 -12
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/ru/diagnosticMessages.generated.json +30 -12
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/tr/diagnosticMessages.generated.json +30 -12
- package/node_modules/typescript/lib/tsc.js +8 -0
- package/node_modules/typescript/lib/tsserver.js +8 -0
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/typesMap.json +497 -497
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/typescript.d.ts +95 -24
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/typescript.js +6556 -3509
- package/node_modules/typescript/lib/typingsInstaller.js +8 -0
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/zh-cn/diagnosticMessages.generated.json +31 -13
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/zh-tw/diagnosticMessages.generated.json +30 -12
- package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/package.json +27 -28
- package/package.json +3 -3
- package/node_modules/@pinuts/form-builder/node_modules/typescript/lib/cancellationToken.js +0 -90
- package/node_modules/@types/prop-types/LICENSE +0 -21
- package/node_modules/@types/prop-types/README.md +0 -15
- package/node_modules/@types/prop-types/index.d.ts +0 -114
- package/node_modules/@types/prop-types/package.json +0 -35
- /package/node_modules/{regenerator-runtime → @babel/runtime/node_modules/regenerator-runtime}/LICENSE +0 -0
- /package/node_modules/{regenerator-runtime → @babel/runtime/node_modules/regenerator-runtime}/README.md +0 -0
- /package/node_modules/{regenerator-runtime → @babel/runtime/node_modules/regenerator-runtime}/package.json +0 -0
- /package/node_modules/{regenerator-runtime → @babel/runtime/node_modules/regenerator-runtime}/path.js +0 -0
- /package/node_modules/{regenerator-runtime → @babel/runtime/node_modules/regenerator-runtime}/runtime.js +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/LICENSE.txt +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/SECURITY.md +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/ThirdPartyNoticeText.txt +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/bin/tsc +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/bin/tsserver +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.decorators.legacy.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.dom.asynciterable.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2015.collection.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2015.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2015.generator.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2015.promise.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2015.proxy.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2015.reflect.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2015.symbol.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2016.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2016.full.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2017.date.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2017.full.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2017.intl.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2017.object.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2017.string.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2018.asyncgenerator.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2018.asynciterable.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2018.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2018.full.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2018.intl.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2018.promise.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2018.regexp.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2019.array.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2019.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2019.full.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2019.intl.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2019.object.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2019.string.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2019.symbol.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2020.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2020.date.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2020.full.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2020.number.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2020.promise.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2020.symbol.wellknown.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2021.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2021.full.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2021.promise.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2021.string.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2022.full.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2022.object.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2022.regexp.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2022.string.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2023.collection.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2023.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2023.full.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es2023.intl.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript/lib/lib.esnext.object.d.ts → typescript/lib/lib.es2024.object.d.ts} +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript/lib/lib.esnext.promise.d.ts → typescript/lib/lib.es2024.promise.d.ts} +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript/lib/lib.esnext.regexp.d.ts → typescript/lib/lib.es2024.regexp.d.ts} +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript/lib/lib.esnext.string.d.ts → typescript/lib/lib.es2024.string.d.ts} +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.es6.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.esnext.decorators.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.esnext.disposable.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.esnext.full.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.esnext.intl.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.scripthost.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.webworker.asynciterable.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/lib.webworker.importscripts.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/tsserverlibrary.d.ts +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/tsserverlibrary.js +0 -0
- /package/node_modules/{@pinuts/form-builder/node_modules/typescript → typescript}/lib/watchGuard.js +0 -0
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
/// <reference path="global.d.ts" />
|
|
6
6
|
|
|
7
7
|
import * as CSS from "csstype";
|
|
8
|
-
import * as PropTypes from "prop-types";
|
|
9
8
|
|
|
10
9
|
type NativeAnimationEvent = AnimationEvent;
|
|
11
10
|
type NativeClipboardEvent = ClipboardEvent;
|
|
@@ -16,6 +15,7 @@ type NativeKeyboardEvent = KeyboardEvent;
|
|
|
16
15
|
type NativeMouseEvent = MouseEvent;
|
|
17
16
|
type NativeTouchEvent = TouchEvent;
|
|
18
17
|
type NativePointerEvent = PointerEvent;
|
|
18
|
+
type NativeToggleEvent = ToggleEvent;
|
|
19
19
|
type NativeTransitionEvent = TransitionEvent;
|
|
20
20
|
type NativeUIEvent = UIEvent;
|
|
21
21
|
type NativeWheelEvent = WheelEvent;
|
|
@@ -33,6 +33,25 @@ 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
|
+
|
|
36
55
|
/**
|
|
37
56
|
* The function returned from an effect passed to {@link React.useEffect useEffect},
|
|
38
57
|
* which can be used to clean up the effect when the component unmounts.
|
|
@@ -93,8 +112,7 @@ declare namespace React {
|
|
|
93
112
|
* Represents any user-defined component, either as a function or a class.
|
|
94
113
|
*
|
|
95
114
|
* Similar to {@link JSXElementConstructor}, but with extra properties like
|
|
96
|
-
* {@link FunctionComponent.defaultProps defaultProps }
|
|
97
|
-
* {@link ComponentClass.contextTypes contextTypes}.
|
|
115
|
+
* {@link FunctionComponent.defaultProps defaultProps }.
|
|
98
116
|
*
|
|
99
117
|
* @template P The props the component accepts.
|
|
100
118
|
*
|
|
@@ -107,34 +125,18 @@ declare namespace React {
|
|
|
107
125
|
* Represents any user-defined component, either as a function or a class.
|
|
108
126
|
*
|
|
109
127
|
* Similar to {@link ComponentType}, but without extra properties like
|
|
110
|
-
* {@link FunctionComponent.defaultProps defaultProps }
|
|
111
|
-
* {@link ComponentClass.contextTypes contextTypes}.
|
|
128
|
+
* {@link FunctionComponent.defaultProps defaultProps }.
|
|
112
129
|
*
|
|
113
130
|
* @template P The props the component accepts.
|
|
114
131
|
*/
|
|
115
132
|
type JSXElementConstructor<P> =
|
|
116
133
|
| ((
|
|
117
134
|
props: P,
|
|
118
|
-
|
|
119
|
-
|
|
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>);
|
|
135
|
+
) => ReactNode | Promise<ReactNode>)
|
|
136
|
+
// constructor signature must match React.Component
|
|
137
|
+
| (new(props: P) => Component<any, any>);
|
|
134
138
|
|
|
135
139
|
/**
|
|
136
|
-
* A readonly ref container where {@link current} cannot be mutated.
|
|
137
|
-
*
|
|
138
140
|
* Created by {@link createRef}, or {@link useRef} when passed `null`.
|
|
139
141
|
*
|
|
140
142
|
* @template T The type of the ref's value.
|
|
@@ -151,7 +153,7 @@ declare namespace React {
|
|
|
151
153
|
/**
|
|
152
154
|
* The current value of the ref.
|
|
153
155
|
*/
|
|
154
|
-
|
|
156
|
+
current: T;
|
|
155
157
|
}
|
|
156
158
|
|
|
157
159
|
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES {
|
|
@@ -174,6 +176,7 @@ declare namespace React {
|
|
|
174
176
|
instance: T | null,
|
|
175
177
|
):
|
|
176
178
|
| void
|
|
179
|
+
| (() => VoidOrUndefinedOnly)
|
|
177
180
|
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[
|
|
178
181
|
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES
|
|
179
182
|
];
|
|
@@ -186,22 +189,15 @@ declare namespace React {
|
|
|
186
189
|
* @see {@link RefObject}
|
|
187
190
|
*/
|
|
188
191
|
|
|
189
|
-
type Ref<T> = RefCallback<T> | RefObject<T> | null;
|
|
192
|
+
type Ref<T> = RefCallback<T> | RefObject<T | null> | null;
|
|
190
193
|
/**
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
* @see {@link https://react.dev/reference/react/Component#refs React Docs}
|
|
194
|
-
*
|
|
195
|
-
* @example
|
|
196
|
-
*
|
|
197
|
-
* ```tsx
|
|
198
|
-
* <div ref="myRef" />
|
|
199
|
-
* ```
|
|
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.
|
|
200
196
|
*/
|
|
201
|
-
|
|
202
|
-
type LegacyRef<T> = string | Ref<T>;
|
|
203
|
-
|
|
197
|
+
type LegacyRef<T> = Ref<T>;
|
|
204
198
|
/**
|
|
199
|
+
* @deprecated Use `ComponentRef<T>` instead
|
|
200
|
+
*
|
|
205
201
|
* Retrieves the type of the 'ref' prop for a given component type or tag name.
|
|
206
202
|
*
|
|
207
203
|
* @template C The component type.
|
|
@@ -222,17 +218,9 @@ declare namespace React {
|
|
|
222
218
|
C extends
|
|
223
219
|
| ForwardRefExoticComponent<any>
|
|
224
220
|
| { new(props: any): Component<any> }
|
|
225
|
-
| ((props: any
|
|
221
|
+
| ((props: any) => ReactNode)
|
|
226
222
|
| keyof JSX.IntrinsicElements,
|
|
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;
|
|
223
|
+
> = ComponentRef<C>;
|
|
236
224
|
|
|
237
225
|
type ComponentState = any;
|
|
238
226
|
|
|
@@ -300,7 +288,7 @@ declare namespace React {
|
|
|
300
288
|
*
|
|
301
289
|
* @see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}
|
|
302
290
|
*/
|
|
303
|
-
ref?:
|
|
291
|
+
ref?: Ref<T> | undefined;
|
|
304
292
|
}
|
|
305
293
|
|
|
306
294
|
/**
|
|
@@ -325,7 +313,7 @@ declare namespace React {
|
|
|
325
313
|
* ```
|
|
326
314
|
*/
|
|
327
315
|
interface ReactElement<
|
|
328
|
-
P =
|
|
316
|
+
P = unknown,
|
|
329
317
|
T extends string | JSXElementConstructor<any> = string | JSXElementConstructor<any>,
|
|
330
318
|
> {
|
|
331
319
|
type: T;
|
|
@@ -341,13 +329,28 @@ declare namespace React {
|
|
|
341
329
|
P = Pick<ComponentProps<T>, Exclude<keyof ComponentProps<T>, "key" | "ref">>,
|
|
342
330
|
> extends ReactElement<P, Exclude<T, number>> {}
|
|
343
331
|
|
|
332
|
+
/**
|
|
333
|
+
* @deprecated Use `ReactElement<P, React.FunctionComponent<P>>`
|
|
334
|
+
*/
|
|
344
335
|
interface FunctionComponentElement<P> extends ReactElement<P, FunctionComponent<P>> {
|
|
336
|
+
/**
|
|
337
|
+
* @deprecated Use `element.props.ref` instead.
|
|
338
|
+
*/
|
|
345
339
|
ref?: ("ref" extends keyof P ? P extends { ref?: infer R | undefined } ? R : never : never) | undefined;
|
|
346
340
|
}
|
|
347
341
|
|
|
342
|
+
/**
|
|
343
|
+
* @deprecated Use `ReactElement<P, React.ComponentClass<P>>`
|
|
344
|
+
*/
|
|
348
345
|
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
|
-
|
|
350
|
+
/**
|
|
351
|
+
* @deprecated Use `element.props.ref` instead.
|
|
352
|
+
*/
|
|
353
|
+
ref?: Ref<T> | undefined;
|
|
351
354
|
}
|
|
352
355
|
|
|
353
356
|
/**
|
|
@@ -356,89 +359,34 @@ declare namespace React {
|
|
|
356
359
|
type ClassicElement<P> = CElement<P, ClassicComponent<P, ComponentState>>;
|
|
357
360
|
|
|
358
361
|
// string fallback for custom web-components
|
|
362
|
+
/**
|
|
363
|
+
* @deprecated Use `ReactElement<P, string>`
|
|
364
|
+
*/
|
|
359
365
|
interface DOMElement<P extends HTMLAttributes<T> | SVGAttributes<T>, T extends Element>
|
|
360
366
|
extends ReactElement<P, string>
|
|
361
367
|
{
|
|
362
|
-
|
|
368
|
+
/**
|
|
369
|
+
* @deprecated Use `element.props.ref` instead.
|
|
370
|
+
*/
|
|
371
|
+
ref: Ref<T>;
|
|
363
372
|
}
|
|
364
373
|
|
|
365
374
|
// ReactHTML for ReactHTMLElement
|
|
366
375
|
interface ReactHTMLElement<T extends HTMLElement> extends DetailedReactHTMLElement<AllHTMLAttributes<T>, T> {}
|
|
367
376
|
|
|
368
377
|
interface DetailedReactHTMLElement<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMElement<P, T> {
|
|
369
|
-
type:
|
|
378
|
+
type: HTMLElementType;
|
|
370
379
|
}
|
|
371
380
|
|
|
372
381
|
// ReactSVG for ReactSVGElement
|
|
373
382
|
interface ReactSVGElement extends DOMElement<SVGAttributes<SVGElement>, SVGElement> {
|
|
374
|
-
type:
|
|
383
|
+
type: SVGElementType;
|
|
375
384
|
}
|
|
376
385
|
|
|
377
386
|
interface ReactPortal extends ReactElement {
|
|
378
387
|
children: ReactNode;
|
|
379
388
|
}
|
|
380
389
|
|
|
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
|
-
|
|
442
390
|
/**
|
|
443
391
|
* Different release channels declare additional types of ReactNode this particular release channel accepts.
|
|
444
392
|
* App or library types should never augment this interface.
|
|
@@ -479,6 +427,7 @@ declare namespace React {
|
|
|
479
427
|
| ReactElement
|
|
480
428
|
| string
|
|
481
429
|
| number
|
|
430
|
+
| bigint
|
|
482
431
|
| Iterable<ReactNode>
|
|
483
432
|
| ReactPortal
|
|
484
433
|
| boolean
|
|
@@ -486,36 +435,13 @@ declare namespace React {
|
|
|
486
435
|
| undefined
|
|
487
436
|
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES[
|
|
488
437
|
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES
|
|
489
|
-
]
|
|
438
|
+
]
|
|
439
|
+
| Promise<AwaitedReactNode>;
|
|
490
440
|
|
|
491
441
|
//
|
|
492
442
|
// Top Level API
|
|
493
443
|
// ----------------------------------------------------------------------
|
|
494
444
|
|
|
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
|
-
|
|
519
445
|
// DOM Elements
|
|
520
446
|
// TODO: generalize this to everything in `keyof ReactHTML`, not just "input"
|
|
521
447
|
function createElement(
|
|
@@ -524,12 +450,12 @@ declare namespace React {
|
|
|
524
450
|
...children: ReactNode[]
|
|
525
451
|
): DetailedReactHTMLElement<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
526
452
|
function createElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
|
|
527
|
-
type:
|
|
453
|
+
type: HTMLElementType,
|
|
528
454
|
props?: ClassAttributes<T> & P | null,
|
|
529
455
|
...children: ReactNode[]
|
|
530
456
|
): DetailedReactHTMLElement<P, T>;
|
|
531
457
|
function createElement<P extends SVGAttributes<T>, T extends SVGElement>(
|
|
532
|
-
type:
|
|
458
|
+
type: SVGElementType,
|
|
533
459
|
props?: ClassAttributes<T> & P | null,
|
|
534
460
|
...children: ReactNode[]
|
|
535
461
|
): ReactSVGElement;
|
|
@@ -658,7 +584,6 @@ declare namespace React {
|
|
|
658
584
|
* @template P The props the component accepts.
|
|
659
585
|
*/
|
|
660
586
|
interface ProviderExoticComponent<P> extends ExoticComponent<P> {
|
|
661
|
-
propTypes?: WeakValidationMap<P> | undefined;
|
|
662
587
|
}
|
|
663
588
|
|
|
664
589
|
/**
|
|
@@ -740,7 +665,7 @@ declare namespace React {
|
|
|
740
665
|
* const ThemeContext = createContext('light');
|
|
741
666
|
* ```
|
|
742
667
|
*/
|
|
743
|
-
interface Context<T> {
|
|
668
|
+
interface Context<T> extends Provider<T> {
|
|
744
669
|
Provider: Provider<T>;
|
|
745
670
|
Consumer: Consumer<T>;
|
|
746
671
|
/**
|
|
@@ -769,6 +694,13 @@ declare namespace React {
|
|
|
769
694
|
* import { createContext } from 'react';
|
|
770
695
|
*
|
|
771
696
|
* const ThemeContext = createContext('light');
|
|
697
|
+
* function App() {
|
|
698
|
+
* return (
|
|
699
|
+
* <ThemeContext value="dark">
|
|
700
|
+
* <Toolbar />
|
|
701
|
+
* </ThemeContext>
|
|
702
|
+
* );
|
|
703
|
+
* }
|
|
772
704
|
* ```
|
|
773
705
|
*/
|
|
774
706
|
function createContext<T>(
|
|
@@ -779,9 +711,6 @@ declare namespace React {
|
|
|
779
711
|
|
|
780
712
|
function isValidElement<P>(object: {} | null | undefined): object is ReactElement<P>;
|
|
781
713
|
|
|
782
|
-
/**
|
|
783
|
-
* Maintainer's note: Sync with {@link ReactChildren} until {@link ReactChildren} is removed.
|
|
784
|
-
*/
|
|
785
714
|
const Children: {
|
|
786
715
|
map<T, C>(
|
|
787
716
|
children: C | readonly C[],
|
|
@@ -792,6 +721,10 @@ declare namespace React {
|
|
|
792
721
|
only<C>(children: C): C extends any[] ? never : C;
|
|
793
722
|
toArray(children: ReactNode | ReactNode[]): Array<Exclude<ReactNode, boolean | null | undefined>>;
|
|
794
723
|
};
|
|
724
|
+
|
|
725
|
+
export interface FragmentProps {
|
|
726
|
+
children?: React.ReactNode;
|
|
727
|
+
}
|
|
795
728
|
/**
|
|
796
729
|
* Lets you group elements without a wrapper node.
|
|
797
730
|
*
|
|
@@ -819,7 +752,7 @@ declare namespace React {
|
|
|
819
752
|
* </>
|
|
820
753
|
* ```
|
|
821
754
|
*/
|
|
822
|
-
const Fragment: ExoticComponent<
|
|
755
|
+
const Fragment: ExoticComponent<FragmentProps>;
|
|
823
756
|
|
|
824
757
|
/**
|
|
825
758
|
* Lets you find common bugs in your components early during development.
|
|
@@ -987,6 +920,12 @@ declare namespace React {
|
|
|
987
920
|
*/
|
|
988
921
|
static contextType?: Context<any> | undefined;
|
|
989
922
|
|
|
923
|
+
/**
|
|
924
|
+
* Ignored by React.
|
|
925
|
+
* @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release.
|
|
926
|
+
*/
|
|
927
|
+
static propTypes?: any;
|
|
928
|
+
|
|
990
929
|
/**
|
|
991
930
|
* If using the new style context, re-declare this in your class to be the
|
|
992
931
|
* `React.ContextType` of your `static contextType`.
|
|
@@ -1005,12 +944,8 @@ declare namespace React {
|
|
|
1005
944
|
*/
|
|
1006
945
|
context: unknown;
|
|
1007
946
|
|
|
947
|
+
// Keep in sync with constructor signature of JSXElementConstructor and ComponentClass.
|
|
1008
948
|
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);
|
|
1014
949
|
|
|
1015
950
|
// We MUST keep setState() as a unified signature because it allows proper checking of the method return type.
|
|
1016
951
|
// See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257
|
|
@@ -1025,14 +960,6 @@ declare namespace React {
|
|
|
1025
960
|
|
|
1026
961
|
readonly props: Readonly<P>;
|
|
1027
962
|
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
|
-
};
|
|
1036
963
|
}
|
|
1037
964
|
|
|
1038
965
|
class PureComponent<P = {}, S = {}, SS = any> extends Component<P, S, SS> {}
|
|
@@ -1049,10 +976,6 @@ declare namespace React {
|
|
|
1049
976
|
getInitialState?(): S;
|
|
1050
977
|
}
|
|
1051
978
|
|
|
1052
|
-
interface ChildContextProvider<CC> {
|
|
1053
|
-
getChildContext(): CC;
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
979
|
//
|
|
1057
980
|
// Class Interfaces
|
|
1058
981
|
// ----------------------------------------------------------------------
|
|
@@ -1117,58 +1040,12 @@ declare namespace React {
|
|
|
1117
1040
|
* ```
|
|
1118
1041
|
*/
|
|
1119
1042
|
interface FunctionComponent<P = {}> {
|
|
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;
|
|
1043
|
+
(props: P): ReactNode | Promise<ReactNode>;
|
|
1129
1044
|
/**
|
|
1130
|
-
*
|
|
1131
|
-
*
|
|
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}
|
|
1045
|
+
* Ignored by React.
|
|
1046
|
+
* @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release.
|
|
1138
1047
|
*/
|
|
1139
|
-
propTypes?:
|
|
1140
|
-
/**
|
|
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}
|
|
1147
|
-
*/
|
|
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;
|
|
1048
|
+
propTypes?: any;
|
|
1172
1049
|
/**
|
|
1173
1050
|
* Used in debugging messages. You might want to set it
|
|
1174
1051
|
* explicitly if you want to display a different name for
|
|
@@ -1190,44 +1067,14 @@ declare namespace React {
|
|
|
1190
1067
|
displayName?: string | undefined;
|
|
1191
1068
|
}
|
|
1192
1069
|
|
|
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
|
-
|
|
1225
1070
|
/**
|
|
1226
1071
|
* The type of the ref received by a {@link ForwardRefRenderFunction}.
|
|
1227
1072
|
*
|
|
1228
1073
|
* @see {@link ForwardRefRenderFunction}
|
|
1229
1074
|
*/
|
|
1230
|
-
|
|
1075
|
+
// Making T nullable is assuming the refs will be managed by React or the component impl will write it somewhere else.
|
|
1076
|
+
// But this isn't necessarily true. We haven't heard complains about it yet and hopefully `forwardRef` is removed from React before we do.
|
|
1077
|
+
type ForwardedRef<T> = ((instance: T | null) => void) | RefObject<T | null> | null;
|
|
1231
1078
|
|
|
1232
1079
|
/**
|
|
1233
1080
|
* The type of the function passed to {@link forwardRef}. This is considered different
|
|
@@ -1256,19 +1103,10 @@ declare namespace React {
|
|
|
1256
1103
|
*/
|
|
1257
1104
|
displayName?: string | undefined;
|
|
1258
1105
|
/**
|
|
1259
|
-
*
|
|
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}
|
|
1263
|
-
*/
|
|
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}
|
|
1106
|
+
* Ignored by React.
|
|
1107
|
+
* @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release.
|
|
1270
1108
|
*/
|
|
1271
|
-
propTypes?:
|
|
1109
|
+
propTypes?: any;
|
|
1272
1110
|
}
|
|
1273
1111
|
|
|
1274
1112
|
/**
|
|
@@ -1278,48 +1116,14 @@ declare namespace React {
|
|
|
1278
1116
|
* @template S The internal state of the component.
|
|
1279
1117
|
*/
|
|
1280
1118
|
interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
|
|
1281
|
-
|
|
1282
|
-
|
|
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>;
|
|
1119
|
+
// constructor signature must match React.Component
|
|
1120
|
+
new(props: P): Component<P, S>;
|
|
1290
1121
|
/**
|
|
1291
|
-
*
|
|
1292
|
-
*
|
|
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}
|
|
1122
|
+
* Ignored by React.
|
|
1123
|
+
* @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release.
|
|
1299
1124
|
*/
|
|
1300
|
-
propTypes?:
|
|
1125
|
+
propTypes?: any;
|
|
1301
1126
|
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
|
-
*/
|
|
1323
1127
|
defaultProps?: Partial<P> | undefined;
|
|
1324
1128
|
/**
|
|
1325
1129
|
* Used in debugging messages. You might want to set it
|
|
@@ -1338,7 +1142,7 @@ declare namespace React {
|
|
|
1338
1142
|
* @see {@link https://www.npmjs.com/package/create-react-class `create-react-class` on npm}
|
|
1339
1143
|
*/
|
|
1340
1144
|
interface ClassicComponentClass<P = {}> extends ComponentClass<P> {
|
|
1341
|
-
new(props: P
|
|
1145
|
+
new(props: P): ClassicComponent<P, ComponentState>;
|
|
1342
1146
|
getDefaultProps?(): P;
|
|
1343
1147
|
}
|
|
1344
1148
|
|
|
@@ -1353,7 +1157,7 @@ declare namespace React {
|
|
|
1353
1157
|
*/
|
|
1354
1158
|
type ClassType<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>> =
|
|
1355
1159
|
& C
|
|
1356
|
-
& (new(props: P
|
|
1160
|
+
& (new(props: P) => T);
|
|
1357
1161
|
|
|
1358
1162
|
//
|
|
1359
1163
|
// Component Specs and Lifecycle
|
|
@@ -1527,38 +1331,7 @@ declare namespace React {
|
|
|
1527
1331
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void;
|
|
1528
1332
|
}
|
|
1529
1333
|
|
|
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;
|
|
1548
|
-
}
|
|
1549
|
-
|
|
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>;
|
|
1334
|
+
function createRef<T>(): RefObject<T | null>;
|
|
1562
1335
|
|
|
1563
1336
|
/**
|
|
1564
1337
|
* The type of the component returned from {@link forwardRef}.
|
|
@@ -1569,10 +1342,10 @@ declare namespace React {
|
|
|
1569
1342
|
*/
|
|
1570
1343
|
interface ForwardRefExoticComponent<P> extends NamedExoticComponent<P> {
|
|
1571
1344
|
/**
|
|
1572
|
-
*
|
|
1345
|
+
* Ignored by React.
|
|
1346
|
+
* @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release.
|
|
1573
1347
|
*/
|
|
1574
|
-
|
|
1575
|
-
propTypes?: WeakValidationMap<P> | undefined;
|
|
1348
|
+
propTypes?: any;
|
|
1576
1349
|
}
|
|
1577
1350
|
|
|
1578
1351
|
/**
|
|
@@ -1609,23 +1382,18 @@ declare namespace React {
|
|
|
1609
1382
|
/**
|
|
1610
1383
|
* Omits the 'ref' attribute from the given props object.
|
|
1611
1384
|
*
|
|
1612
|
-
* @template
|
|
1385
|
+
* @template Props The props object type.
|
|
1613
1386
|
*/
|
|
1614
|
-
type PropsWithoutRef<
|
|
1387
|
+
type PropsWithoutRef<Props> =
|
|
1615
1388
|
// Omit would not be sufficient for this. We'd like to avoid unnecessary mapping and need a distributive conditional to support unions.
|
|
1616
1389
|
// see: https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types
|
|
1617
1390
|
// https://github.com/Microsoft/TypeScript/issues/28339
|
|
1618
|
-
|
|
1619
|
-
/**
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
? P extends { ref?: infer R | undefined }
|
|
1625
|
-
? string extends R ? PropsWithoutRef<P> & { ref?: Exclude<R, string> | undefined }
|
|
1626
|
-
: P
|
|
1627
|
-
: P
|
|
1628
|
-
: P;
|
|
1391
|
+
Props extends any ? ("ref" extends keyof Props ? Omit<Props, "ref"> : Props) : Props;
|
|
1392
|
+
/**
|
|
1393
|
+
* Ensures that the props do not include string ref, which cannot be forwarded
|
|
1394
|
+
* @deprecated Use `Props` directly. `PropsWithRef<Props>` is just an alias for `Props`
|
|
1395
|
+
*/
|
|
1396
|
+
type PropsWithRef<Props> = Props;
|
|
1629
1397
|
|
|
1630
1398
|
type PropsWithChildren<P = unknown> = P & { children?: ReactNode | undefined };
|
|
1631
1399
|
|
|
@@ -1657,7 +1425,7 @@ declare namespace React {
|
|
|
1657
1425
|
* ```
|
|
1658
1426
|
*/
|
|
1659
1427
|
type ComponentProps<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = T extends
|
|
1660
|
-
JSXElementConstructor<infer
|
|
1428
|
+
JSXElementConstructor<infer Props> ? Props
|
|
1661
1429
|
: T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T]
|
|
1662
1430
|
: {};
|
|
1663
1431
|
|
|
@@ -1684,9 +1452,11 @@ declare namespace React {
|
|
|
1684
1452
|
* type MyComponentPropsWithRef = React.ComponentPropsWithRef<typeof MyComponent>;
|
|
1685
1453
|
* ```
|
|
1686
1454
|
*/
|
|
1687
|
-
type ComponentPropsWithRef<T extends ElementType> = T extends
|
|
1688
|
-
|
|
1689
|
-
:
|
|
1455
|
+
type ComponentPropsWithRef<T extends ElementType> = T extends JSXElementConstructor<infer Props>
|
|
1456
|
+
// If it's a class i.e. newable we're dealing with a class component
|
|
1457
|
+
? T extends abstract new(args: any) => any ? PropsWithoutRef<Props> & RefAttributes<InstanceType<T>>
|
|
1458
|
+
: Props
|
|
1459
|
+
: ComponentProps<T>;
|
|
1690
1460
|
/**
|
|
1691
1461
|
* Used to retrieve the props a custom component accepts with its ref.
|
|
1692
1462
|
*
|
|
@@ -1703,9 +1473,10 @@ declare namespace React {
|
|
|
1703
1473
|
* type MyComponentPropsWithRef = React.CustomComponentPropsWithRef<typeof MyComponent>;
|
|
1704
1474
|
* ```
|
|
1705
1475
|
*/
|
|
1706
|
-
type CustomComponentPropsWithRef<T extends ComponentType> = T extends
|
|
1707
|
-
|
|
1708
|
-
|
|
1476
|
+
type CustomComponentPropsWithRef<T extends ComponentType> = T extends JSXElementConstructor<infer Props>
|
|
1477
|
+
// If it's a class i.e. newable we're dealing with a class component
|
|
1478
|
+
? T extends abstract new(args: any) => any ? PropsWithoutRef<Props> & RefAttributes<InstanceType<T>>
|
|
1479
|
+
: Props
|
|
1709
1480
|
: never;
|
|
1710
1481
|
|
|
1711
1482
|
/**
|
|
@@ -1733,10 +1504,24 @@ declare namespace React {
|
|
|
1733
1504
|
*/
|
|
1734
1505
|
type ComponentPropsWithoutRef<T extends ElementType> = PropsWithoutRef<ComponentProps<T>>;
|
|
1735
1506
|
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1507
|
+
/**
|
|
1508
|
+
* Retrieves the type of the 'ref' prop for a given component type or tag name.
|
|
1509
|
+
*
|
|
1510
|
+
* @template C The component type.
|
|
1511
|
+
*
|
|
1512
|
+
* @example
|
|
1513
|
+
*
|
|
1514
|
+
* ```tsx
|
|
1515
|
+
* type MyComponentRef = React.ComponentRef<typeof MyComponent>;
|
|
1516
|
+
* ```
|
|
1517
|
+
*
|
|
1518
|
+
* @example
|
|
1519
|
+
*
|
|
1520
|
+
* ```tsx
|
|
1521
|
+
* type DivRef = React.ComponentRef<'div'>;
|
|
1522
|
+
* ```
|
|
1523
|
+
*/
|
|
1524
|
+
type ComponentRef<T extends ElementType> = ComponentPropsWithRef<T> extends RefAttributes<infer Method> ? Method
|
|
1740
1525
|
: never;
|
|
1741
1526
|
|
|
1742
1527
|
// will show `Memo(${Component.displayName || Component.name})` in devtools by default,
|
|
@@ -1837,6 +1622,11 @@ declare namespace React {
|
|
|
1837
1622
|
* A {@link Dispatch} function can sometimes be called without any arguments.
|
|
1838
1623
|
*/
|
|
1839
1624
|
type DispatchWithoutAction = () => void;
|
|
1625
|
+
// Limit the reducer to accept only 0 or 1 action arguments
|
|
1626
|
+
// eslint-disable-next-line @definitelytyped/no-single-element-tuple-type
|
|
1627
|
+
type AnyActionArg = [] | [any];
|
|
1628
|
+
// Get the dispatch type from the reducer arguments (captures optional action argument correctly)
|
|
1629
|
+
type ActionDispatch<ActionArg extends AnyActionArg> = (...args: ActionArg) => void;
|
|
1840
1630
|
// Unlike redux, the actions _can_ be anything
|
|
1841
1631
|
type Reducer<S, A> = (prevState: S, action: A) => S;
|
|
1842
1632
|
// If useReducer accepts a reducer without action, dispatch may be called without any parameters.
|
|
@@ -1844,15 +1634,14 @@ declare namespace React {
|
|
|
1844
1634
|
// types used to try and prevent the compiler from reducing S
|
|
1845
1635
|
// to a supertype common with the second argument to useReducer()
|
|
1846
1636
|
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;
|
|
1851
1637
|
type DependencyList = readonly unknown[];
|
|
1852
1638
|
|
|
1853
1639
|
// NOTE: callbacks are _only_ allowed to return either void, or a destructor.
|
|
1854
1640
|
type EffectCallback = () => void | Destructor;
|
|
1855
1641
|
|
|
1642
|
+
/**
|
|
1643
|
+
* @deprecated Use `RefObject` instead.
|
|
1644
|
+
*/
|
|
1856
1645
|
interface MutableRefObject<T> {
|
|
1857
1646
|
current: T;
|
|
1858
1647
|
}
|
|
@@ -1891,28 +1680,10 @@ declare namespace React {
|
|
|
1891
1680
|
* @version 16.8.0
|
|
1892
1681
|
* @see {@link https://react.dev/reference/react/useReducer}
|
|
1893
1682
|
*/
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
initializer: (arg: I) => ReducerStateWithoutAction<R>,
|
|
1899
|
-
): [ReducerStateWithoutAction<R>, DispatchWithoutAction];
|
|
1900
|
-
/**
|
|
1901
|
-
* An alternative to `useState`.
|
|
1902
|
-
*
|
|
1903
|
-
* `useReducer` is usually preferable to `useState` when you have complex state logic that involves
|
|
1904
|
-
* multiple sub-values. It also lets you optimize performance for components that trigger deep
|
|
1905
|
-
* updates because you can pass `dispatch` down instead of callbacks.
|
|
1906
|
-
*
|
|
1907
|
-
* @version 16.8.0
|
|
1908
|
-
* @see {@link https://react.dev/reference/react/useReducer}
|
|
1909
|
-
*/
|
|
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];
|
|
1683
|
+
function useReducer<S, A extends AnyActionArg>(
|
|
1684
|
+
reducer: (prevState: S, ...args: A) => S,
|
|
1685
|
+
initialState: S,
|
|
1686
|
+
): [S, ActionDispatch<A>];
|
|
1916
1687
|
/**
|
|
1917
1688
|
* An alternative to `useState`.
|
|
1918
1689
|
*
|
|
@@ -1923,14 +1694,10 @@ declare namespace React {
|
|
|
1923
1694
|
* @version 16.8.0
|
|
1924
1695
|
* @see {@link https://react.dev/reference/react/useReducer}
|
|
1925
1696
|
*/
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
reducer: R,
|
|
1931
|
-
initializerArg: I & ReducerState<R>,
|
|
1932
|
-
initializer: (arg: I & ReducerState<R>) => ReducerState<R>,
|
|
1933
|
-
): [ReducerState<R>, Dispatch<ReducerAction<R>>];
|
|
1697
|
+
function useReducer<S, A extends AnyActionArg>(
|
|
1698
|
+
reducer: (prevState: S, ...args: A) => S,
|
|
1699
|
+
initialState: S,
|
|
1700
|
+
): [S, ActionDispatch<A>];
|
|
1934
1701
|
/**
|
|
1935
1702
|
* An alternative to `useState`.
|
|
1936
1703
|
*
|
|
@@ -1941,37 +1708,11 @@ declare namespace React {
|
|
|
1941
1708
|
* @version 16.8.0
|
|
1942
1709
|
* @see {@link https://react.dev/reference/react/useReducer}
|
|
1943
1710
|
*/
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
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>>];
|
|
1711
|
+
function useReducer<S, I, A extends AnyActionArg>(
|
|
1712
|
+
reducer: (prevState: S, ...args: A) => S,
|
|
1713
|
+
initialArg: I,
|
|
1714
|
+
init: (i: I) => S,
|
|
1715
|
+
): [S, ActionDispatch<A>];
|
|
1975
1716
|
/**
|
|
1976
1717
|
* `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument
|
|
1977
1718
|
* (`initialValue`). The returned object will persist for the full lifetime of the component.
|
|
@@ -1982,7 +1723,7 @@ declare namespace React {
|
|
|
1982
1723
|
* @version 16.8.0
|
|
1983
1724
|
* @see {@link https://react.dev/reference/react/useRef}
|
|
1984
1725
|
*/
|
|
1985
|
-
function useRef<T>(initialValue: T):
|
|
1726
|
+
function useRef<T>(initialValue: T): RefObject<T>;
|
|
1986
1727
|
// convenience overload for refs given as a ref prop as they typically start with a null value
|
|
1987
1728
|
/**
|
|
1988
1729
|
* `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument
|
|
@@ -1991,15 +1732,11 @@ declare namespace React {
|
|
|
1991
1732
|
* Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable
|
|
1992
1733
|
* value around similar to how you’d use instance fields in classes.
|
|
1993
1734
|
*
|
|
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
|
-
*
|
|
1997
1735
|
* @version 16.8.0
|
|
1998
1736
|
* @see {@link https://react.dev/reference/react/useRef}
|
|
1999
1737
|
*/
|
|
2000
|
-
function useRef<T>(initialValue: T | null): RefObject<T>;
|
|
2001
|
-
// convenience overload for
|
|
2002
|
-
// has a default to stop it from defaulting to {} instead
|
|
1738
|
+
function useRef<T>(initialValue: T | null): RefObject<T | null>;
|
|
1739
|
+
// convenience overload for undefined initialValue
|
|
2003
1740
|
/**
|
|
2004
1741
|
* `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument
|
|
2005
1742
|
* (`initialValue`). The returned object will persist for the full lifetime of the component.
|
|
@@ -2010,7 +1747,7 @@ declare namespace React {
|
|
|
2010
1747
|
* @version 16.8.0
|
|
2011
1748
|
* @see {@link https://react.dev/reference/react/useRef}
|
|
2012
1749
|
*/
|
|
2013
|
-
function useRef<T
|
|
1750
|
+
function useRef<T>(initialValue: T | undefined): RefObject<T | undefined>;
|
|
2014
1751
|
/**
|
|
2015
1752
|
* The signature is identical to `useEffect`, but it fires synchronously after all DOM mutations.
|
|
2016
1753
|
* Use this to read layout from the DOM and synchronously re-render. Updates scheduled inside
|
|
@@ -2057,7 +1794,7 @@ declare namespace React {
|
|
|
2057
1794
|
*/
|
|
2058
1795
|
// A specific function type would not trigger implicit any.
|
|
2059
1796
|
// See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/52873#issuecomment-845806435 for a comparison between `Function` and more specific types.
|
|
2060
|
-
// eslint-disable-next-line @typescript-eslint/
|
|
1797
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
2061
1798
|
function useCallback<T extends Function>(callback: T, deps: DependencyList): T;
|
|
2062
1799
|
/**
|
|
2063
1800
|
* `useMemo` will only recompute the memoized value when one of the `deps` has changed.
|
|
@@ -2080,8 +1817,7 @@ declare namespace React {
|
|
|
2080
1817
|
// it's just the function name without the "use" prefix.
|
|
2081
1818
|
function useDebugValue<T>(value: T, format?: (value: T) => any): void;
|
|
2082
1819
|
|
|
2083
|
-
|
|
2084
|
-
export type TransitionFunction = () => VoidOrUndefinedOnly;
|
|
1820
|
+
export type TransitionFunction = () => VoidOrUndefinedOnly | Promise<VoidOrUndefinedOnly>;
|
|
2085
1821
|
// strange definition to allow vscode to show documentation on the invocation
|
|
2086
1822
|
export interface TransitionStartFunction {
|
|
2087
1823
|
/**
|
|
@@ -2089,7 +1825,7 @@ declare namespace React {
|
|
|
2089
1825
|
*
|
|
2090
1826
|
* **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
|
|
2091
1827
|
*
|
|
2092
|
-
* @param callback A
|
|
1828
|
+
* @param callback A function which causes state updates that can be deferred.
|
|
2093
1829
|
*/
|
|
2094
1830
|
(callback: TransitionFunction): void;
|
|
2095
1831
|
}
|
|
@@ -2103,10 +1839,11 @@ declare namespace React {
|
|
|
2103
1839
|
* A good example of this is a text input.
|
|
2104
1840
|
*
|
|
2105
1841
|
* @param value The value that is going to be deferred
|
|
1842
|
+
* @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.
|
|
2106
1843
|
*
|
|
2107
1844
|
* @see {@link https://react.dev/reference/react/useDeferredValue}
|
|
2108
1845
|
*/
|
|
2109
|
-
export function useDeferredValue<T>(value: T): T;
|
|
1846
|
+
export function useDeferredValue<T>(value: T, initialValue?: T): T;
|
|
2110
1847
|
|
|
2111
1848
|
/**
|
|
2112
1849
|
* Allows components to avoid undesirable loading states by waiting for content to load
|
|
@@ -2128,7 +1865,7 @@ declare namespace React {
|
|
|
2128
1865
|
/**
|
|
2129
1866
|
* Similar to `useTransition` but allows uses where hooks are not available.
|
|
2130
1867
|
*
|
|
2131
|
-
* @param callback A
|
|
1868
|
+
* @param callback A function which causes state updates that can be deferred.
|
|
2132
1869
|
*/
|
|
2133
1870
|
export function startTransition(scope: TransitionFunction): void;
|
|
2134
1871
|
|
|
@@ -2143,6 +1880,11 @@ declare namespace React {
|
|
|
2143
1880
|
*
|
|
2144
1881
|
* @see https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks
|
|
2145
1882
|
*/
|
|
1883
|
+
// NOTES
|
|
1884
|
+
// - the order of these signatures matters - typescript will check the signatures in source order.
|
|
1885
|
+
// If the `() => VoidOrUndefinedOnly` signature is first, it'll erroneously match a Promise returning function for users with
|
|
1886
|
+
// `strictNullChecks: false`.
|
|
1887
|
+
// - VoidOrUndefinedOnly is there to forbid any non-void return values for users with `strictNullChecks: true`
|
|
2146
1888
|
// 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.
|
|
2147
1889
|
export function act(callback: () => VoidOrUndefinedOnly): void;
|
|
2148
1890
|
export function act<T>(callback: () => T | Promise<T>): Promise<T>;
|
|
@@ -2170,6 +1912,39 @@ declare namespace React {
|
|
|
2170
1912
|
getServerSnapshot?: () => Snapshot,
|
|
2171
1913
|
): Snapshot;
|
|
2172
1914
|
|
|
1915
|
+
export function useOptimistic<State>(
|
|
1916
|
+
passthrough: State,
|
|
1917
|
+
): [State, (action: State | ((pendingState: State) => State)) => void];
|
|
1918
|
+
export function useOptimistic<State, Action>(
|
|
1919
|
+
passthrough: State,
|
|
1920
|
+
reducer: (state: State, action: Action) => State,
|
|
1921
|
+
): [State, (action: Action) => void];
|
|
1922
|
+
|
|
1923
|
+
export type Usable<T> = PromiseLike<T> | Context<T>;
|
|
1924
|
+
|
|
1925
|
+
export function use<T>(usable: Usable<T>): T;
|
|
1926
|
+
|
|
1927
|
+
export function useActionState<State>(
|
|
1928
|
+
action: (state: Awaited<State>) => State | Promise<State>,
|
|
1929
|
+
initialState: Awaited<State>,
|
|
1930
|
+
permalink?: string,
|
|
1931
|
+
): [state: Awaited<State>, dispatch: () => void, isPending: boolean];
|
|
1932
|
+
export function useActionState<State, Payload>(
|
|
1933
|
+
action: (state: Awaited<State>, payload: Payload) => State | Promise<State>,
|
|
1934
|
+
initialState: Awaited<State>,
|
|
1935
|
+
permalink?: string,
|
|
1936
|
+
): [state: Awaited<State>, dispatch: (payload: Payload) => void, isPending: boolean];
|
|
1937
|
+
|
|
1938
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
1939
|
+
export function cache<CachedFunction extends Function>(fn: CachedFunction): CachedFunction;
|
|
1940
|
+
|
|
1941
|
+
/**
|
|
1942
|
+
* Warning: Only available in development builds.
|
|
1943
|
+
*
|
|
1944
|
+
* @see {@link https://react.dev/reference/react/captureOwnerStack Reference docs}
|
|
1945
|
+
*/
|
|
1946
|
+
function captureOwnerStack(): string | null;
|
|
1947
|
+
|
|
2173
1948
|
//
|
|
2174
1949
|
// Event System
|
|
2175
1950
|
// ----------------------------------------------------------------------
|
|
@@ -2337,6 +2112,11 @@ declare namespace React {
|
|
|
2337
2112
|
pseudoElement: string;
|
|
2338
2113
|
}
|
|
2339
2114
|
|
|
2115
|
+
interface ToggleEvent<T = Element> extends SyntheticEvent<T, NativeToggleEvent> {
|
|
2116
|
+
oldState: "closed" | "open";
|
|
2117
|
+
newState: "closed" | "open";
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2340
2120
|
interface TransitionEvent<T = Element> extends SyntheticEvent<T, NativeTransitionEvent> {
|
|
2341
2121
|
elapsedTime: number;
|
|
2342
2122
|
propertyName: string;
|
|
@@ -2364,6 +2144,7 @@ declare namespace React {
|
|
|
2364
2144
|
type UIEventHandler<T = Element> = EventHandler<UIEvent<T>>;
|
|
2365
2145
|
type WheelEventHandler<T = Element> = EventHandler<WheelEvent<T>>;
|
|
2366
2146
|
type AnimationEventHandler<T = Element> = EventHandler<AnimationEvent<T>>;
|
|
2147
|
+
type ToggleEventHandler<T = Element> = EventHandler<ToggleEvent<T>>;
|
|
2367
2148
|
type TransitionEventHandler<T = Element> = EventHandler<TransitionEvent<T>>;
|
|
2368
2149
|
|
|
2369
2150
|
//
|
|
@@ -2564,6 +2345,8 @@ declare namespace React {
|
|
|
2564
2345
|
// UI Events
|
|
2565
2346
|
onScroll?: UIEventHandler<T> | undefined;
|
|
2566
2347
|
onScrollCapture?: UIEventHandler<T> | undefined;
|
|
2348
|
+
onScrollEnd?: UIEventHandler<T> | undefined;
|
|
2349
|
+
onScrollEndCapture?: UIEventHandler<T> | undefined;
|
|
2567
2350
|
|
|
2568
2351
|
// Wheel Events
|
|
2569
2352
|
onWheel?: WheelEventHandler<T> | undefined;
|
|
@@ -2577,9 +2360,19 @@ declare namespace React {
|
|
|
2577
2360
|
onAnimationIteration?: AnimationEventHandler<T> | undefined;
|
|
2578
2361
|
onAnimationIterationCapture?: AnimationEventHandler<T> | undefined;
|
|
2579
2362
|
|
|
2363
|
+
// Toggle Events
|
|
2364
|
+
onToggle?: ToggleEventHandler<T> | undefined;
|
|
2365
|
+
onBeforeToggle?: ToggleEventHandler<T> | undefined;
|
|
2366
|
+
|
|
2580
2367
|
// Transition Events
|
|
2368
|
+
onTransitionCancel?: TransitionEventHandler<T> | undefined;
|
|
2369
|
+
onTransitionCancelCapture?: TransitionEventHandler<T> | undefined;
|
|
2581
2370
|
onTransitionEnd?: TransitionEventHandler<T> | undefined;
|
|
2582
2371
|
onTransitionEndCapture?: TransitionEventHandler<T> | undefined;
|
|
2372
|
+
onTransitionRun?: TransitionEventHandler<T> | undefined;
|
|
2373
|
+
onTransitionRunCapture?: TransitionEventHandler<T> | undefined;
|
|
2374
|
+
onTransitionStart?: TransitionEventHandler<T> | undefined;
|
|
2375
|
+
onTransitionStartCapture?: TransitionEventHandler<T> | undefined;
|
|
2583
2376
|
}
|
|
2584
2377
|
|
|
2585
2378
|
export interface CSSProperties extends CSS.Properties<string | number> {
|
|
@@ -2899,6 +2692,7 @@ declare namespace React {
|
|
|
2899
2692
|
|
|
2900
2693
|
// Standard HTML Attributes
|
|
2901
2694
|
accessKey?: string | undefined;
|
|
2695
|
+
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
|
|
2902
2696
|
autoFocus?: boolean | undefined;
|
|
2903
2697
|
className?: string | undefined;
|
|
2904
2698
|
contentEditable?: Booleanish | "inherit" | "plaintext-only" | undefined;
|
|
@@ -2937,7 +2731,6 @@ declare namespace React {
|
|
|
2937
2731
|
vocab?: string | undefined;
|
|
2938
2732
|
|
|
2939
2733
|
// Non-standard Attributes
|
|
2940
|
-
autoCapitalize?: string | undefined;
|
|
2941
2734
|
autoCorrect?: string | undefined;
|
|
2942
2735
|
autoSave?: string | undefined;
|
|
2943
2736
|
color?: string | undefined;
|
|
@@ -2950,7 +2743,16 @@ declare namespace React {
|
|
|
2950
2743
|
security?: string | undefined;
|
|
2951
2744
|
unselectable?: "on" | "off" | undefined;
|
|
2952
2745
|
|
|
2746
|
+
// Popover API
|
|
2747
|
+
popover?: "" | "auto" | "manual" | undefined;
|
|
2748
|
+
popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
|
|
2749
|
+
popoverTarget?: string | undefined;
|
|
2750
|
+
|
|
2953
2751
|
// Living Standard
|
|
2752
|
+
/**
|
|
2753
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert
|
|
2754
|
+
*/
|
|
2755
|
+
inert?: boolean | undefined;
|
|
2954
2756
|
/**
|
|
2955
2757
|
* Hints at the type of data that might be entered by the user while editing the element or its contents
|
|
2956
2758
|
* @see {@link https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute}
|
|
@@ -2961,6 +2763,14 @@ declare namespace React {
|
|
|
2961
2763
|
* @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is}
|
|
2962
2764
|
*/
|
|
2963
2765
|
is?: string | undefined;
|
|
2766
|
+
/**
|
|
2767
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/exportparts}
|
|
2768
|
+
*/
|
|
2769
|
+
exportparts?: string | undefined;
|
|
2770
|
+
/**
|
|
2771
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/part}
|
|
2772
|
+
*/
|
|
2773
|
+
part?: string | undefined;
|
|
2964
2774
|
}
|
|
2965
2775
|
|
|
2966
2776
|
/**
|
|
@@ -2977,6 +2787,7 @@ declare namespace React {
|
|
|
2977
2787
|
action?:
|
|
2978
2788
|
| string
|
|
2979
2789
|
| undefined
|
|
2790
|
+
| ((formData: FormData) => void | Promise<void>)
|
|
2980
2791
|
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
|
2981
2792
|
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
|
|
2982
2793
|
];
|
|
@@ -3011,6 +2822,7 @@ declare namespace React {
|
|
|
3011
2822
|
formAction?:
|
|
3012
2823
|
| string
|
|
3013
2824
|
| undefined
|
|
2825
|
+
| ((formData: FormData) => void | Promise<void>)
|
|
3014
2826
|
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
|
3015
2827
|
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
|
|
3016
2828
|
];
|
|
@@ -3143,6 +2955,7 @@ declare namespace React {
|
|
|
3143
2955
|
form?: string | undefined;
|
|
3144
2956
|
formAction?:
|
|
3145
2957
|
| string
|
|
2958
|
+
| ((formData: FormData) => void | Promise<void>)
|
|
3146
2959
|
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
|
3147
2960
|
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
|
|
3148
2961
|
]
|
|
@@ -3176,7 +2989,6 @@ declare namespace React {
|
|
|
3176
2989
|
|
|
3177
2990
|
interface DetailsHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3178
2991
|
open?: boolean | undefined;
|
|
3179
|
-
onToggle?: ReactEventHandler<T> | undefined;
|
|
3180
2992
|
name?: string | undefined;
|
|
3181
2993
|
}
|
|
3182
2994
|
|
|
@@ -3209,6 +3021,7 @@ declare namespace React {
|
|
|
3209
3021
|
action?:
|
|
3210
3022
|
| string
|
|
3211
3023
|
| undefined
|
|
3024
|
+
| ((formData: FormData) => void | Promise<void>)
|
|
3212
3025
|
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
|
3213
3026
|
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
|
|
3214
3027
|
];
|
|
@@ -3247,6 +3060,8 @@ declare namespace React {
|
|
|
3247
3060
|
width?: number | string | undefined;
|
|
3248
3061
|
}
|
|
3249
3062
|
|
|
3063
|
+
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES {}
|
|
3064
|
+
|
|
3250
3065
|
interface ImgHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3251
3066
|
alt?: string | undefined;
|
|
3252
3067
|
crossOrigin?: CrossOrigin;
|
|
@@ -3256,7 +3071,12 @@ declare namespace React {
|
|
|
3256
3071
|
loading?: "eager" | "lazy" | undefined;
|
|
3257
3072
|
referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
|
|
3258
3073
|
sizes?: string | undefined;
|
|
3259
|
-
src?:
|
|
3074
|
+
src?:
|
|
3075
|
+
| string
|
|
3076
|
+
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES[
|
|
3077
|
+
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES
|
|
3078
|
+
]
|
|
3079
|
+
| undefined;
|
|
3260
3080
|
srcSet?: string | undefined;
|
|
3261
3081
|
useMap?: string | undefined;
|
|
3262
3082
|
width?: number | string | undefined;
|
|
@@ -3364,6 +3184,7 @@ declare namespace React {
|
|
|
3364
3184
|
form?: string | undefined;
|
|
3365
3185
|
formAction?:
|
|
3366
3186
|
| string
|
|
3187
|
+
| ((formData: FormData) => void | Promise<void>)
|
|
3367
3188
|
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
|
3368
3189
|
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
|
|
3369
3190
|
]
|
|
@@ -3426,6 +3247,9 @@ declare namespace React {
|
|
|
3426
3247
|
sizes?: string | undefined;
|
|
3427
3248
|
type?: string | undefined;
|
|
3428
3249
|
charSet?: string | undefined;
|
|
3250
|
+
|
|
3251
|
+
// React props
|
|
3252
|
+
precedence?: string | undefined;
|
|
3429
3253
|
}
|
|
3430
3254
|
|
|
3431
3255
|
interface MapHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
@@ -3436,6 +3260,8 @@ declare namespace React {
|
|
|
3436
3260
|
type?: string | undefined;
|
|
3437
3261
|
}
|
|
3438
3262
|
|
|
3263
|
+
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_MEDIA_SRC_TYPES {}
|
|
3264
|
+
|
|
3439
3265
|
interface MediaHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3440
3266
|
autoPlay?: boolean | undefined;
|
|
3441
3267
|
controls?: boolean | undefined;
|
|
@@ -3446,7 +3272,12 @@ declare namespace React {
|
|
|
3446
3272
|
muted?: boolean | undefined;
|
|
3447
3273
|
playsInline?: boolean | undefined;
|
|
3448
3274
|
preload?: string | undefined;
|
|
3449
|
-
src?:
|
|
3275
|
+
src?:
|
|
3276
|
+
| string
|
|
3277
|
+
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_MEDIA_SRC_TYPES[
|
|
3278
|
+
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_MEDIA_SRC_TYPES
|
|
3279
|
+
]
|
|
3280
|
+
| undefined;
|
|
3450
3281
|
}
|
|
3451
3282
|
|
|
3452
3283
|
interface MetaHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
@@ -3560,6 +3391,10 @@ declare namespace React {
|
|
|
3560
3391
|
media?: string | undefined;
|
|
3561
3392
|
scoped?: boolean | undefined;
|
|
3562
3393
|
type?: string | undefined;
|
|
3394
|
+
|
|
3395
|
+
// React props
|
|
3396
|
+
href?: string | undefined;
|
|
3397
|
+
precedence?: string | undefined;
|
|
3563
3398
|
}
|
|
3564
3399
|
|
|
3565
3400
|
interface TableHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
@@ -3947,259 +3782,184 @@ declare namespace React {
|
|
|
3947
3782
|
webpreferences?: string | undefined;
|
|
3948
3783
|
}
|
|
3949
3784
|
|
|
3950
|
-
//
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
"
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
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
|
-
}
|
|
3785
|
+
// TODO: Move to react-dom
|
|
3786
|
+
type HTMLElementType =
|
|
3787
|
+
| "a"
|
|
3788
|
+
| "abbr"
|
|
3789
|
+
| "address"
|
|
3790
|
+
| "area"
|
|
3791
|
+
| "article"
|
|
3792
|
+
| "aside"
|
|
3793
|
+
| "audio"
|
|
3794
|
+
| "b"
|
|
3795
|
+
| "base"
|
|
3796
|
+
| "bdi"
|
|
3797
|
+
| "bdo"
|
|
3798
|
+
| "big"
|
|
3799
|
+
| "blockquote"
|
|
3800
|
+
| "body"
|
|
3801
|
+
| "br"
|
|
3802
|
+
| "button"
|
|
3803
|
+
| "canvas"
|
|
3804
|
+
| "caption"
|
|
3805
|
+
| "center"
|
|
3806
|
+
| "cite"
|
|
3807
|
+
| "code"
|
|
3808
|
+
| "col"
|
|
3809
|
+
| "colgroup"
|
|
3810
|
+
| "data"
|
|
3811
|
+
| "datalist"
|
|
3812
|
+
| "dd"
|
|
3813
|
+
| "del"
|
|
3814
|
+
| "details"
|
|
3815
|
+
| "dfn"
|
|
3816
|
+
| "dialog"
|
|
3817
|
+
| "div"
|
|
3818
|
+
| "dl"
|
|
3819
|
+
| "dt"
|
|
3820
|
+
| "em"
|
|
3821
|
+
| "embed"
|
|
3822
|
+
| "fieldset"
|
|
3823
|
+
| "figcaption"
|
|
3824
|
+
| "figure"
|
|
3825
|
+
| "footer"
|
|
3826
|
+
| "form"
|
|
3827
|
+
| "h1"
|
|
3828
|
+
| "h2"
|
|
3829
|
+
| "h3"
|
|
3830
|
+
| "h4"
|
|
3831
|
+
| "h5"
|
|
3832
|
+
| "h6"
|
|
3833
|
+
| "head"
|
|
3834
|
+
| "header"
|
|
3835
|
+
| "hgroup"
|
|
3836
|
+
| "hr"
|
|
3837
|
+
| "html"
|
|
3838
|
+
| "i"
|
|
3839
|
+
| "iframe"
|
|
3840
|
+
| "img"
|
|
3841
|
+
| "input"
|
|
3842
|
+
| "ins"
|
|
3843
|
+
| "kbd"
|
|
3844
|
+
| "keygen"
|
|
3845
|
+
| "label"
|
|
3846
|
+
| "legend"
|
|
3847
|
+
| "li"
|
|
3848
|
+
| "link"
|
|
3849
|
+
| "main"
|
|
3850
|
+
| "map"
|
|
3851
|
+
| "mark"
|
|
3852
|
+
| "menu"
|
|
3853
|
+
| "menuitem"
|
|
3854
|
+
| "meta"
|
|
3855
|
+
| "meter"
|
|
3856
|
+
| "nav"
|
|
3857
|
+
| "noscript"
|
|
3858
|
+
| "object"
|
|
3859
|
+
| "ol"
|
|
3860
|
+
| "optgroup"
|
|
3861
|
+
| "option"
|
|
3862
|
+
| "output"
|
|
3863
|
+
| "p"
|
|
3864
|
+
| "param"
|
|
3865
|
+
| "picture"
|
|
3866
|
+
| "pre"
|
|
3867
|
+
| "progress"
|
|
3868
|
+
| "q"
|
|
3869
|
+
| "rp"
|
|
3870
|
+
| "rt"
|
|
3871
|
+
| "ruby"
|
|
3872
|
+
| "s"
|
|
3873
|
+
| "samp"
|
|
3874
|
+
| "search"
|
|
3875
|
+
| "slot"
|
|
3876
|
+
| "script"
|
|
3877
|
+
| "section"
|
|
3878
|
+
| "select"
|
|
3879
|
+
| "small"
|
|
3880
|
+
| "source"
|
|
3881
|
+
| "span"
|
|
3882
|
+
| "strong"
|
|
3883
|
+
| "style"
|
|
3884
|
+
| "sub"
|
|
3885
|
+
| "summary"
|
|
3886
|
+
| "sup"
|
|
3887
|
+
| "table"
|
|
3888
|
+
| "template"
|
|
3889
|
+
| "tbody"
|
|
3890
|
+
| "td"
|
|
3891
|
+
| "textarea"
|
|
3892
|
+
| "tfoot"
|
|
3893
|
+
| "th"
|
|
3894
|
+
| "thead"
|
|
3895
|
+
| "time"
|
|
3896
|
+
| "title"
|
|
3897
|
+
| "tr"
|
|
3898
|
+
| "track"
|
|
3899
|
+
| "u"
|
|
3900
|
+
| "ul"
|
|
3901
|
+
| "var"
|
|
3902
|
+
| "video"
|
|
3903
|
+
| "wbr"
|
|
3904
|
+
| "webview";
|
|
3905
|
+
|
|
3906
|
+
// TODO: Move to react-dom
|
|
3907
|
+
type SVGElementType =
|
|
3908
|
+
| "animate"
|
|
3909
|
+
| "circle"
|
|
3910
|
+
| "clipPath"
|
|
3911
|
+
| "defs"
|
|
3912
|
+
| "desc"
|
|
3913
|
+
| "ellipse"
|
|
3914
|
+
| "feBlend"
|
|
3915
|
+
| "feColorMatrix"
|
|
3916
|
+
| "feComponentTransfer"
|
|
3917
|
+
| "feComposite"
|
|
3918
|
+
| "feConvolveMatrix"
|
|
3919
|
+
| "feDiffuseLighting"
|
|
3920
|
+
| "feDisplacementMap"
|
|
3921
|
+
| "feDistantLight"
|
|
3922
|
+
| "feDropShadow"
|
|
3923
|
+
| "feFlood"
|
|
3924
|
+
| "feFuncA"
|
|
3925
|
+
| "feFuncB"
|
|
3926
|
+
| "feFuncG"
|
|
3927
|
+
| "feFuncR"
|
|
3928
|
+
| "feGaussianBlur"
|
|
3929
|
+
| "feImage"
|
|
3930
|
+
| "feMerge"
|
|
3931
|
+
| "feMergeNode"
|
|
3932
|
+
| "feMorphology"
|
|
3933
|
+
| "feOffset"
|
|
3934
|
+
| "fePointLight"
|
|
3935
|
+
| "feSpecularLighting"
|
|
3936
|
+
| "feSpotLight"
|
|
3937
|
+
| "feTile"
|
|
3938
|
+
| "feTurbulence"
|
|
3939
|
+
| "filter"
|
|
3940
|
+
| "foreignObject"
|
|
3941
|
+
| "g"
|
|
3942
|
+
| "image"
|
|
3943
|
+
| "line"
|
|
3944
|
+
| "linearGradient"
|
|
3945
|
+
| "marker"
|
|
3946
|
+
| "mask"
|
|
3947
|
+
| "metadata"
|
|
3948
|
+
| "path"
|
|
3949
|
+
| "pattern"
|
|
3950
|
+
| "polygon"
|
|
3951
|
+
| "polyline"
|
|
3952
|
+
| "radialGradient"
|
|
3953
|
+
| "rect"
|
|
3954
|
+
| "stop"
|
|
3955
|
+
| "svg"
|
|
3956
|
+
| "switch"
|
|
3957
|
+
| "symbol"
|
|
3958
|
+
| "text"
|
|
3959
|
+
| "textPath"
|
|
3960
|
+
| "tspan"
|
|
3961
|
+
| "use"
|
|
3962
|
+
| "view";
|
|
4203
3963
|
|
|
4204
3964
|
//
|
|
4205
3965
|
// Browser Interfaces
|
|
@@ -4241,68 +4001,6 @@ declare namespace React {
|
|
|
4241
4001
|
}
|
|
4242
4002
|
|
|
4243
4003
|
// 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
|
-
*/
|
|
4306
4004
|
namespace JSX {
|
|
4307
4005
|
// We don't just alias React.ElementType because React.ElementType
|
|
4308
4006
|
// historically does more than we need it to.
|
|
@@ -4526,18 +4224,18 @@ declare global {
|
|
|
4526
4224
|
}
|
|
4527
4225
|
}
|
|
4528
4226
|
|
|
4529
|
-
|
|
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 {}
|
|
4537
|
-
|
|
4538
|
-
type GlobalJSXLibraryManagedAttributes<C, P> = JSX.LibraryManagedAttributes<C, P>;
|
|
4227
|
+
type InexactPartial<T> = { [K in keyof T]?: T[K] | undefined };
|
|
4539
4228
|
|
|
4540
|
-
|
|
4541
|
-
|
|
4229
|
+
// Any prop that has a default prop becomes optional, but its type is unchanged
|
|
4230
|
+
// Undeclared default props are augmented into the resulting allowable attributes
|
|
4231
|
+
// If declared props have indexed properties, ignore default props entirely as keyof gets widened
|
|
4232
|
+
// Wrap in an outer-level conditional type to allow distribution over props that are unions
|
|
4233
|
+
type Defaultize<P, D> = P extends any ? string extends keyof P ? P
|
|
4234
|
+
:
|
|
4235
|
+
& Pick<P, Exclude<keyof P, keyof D>>
|
|
4236
|
+
& InexactPartial<Pick<P, Extract<keyof P, keyof D>>>
|
|
4237
|
+
& InexactPartial<Pick<D, Exclude<keyof D, keyof P>>>
|
|
4238
|
+
: never;
|
|
4542
4239
|
|
|
4543
|
-
|
|
4240
|
+
type ReactManagedAttributes<C, P> = C extends { defaultProps: infer D } ? Defaultize<P, D>
|
|
4241
|
+
: P;
|