@types/react 18.0.30 → 18.0.32
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 +46 -36
- 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: Sun, 02 Apr 2023 08:03:03 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
@@ -132,9 +132,19 @@ declare namespace React {
|
|
132
132
|
key?: Key | null | undefined;
|
133
133
|
}
|
134
134
|
interface RefAttributes<T> extends Attributes {
|
135
|
+
/**
|
136
|
+
* Allows getting a ref to the component instance.
|
137
|
+
* Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref).
|
138
|
+
* @see https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom
|
139
|
+
*/
|
135
140
|
ref?: Ref<T> | undefined;
|
136
141
|
}
|
137
142
|
interface ClassAttributes<T> extends Attributes {
|
143
|
+
/**
|
144
|
+
* Allows getting a ref to the component instance.
|
145
|
+
* Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref).
|
146
|
+
* @see https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom
|
147
|
+
*/
|
138
148
|
ref?: LegacyRef<T> | undefined;
|
139
149
|
}
|
140
150
|
|
@@ -402,7 +412,7 @@ declare namespace React {
|
|
402
412
|
const version: string;
|
403
413
|
|
404
414
|
/**
|
405
|
-
* {@link https://
|
415
|
+
* {@link https://react.dev/reference/react/Profiler#onrender-callback Profiler API}
|
406
416
|
*/
|
407
417
|
type ProfilerOnRenderCallback = (
|
408
418
|
id: string,
|
@@ -449,7 +459,7 @@ declare namespace React {
|
|
449
459
|
* }
|
450
460
|
* ```
|
451
461
|
*
|
452
|
-
* @see https://
|
462
|
+
* @see https://react.dev/reference/react/Component#static-contexttype
|
453
463
|
*/
|
454
464
|
static contextType?: Context<any> | undefined;
|
455
465
|
|
@@ -466,14 +476,14 @@ declare namespace React {
|
|
466
476
|
* declare context: React.ContextType<typeof MyContext>
|
467
477
|
* ```
|
468
478
|
*
|
469
|
-
* @see https://
|
479
|
+
* @see https://react.dev/reference/react/Component#context
|
470
480
|
*/
|
471
481
|
context: unknown;
|
472
482
|
|
473
483
|
constructor(props: Readonly<P> | P);
|
474
484
|
/**
|
475
485
|
* @deprecated
|
476
|
-
* @see https://reactjs.org/docs/legacy-context.html
|
486
|
+
* @see https://legacy.reactjs.org/docs/legacy-context.html
|
477
487
|
*/
|
478
488
|
constructor(props: P, context: any);
|
479
489
|
|
@@ -492,7 +502,7 @@ declare namespace React {
|
|
492
502
|
state: Readonly<S>;
|
493
503
|
/**
|
494
504
|
* @deprecated
|
495
|
-
* https://reactjs.org/docs/refs-and-the-dom.html#legacy-api-string-refs
|
505
|
+
* https://legacy.reactjs.org/docs/refs-and-the-dom.html#legacy-api-string-refs
|
496
506
|
*/
|
497
507
|
refs: {
|
498
508
|
[key: string]: ReactInstance
|
@@ -668,8 +678,8 @@ declare namespace React {
|
|
668
678
|
* prevents this from being invoked.
|
669
679
|
*
|
670
680
|
* @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
|
681
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state
|
682
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
673
683
|
*/
|
674
684
|
componentWillMount?(): void;
|
675
685
|
/**
|
@@ -682,8 +692,8 @@ declare namespace React {
|
|
682
692
|
* prevents this from being invoked.
|
683
693
|
*
|
684
694
|
* @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
|
695
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state
|
696
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
687
697
|
*/
|
688
698
|
UNSAFE_componentWillMount?(): void;
|
689
699
|
/**
|
@@ -697,8 +707,8 @@ declare namespace React {
|
|
697
707
|
* prevents this from being invoked.
|
698
708
|
*
|
699
709
|
* @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
|
710
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props
|
711
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
702
712
|
*/
|
703
713
|
componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
|
704
714
|
/**
|
@@ -714,8 +724,8 @@ declare namespace React {
|
|
714
724
|
* prevents this from being invoked.
|
715
725
|
*
|
716
726
|
* @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
|
727
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props
|
728
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
719
729
|
*/
|
720
730
|
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
|
721
731
|
/**
|
@@ -727,8 +737,8 @@ declare namespace React {
|
|
727
737
|
* prevents this from being invoked.
|
728
738
|
*
|
729
739
|
* @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
|
740
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update
|
741
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
732
742
|
*/
|
733
743
|
componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void;
|
734
744
|
/**
|
@@ -742,8 +752,8 @@ declare namespace React {
|
|
742
752
|
* prevents this from being invoked.
|
743
753
|
*
|
744
754
|
* @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
|
755
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update
|
756
|
+
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
747
757
|
*/
|
748
758
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void;
|
749
759
|
}
|
@@ -886,14 +896,14 @@ declare namespace React {
|
|
886
896
|
* context value, as given by the nearest context provider for the given context.
|
887
897
|
*
|
888
898
|
* @version 16.8.0
|
889
|
-
* @see https://
|
899
|
+
* @see https://react.dev/reference/react/useContext
|
890
900
|
*/
|
891
901
|
function useContext<T>(context: Context<T>/*, (not public API) observedBits?: number|boolean */): T;
|
892
902
|
/**
|
893
903
|
* Returns a stateful value, and a function to update it.
|
894
904
|
*
|
895
905
|
* @version 16.8.0
|
896
|
-
* @see https://
|
906
|
+
* @see https://react.dev/reference/react/useState
|
897
907
|
*/
|
898
908
|
function useState<S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>];
|
899
909
|
// convenience overload when first argument is omitted
|
@@ -901,7 +911,7 @@ declare namespace React {
|
|
901
911
|
* Returns a stateful value, and a function to update it.
|
902
912
|
*
|
903
913
|
* @version 16.8.0
|
904
|
-
* @see https://
|
914
|
+
* @see https://react.dev/reference/react/useState
|
905
915
|
*/
|
906
916
|
function useState<S = undefined>(): [S | undefined, Dispatch<SetStateAction<S | undefined>>];
|
907
917
|
/**
|
@@ -912,7 +922,7 @@ declare namespace React {
|
|
912
922
|
* updates because you can pass `dispatch` down instead of callbacks.
|
913
923
|
*
|
914
924
|
* @version 16.8.0
|
915
|
-
* @see https://
|
925
|
+
* @see https://react.dev/reference/react/useReducer
|
916
926
|
*/
|
917
927
|
// overload where dispatch could accept 0 arguments.
|
918
928
|
function useReducer<R extends ReducerWithoutAction<any>, I>(
|
@@ -928,7 +938,7 @@ declare namespace React {
|
|
928
938
|
* updates because you can pass `dispatch` down instead of callbacks.
|
929
939
|
*
|
930
940
|
* @version 16.8.0
|
931
|
-
* @see https://
|
941
|
+
* @see https://react.dev/reference/react/useReducer
|
932
942
|
*/
|
933
943
|
// overload where dispatch could accept 0 arguments.
|
934
944
|
function useReducer<R extends ReducerWithoutAction<any>>(
|
@@ -944,7 +954,7 @@ declare namespace React {
|
|
944
954
|
* updates because you can pass `dispatch` down instead of callbacks.
|
945
955
|
*
|
946
956
|
* @version 16.8.0
|
947
|
-
* @see https://
|
957
|
+
* @see https://react.dev/reference/react/useReducer
|
948
958
|
*/
|
949
959
|
// overload where "I" may be a subset of ReducerState<R>; used to provide autocompletion.
|
950
960
|
// If "I" matches ReducerState<R> exactly then the last overload will allow initializer to be omitted.
|
@@ -962,7 +972,7 @@ declare namespace React {
|
|
962
972
|
* updates because you can pass `dispatch` down instead of callbacks.
|
963
973
|
*
|
964
974
|
* @version 16.8.0
|
965
|
-
* @see https://
|
975
|
+
* @see https://react.dev/reference/react/useReducer
|
966
976
|
*/
|
967
977
|
// overload for free "I"; all goes as long as initializer converts it into "ReducerState<R>".
|
968
978
|
function useReducer<R extends Reducer<any, any>, I>(
|
@@ -978,7 +988,7 @@ declare namespace React {
|
|
978
988
|
* updates because you can pass `dispatch` down instead of callbacks.
|
979
989
|
*
|
980
990
|
* @version 16.8.0
|
981
|
-
* @see https://
|
991
|
+
* @see https://react.dev/reference/react/useReducer
|
982
992
|
*/
|
983
993
|
|
984
994
|
// 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 +1013,7 @@ declare namespace React {
|
|
1003
1013
|
* value around similar to how you’d use instance fields in classes.
|
1004
1014
|
*
|
1005
1015
|
* @version 16.8.0
|
1006
|
-
* @see https://
|
1016
|
+
* @see https://react.dev/reference/react/useRef
|
1007
1017
|
*/
|
1008
1018
|
function useRef<T>(initialValue: T): MutableRefObject<T>;
|
1009
1019
|
// convenience overload for refs given as a ref prop as they typically start with a null value
|
@@ -1018,7 +1028,7 @@ declare namespace React {
|
|
1018
1028
|
* of the generic argument.
|
1019
1029
|
*
|
1020
1030
|
* @version 16.8.0
|
1021
|
-
* @see https://
|
1031
|
+
* @see https://react.dev/reference/react/useRef
|
1022
1032
|
*/
|
1023
1033
|
function useRef<T>(initialValue: T|null): RefObject<T>;
|
1024
1034
|
// convenience overload for potentially undefined initialValue / call with 0 arguments
|
@@ -1031,7 +1041,7 @@ declare namespace React {
|
|
1031
1041
|
* value around similar to how you’d use instance fields in classes.
|
1032
1042
|
*
|
1033
1043
|
* @version 16.8.0
|
1034
|
-
* @see https://
|
1044
|
+
* @see https://react.dev/reference/react/useRef
|
1035
1045
|
*/
|
1036
1046
|
function useRef<T = undefined>(): MutableRefObject<T | undefined>;
|
1037
1047
|
/**
|
@@ -1045,7 +1055,7 @@ declare namespace React {
|
|
1045
1055
|
* `componentDidMount` and `componentDidUpdate`.
|
1046
1056
|
*
|
1047
1057
|
* @version 16.8.0
|
1048
|
-
* @see https://
|
1058
|
+
* @see https://react.dev/reference/react/useLayoutEffect
|
1049
1059
|
*/
|
1050
1060
|
function useLayoutEffect(effect: EffectCallback, deps?: DependencyList): void;
|
1051
1061
|
/**
|
@@ -1055,7 +1065,7 @@ declare namespace React {
|
|
1055
1065
|
* @param deps If present, effect will only activate if the values in the list change.
|
1056
1066
|
*
|
1057
1067
|
* @version 16.8.0
|
1058
|
-
* @see https://
|
1068
|
+
* @see https://react.dev/reference/react/useEffect
|
1059
1069
|
*/
|
1060
1070
|
function useEffect(effect: EffectCallback, deps?: DependencyList): void;
|
1061
1071
|
// NOTE: this does not accept strings, but this will have to be fixed by removing strings from type Ref<T>
|
@@ -1066,7 +1076,7 @@ declare namespace React {
|
|
1066
1076
|
* `useImperativeHandle` should be used with `React.forwardRef`.
|
1067
1077
|
*
|
1068
1078
|
* @version 16.8.0
|
1069
|
-
* @see https://
|
1079
|
+
* @see https://react.dev/reference/react/useImperativeHandle
|
1070
1080
|
*/
|
1071
1081
|
function useImperativeHandle<T, R extends T>(ref: Ref<T>|undefined, init: () => R, deps?: DependencyList): void;
|
1072
1082
|
// I made 'inputs' required here and in useMemo as there's no point to memoizing without the memoization key
|
@@ -1076,7 +1086,7 @@ declare namespace React {
|
|
1076
1086
|
* has changed.
|
1077
1087
|
*
|
1078
1088
|
* @version 16.8.0
|
1079
|
-
* @see https://
|
1089
|
+
* @see https://react.dev/reference/react/useCallback
|
1080
1090
|
*/
|
1081
1091
|
// A specific function type would not trigger implicit any.
|
1082
1092
|
// See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/52873#issuecomment-845806435 for a comparison between `Function` and more specific types.
|
@@ -1086,7 +1096,7 @@ declare namespace React {
|
|
1086
1096
|
* `useMemo` will only recompute the memoized value when one of the `deps` has changed.
|
1087
1097
|
*
|
1088
1098
|
* @version 16.8.0
|
1089
|
-
* @see https://
|
1099
|
+
* @see https://react.dev/reference/react/useMemo
|
1090
1100
|
*/
|
1091
1101
|
// allow undefined, but don't make it optional as that is very likely a mistake
|
1092
1102
|
function useMemo<T>(factory: () => T, deps: DependencyList | undefined): T;
|
@@ -1097,7 +1107,7 @@ declare namespace React {
|
|
1097
1107
|
* It’s most valuable for custom hooks that are part of shared libraries.
|
1098
1108
|
*
|
1099
1109
|
* @version 16.8.0
|
1100
|
-
* @see https://
|
1110
|
+
* @see https://react.dev/reference/react/useDebugValue
|
1101
1111
|
*/
|
1102
1112
|
// the name of the custom hook is itself derived from the function name at runtime:
|
1103
1113
|
// it's just the function name without the "use" prefix.
|
@@ -1127,7 +1137,7 @@ declare namespace React {
|
|
1127
1137
|
*
|
1128
1138
|
* @param value The value that is going to be deferred
|
1129
1139
|
*
|
1130
|
-
* @see https://
|
1140
|
+
* @see https://react.dev/reference/react/useDeferredValue
|
1131
1141
|
*/
|
1132
1142
|
export function useDeferredValue<T>(value: T): T;
|
1133
1143
|
|
@@ -1144,7 +1154,7 @@ declare namespace React {
|
|
1144
1154
|
*
|
1145
1155
|
* **If some state update causes a component to suspend, that state update should be wrapped in a transition.**`
|
1146
1156
|
*
|
1147
|
-
* @see https://
|
1157
|
+
* @see https://react.dev/reference/react/useTransition
|
1148
1158
|
*/
|
1149
1159
|
export function useTransition(): [boolean, TransitionStartFunction];
|
1150
1160
|
|
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.32",
|
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": "9d1d2419e093ce4580bee436a8317e227c17aa05565bf064ec3990a5742ad403",
|
155
155
|
"typeScriptVersion": "4.3",
|
156
156
|
"exports": {
|
157
157
|
".": {
|