@types/react 18.0.29 → 18.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- react/README.md +1 -1
- react/index.d.ts +37 -43
- react/next.d.ts +1 -1
- react/package.json +2 -2
react/README.md
CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for React (http://facebook.github.io/reac
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react.
|
9
9
|
|
10
10
|
### Additional Details
|
11
|
-
* Last updated:
|
11
|
+
* Last updated: Tue, 28 Mar 2023 22:03:14 GMT
|
12
12
|
* Dependencies: [@types/csstype](https://npmjs.com/package/@types/csstype), [@types/prop-types](https://npmjs.com/package/@types/prop-types), [@types/scheduler](https://npmjs.com/package/@types/scheduler)
|
13
13
|
* Global values: `React`
|
14
14
|
|
react/index.d.ts
CHANGED
@@ -402,7 +402,7 @@ declare namespace React {
|
|
402
402
|
const version: string;
|
403
403
|
|
404
404
|
/**
|
405
|
-
* {@link https://
|
405
|
+
* {@link https://react.dev/reference/react/Profiler#onrender-callback Profiler API}
|
406
406
|
*/
|
407
407
|
type ProfilerOnRenderCallback = (
|
408
408
|
id: string,
|
@@ -449,7 +449,7 @@ declare namespace React {
|
|
449
449
|
* }
|
450
450
|
* ```
|
451
451
|
*
|
452
|
-
* @see https://
|
452
|
+
* @see https://react.dev/reference/react/Component#static-contexttype
|
453
453
|
*/
|
454
454
|
static contextType?: Context<any> | undefined;
|
455
455
|
|
@@ -466,14 +466,14 @@ declare namespace React {
|
|
466
466
|
* declare context: React.ContextType<typeof MyContext>
|
467
467
|
* ```
|
468
468
|
*
|
469
|
-
* @see https://
|
469
|
+
* @see https://react.dev/reference/react/Component#context
|
470
470
|
*/
|
471
471
|
context: unknown;
|
472
472
|
|
473
473
|
constructor(props: Readonly<P> | P);
|
474
474
|
/**
|
475
475
|
* @deprecated
|
476
|
-
* @see https://reactjs.org/docs/legacy-context.html
|
476
|
+
* @see https://legacy.reactjs.org/docs/legacy-context.html
|
477
477
|
*/
|
478
478
|
constructor(props: P, context: any);
|
479
479
|
|
@@ -492,7 +492,7 @@ declare namespace React {
|
|
492
492
|
state: Readonly<S>;
|
493
493
|
/**
|
494
494
|
* @deprecated
|
495
|
-
* https://reactjs.org/docs/refs-and-the-dom.html#legacy-api-string-refs
|
495
|
+
* https://legacy.reactjs.org/docs/refs-and-the-dom.html#legacy-api-string-refs
|
496
496
|
*/
|
497
497
|
refs: {
|
498
498
|
[key: string]: ReactInstance
|
@@ -668,8 +668,8 @@ declare namespace React {
|
|
668
668
|
* prevents this from being invoked.
|
669
669
|
*
|
670
670
|
* @deprecated 16.3, use componentDidMount or the constructor instead; will stop working in React 17
|
671
|
-
* @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state
|
672
|
-
* @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
671
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state
|
672
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
673
673
|
*/
|
674
674
|
componentWillMount?(): void;
|
675
675
|
/**
|
@@ -682,8 +682,8 @@ declare namespace React {
|
|
682
682
|
* prevents this from being invoked.
|
683
683
|
*
|
684
684
|
* @deprecated 16.3, use componentDidMount or the constructor instead
|
685
|
-
* @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state
|
686
|
-
* @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
685
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state
|
686
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
687
687
|
*/
|
688
688
|
UNSAFE_componentWillMount?(): void;
|
689
689
|
/**
|
@@ -697,8 +697,8 @@ declare namespace React {
|
|
697
697
|
* prevents this from being invoked.
|
698
698
|
*
|
699
699
|
* @deprecated 16.3, use static getDerivedStateFromProps instead; will stop working in React 17
|
700
|
-
* @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props
|
701
|
-
* @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
700
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props
|
701
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
702
702
|
*/
|
703
703
|
componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
|
704
704
|
/**
|
@@ -714,8 +714,8 @@ declare namespace React {
|
|
714
714
|
* prevents this from being invoked.
|
715
715
|
*
|
716
716
|
* @deprecated 16.3, use static getDerivedStateFromProps instead
|
717
|
-
* @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props
|
718
|
-
* @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
717
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props
|
718
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
719
719
|
*/
|
720
720
|
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
|
721
721
|
/**
|
@@ -727,8 +727,8 @@ declare namespace React {
|
|
727
727
|
* prevents this from being invoked.
|
728
728
|
*
|
729
729
|
* @deprecated 16.3, use getSnapshotBeforeUpdate instead; will stop working in React 17
|
730
|
-
* @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update
|
731
|
-
* @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
730
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update
|
731
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
732
732
|
*/
|
733
733
|
componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void;
|
734
734
|
/**
|
@@ -742,8 +742,8 @@ declare namespace React {
|
|
742
742
|
* prevents this from being invoked.
|
743
743
|
*
|
744
744
|
* @deprecated 16.3, use getSnapshotBeforeUpdate instead
|
745
|
-
* @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update
|
746
|
-
* @see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
745
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update
|
746
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
747
747
|
*/
|
748
748
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void;
|
749
749
|
}
|
@@ -886,14 +886,14 @@ declare namespace React {
|
|
886
886
|
* context value, as given by the nearest context provider for the given context.
|
887
887
|
*
|
888
888
|
* @version 16.8.0
|
889
|
-
* @see https://
|
889
|
+
* @see https://react.dev/reference/react/useContext
|
890
890
|
*/
|
891
891
|
function useContext<T>(context: Context<T>/*, (not public API) observedBits?: number|boolean */): T;
|
892
892
|
/**
|
893
893
|
* Returns a stateful value, and a function to update it.
|
894
894
|
*
|
895
895
|
* @version 16.8.0
|
896
|
-
* @see https://
|
896
|
+
* @see https://react.dev/reference/react/useState
|
897
897
|
*/
|
898
898
|
function useState<S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>];
|
899
899
|
// convenience overload when first argument is omitted
|
@@ -901,7 +901,7 @@ declare namespace React {
|
|
901
901
|
* Returns a stateful value, and a function to update it.
|
902
902
|
*
|
903
903
|
* @version 16.8.0
|
904
|
-
* @see https://
|
904
|
+
* @see https://react.dev/reference/react/useState
|
905
905
|
*/
|
906
906
|
function useState<S = undefined>(): [S | undefined, Dispatch<SetStateAction<S | undefined>>];
|
907
907
|
/**
|
@@ -912,7 +912,7 @@ declare namespace React {
|
|
912
912
|
* updates because you can pass `dispatch` down instead of callbacks.
|
913
913
|
*
|
914
914
|
* @version 16.8.0
|
915
|
-
* @see https://
|
915
|
+
* @see https://react.dev/reference/react/useReducer
|
916
916
|
*/
|
917
917
|
// overload where dispatch could accept 0 arguments.
|
918
918
|
function useReducer<R extends ReducerWithoutAction<any>, I>(
|
@@ -928,7 +928,7 @@ declare namespace React {
|
|
928
928
|
* updates because you can pass `dispatch` down instead of callbacks.
|
929
929
|
*
|
930
930
|
* @version 16.8.0
|
931
|
-
* @see https://
|
931
|
+
* @see https://react.dev/reference/react/useReducer
|
932
932
|
*/
|
933
933
|
// overload where dispatch could accept 0 arguments.
|
934
934
|
function useReducer<R extends ReducerWithoutAction<any>>(
|
@@ -944,7 +944,7 @@ declare namespace React {
|
|
944
944
|
* updates because you can pass `dispatch` down instead of callbacks.
|
945
945
|
*
|
946
946
|
* @version 16.8.0
|
947
|
-
* @see https://
|
947
|
+
* @see https://react.dev/reference/react/useReducer
|
948
948
|
*/
|
949
949
|
// overload where "I" may be a subset of ReducerState<R>; used to provide autocompletion.
|
950
950
|
// If "I" matches ReducerState<R> exactly then the last overload will allow initializer to be omitted.
|
@@ -962,7 +962,7 @@ declare namespace React {
|
|
962
962
|
* updates because you can pass `dispatch` down instead of callbacks.
|
963
963
|
*
|
964
964
|
* @version 16.8.0
|
965
|
-
* @see https://
|
965
|
+
* @see https://react.dev/reference/react/useReducer
|
966
966
|
*/
|
967
967
|
// overload for free "I"; all goes as long as initializer converts it into "ReducerState<R>".
|
968
968
|
function useReducer<R extends Reducer<any, any>, I>(
|
@@ -978,7 +978,7 @@ declare namespace React {
|
|
978
978
|
* updates because you can pass `dispatch` down instead of callbacks.
|
979
979
|
*
|
980
980
|
* @version 16.8.0
|
981
|
-
* @see https://
|
981
|
+
* @see https://react.dev/reference/react/useReducer
|
982
982
|
*/
|
983
983
|
|
984
984
|
// I'm not sure if I keep this 2-ary or if I make it (2,3)-ary; it's currently (2,3)-ary.
|
@@ -1003,7 +1003,7 @@ declare namespace React {
|
|
1003
1003
|
* value around similar to how you’d use instance fields in classes.
|
1004
1004
|
*
|
1005
1005
|
* @version 16.8.0
|
1006
|
-
* @see https://
|
1006
|
+
* @see https://react.dev/reference/react/useRef
|
1007
1007
|
*/
|
1008
1008
|
function useRef<T>(initialValue: T): MutableRefObject<T>;
|
1009
1009
|
// convenience overload for refs given as a ref prop as they typically start with a null value
|
@@ -1018,7 +1018,7 @@ declare namespace React {
|
|
1018
1018
|
* of the generic argument.
|
1019
1019
|
*
|
1020
1020
|
* @version 16.8.0
|
1021
|
-
* @see https://
|
1021
|
+
* @see https://react.dev/reference/react/useRef
|
1022
1022
|
*/
|
1023
1023
|
function useRef<T>(initialValue: T|null): RefObject<T>;
|
1024
1024
|
// convenience overload for potentially undefined initialValue / call with 0 arguments
|
@@ -1031,7 +1031,7 @@ declare namespace React {
|
|
1031
1031
|
* value around similar to how you’d use instance fields in classes.
|
1032
1032
|
*
|
1033
1033
|
* @version 16.8.0
|
1034
|
-
* @see https://
|
1034
|
+
* @see https://react.dev/reference/react/useRef
|
1035
1035
|
*/
|
1036
1036
|
function useRef<T = undefined>(): MutableRefObject<T | undefined>;
|
1037
1037
|
/**
|
@@ -1045,7 +1045,7 @@ declare namespace React {
|
|
1045
1045
|
* `componentDidMount` and `componentDidUpdate`.
|
1046
1046
|
*
|
1047
1047
|
* @version 16.8.0
|
1048
|
-
* @see https://
|
1048
|
+
* @see https://react.dev/reference/react/useLayoutEffect
|
1049
1049
|
*/
|
1050
1050
|
function useLayoutEffect(effect: EffectCallback, deps?: DependencyList): void;
|
1051
1051
|
/**
|
@@ -1055,7 +1055,7 @@ declare namespace React {
|
|
1055
1055
|
* @param deps If present, effect will only activate if the values in the list change.
|
1056
1056
|
*
|
1057
1057
|
* @version 16.8.0
|
1058
|
-
* @see https://
|
1058
|
+
* @see https://react.dev/reference/react/useEffect
|
1059
1059
|
*/
|
1060
1060
|
function useEffect(effect: EffectCallback, deps?: DependencyList): void;
|
1061
1061
|
// NOTE: this does not accept strings, but this will have to be fixed by removing strings from type Ref<T>
|
@@ -1066,7 +1066,7 @@ declare namespace React {
|
|
1066
1066
|
* `useImperativeHandle` should be used with `React.forwardRef`.
|
1067
1067
|
*
|
1068
1068
|
* @version 16.8.0
|
1069
|
-
* @see https://
|
1069
|
+
* @see https://react.dev/reference/react/useImperativeHandle
|
1070
1070
|
*/
|
1071
1071
|
function useImperativeHandle<T, R extends T>(ref: Ref<T>|undefined, init: () => R, deps?: DependencyList): void;
|
1072
1072
|
// I made 'inputs' required here and in useMemo as there's no point to memoizing without the memoization key
|
@@ -1076,7 +1076,7 @@ declare namespace React {
|
|
1076
1076
|
* has changed.
|
1077
1077
|
*
|
1078
1078
|
* @version 16.8.0
|
1079
|
-
* @see https://
|
1079
|
+
* @see https://react.dev/reference/react/useCallback
|
1080
1080
|
*/
|
1081
1081
|
// A specific function type would not trigger implicit any.
|
1082
1082
|
// See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/52873#issuecomment-845806435 for a comparison between `Function` and more specific types.
|
@@ -1086,7 +1086,7 @@ declare namespace React {
|
|
1086
1086
|
* `useMemo` will only recompute the memoized value when one of the `deps` has changed.
|
1087
1087
|
*
|
1088
1088
|
* @version 16.8.0
|
1089
|
-
* @see https://
|
1089
|
+
* @see https://react.dev/reference/react/useMemo
|
1090
1090
|
*/
|
1091
1091
|
// allow undefined, but don't make it optional as that is very likely a mistake
|
1092
1092
|
function useMemo<T>(factory: () => T, deps: DependencyList | undefined): T;
|
@@ -1097,7 +1097,7 @@ declare namespace React {
|
|
1097
1097
|
* It’s most valuable for custom hooks that are part of shared libraries.
|
1098
1098
|
*
|
1099
1099
|
* @version 16.8.0
|
1100
|
-
* @see https://
|
1100
|
+
* @see https://react.dev/reference/react/useDebugValue
|
1101
1101
|
*/
|
1102
1102
|
// the name of the custom hook is itself derived from the function name at runtime:
|
1103
1103
|
// it's just the function name without the "use" prefix.
|
@@ -1127,7 +1127,7 @@ declare namespace React {
|
|
1127
1127
|
*
|
1128
1128
|
* @param value The value that is going to be deferred
|
1129
1129
|
*
|
1130
|
-
* @see https://
|
1130
|
+
* @see https://react.dev/reference/react/useDeferredValue
|
1131
1131
|
*/
|
1132
1132
|
export function useDeferredValue<T>(value: T): T;
|
1133
1133
|
|
@@ -1144,7 +1144,7 @@ declare namespace React {
|
|
1144
1144
|
*
|
1145
1145
|
* **If some state update causes a component to suspend, that state update should be wrapped in a transition.**`
|
1146
1146
|
*
|
1147
|
-
* @see https://
|
1147
|
+
* @see https://react.dev/reference/react/useTransition
|
1148
1148
|
*/
|
1149
1149
|
export function useTransition(): [boolean, TransitionStartFunction];
|
1150
1150
|
|
@@ -1854,6 +1854,7 @@ declare namespace React {
|
|
1854
1854
|
|
1855
1855
|
// Standard HTML Attributes
|
1856
1856
|
accessKey?: string | undefined;
|
1857
|
+
autoFocus?: boolean | undefined;
|
1857
1858
|
className?: string | undefined;
|
1858
1859
|
contentEditable?: Booleanish | "inherit" | undefined;
|
1859
1860
|
contextMenu?: string | undefined;
|
@@ -1925,7 +1926,6 @@ declare namespace React {
|
|
1925
1926
|
as?: string | undefined;
|
1926
1927
|
async?: boolean | undefined;
|
1927
1928
|
autoComplete?: string | undefined;
|
1928
|
-
autoFocus?: boolean | undefined;
|
1929
1929
|
autoPlay?: boolean | undefined;
|
1930
1930
|
capture?: boolean | 'user' | 'environment' | undefined;
|
1931
1931
|
cellPadding?: number | string | undefined;
|
@@ -2078,7 +2078,6 @@ declare namespace React {
|
|
2078
2078
|
}
|
2079
2079
|
|
2080
2080
|
interface ButtonHTMLAttributes<T> extends HTMLAttributes<T> {
|
2081
|
-
autoFocus?: boolean | undefined;
|
2082
2081
|
disabled?: boolean | undefined;
|
2083
2082
|
form?: string | undefined;
|
2084
2083
|
formAction?: string | undefined;
|
@@ -2225,7 +2224,6 @@ declare namespace React {
|
|
2225
2224
|
accept?: string | undefined;
|
2226
2225
|
alt?: string | undefined;
|
2227
2226
|
autoComplete?: string | undefined;
|
2228
|
-
autoFocus?: boolean | undefined;
|
2229
2227
|
capture?: boolean | 'user' | 'environment' | undefined; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute
|
2230
2228
|
checked?: boolean | undefined;
|
2231
2229
|
crossOrigin?: "anonymous" | "use-credentials" | "" | undefined;
|
@@ -2260,7 +2258,6 @@ declare namespace React {
|
|
2260
2258
|
}
|
2261
2259
|
|
2262
2260
|
interface KeygenHTMLAttributes<T> extends HTMLAttributes<T> {
|
2263
|
-
autoFocus?: boolean | undefined;
|
2264
2261
|
challenge?: string | undefined;
|
2265
2262
|
disabled?: boolean | undefined;
|
2266
2263
|
form?: string | undefined;
|
@@ -2402,7 +2399,6 @@ declare namespace React {
|
|
2402
2399
|
|
2403
2400
|
interface SelectHTMLAttributes<T> extends HTMLAttributes<T> {
|
2404
2401
|
autoComplete?: string | undefined;
|
2405
|
-
autoFocus?: boolean | undefined;
|
2406
2402
|
disabled?: boolean | undefined;
|
2407
2403
|
form?: string | undefined;
|
2408
2404
|
multiple?: boolean | undefined;
|
@@ -2443,7 +2439,6 @@ declare namespace React {
|
|
2443
2439
|
|
2444
2440
|
interface TextareaHTMLAttributes<T> extends HTMLAttributes<T> {
|
2445
2441
|
autoComplete?: string | undefined;
|
2446
|
-
autoFocus?: boolean | undefined;
|
2447
2442
|
cols?: number | undefined;
|
2448
2443
|
dirName?: string | undefined;
|
2449
2444
|
disabled?: boolean | undefined;
|
@@ -2783,7 +2778,6 @@ declare namespace React {
|
|
2783
2778
|
interface WebViewHTMLAttributes<T> extends HTMLAttributes<T> {
|
2784
2779
|
allowFullScreen?: boolean | undefined;
|
2785
2780
|
allowpopups?: boolean | undefined;
|
2786
|
-
autoFocus?: boolean | undefined;
|
2787
2781
|
autosize?: boolean | undefined;
|
2788
2782
|
blinkfeatures?: string | undefined;
|
2789
2783
|
disableblinkfeatures?: string | undefined;
|
react/next.d.ts
CHANGED
@@ -71,7 +71,7 @@ declare module '.' {
|
|
71
71
|
* context value, as given by the nearest context provider for the given context.
|
72
72
|
*
|
73
73
|
* @version 16.8.0
|
74
|
-
* @see https://
|
74
|
+
* @see https://react.dev/reference/react/useContext
|
75
75
|
*/
|
76
76
|
function useContext<T extends ServerContextJSONValue>(context: ServerContext<T>): T;
|
77
77
|
export function createServerContext<T extends ServerContextJSONValue>(
|
react/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/react",
|
3
|
-
"version": "18.0.
|
3
|
+
"version": "18.0.31",
|
4
4
|
"description": "TypeScript definitions for React",
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
|
6
6
|
"license": "MIT",
|
@@ -151,7 +151,7 @@
|
|
151
151
|
"@types/scheduler": "*",
|
152
152
|
"csstype": "^3.0.2"
|
153
153
|
},
|
154
|
-
"typesPublisherContentHash": "
|
154
|
+
"typesPublisherContentHash": "cdd516b34f9b1735bd2460166eff3a937ca51e3d88312f285eb556789b086b8f",
|
155
155
|
"typeScriptVersion": "4.3",
|
156
156
|
"exports": {
|
157
157
|
".": {
|