@types/react 17.0.42 → 18.0.0

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 CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for React (http://facebook.github.io/reac
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Wed, 23 Mar 2022 05:31:41 GMT
11
+ * Last updated: Thu, 07 Apr 2022 17:31:22 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/experimental.d.ts CHANGED
@@ -39,6 +39,15 @@ import React = require('./next');
39
39
  export {};
40
40
 
41
41
  declare module '.' {
42
+ export interface SuspenseProps {
43
+ /**
44
+ * The presence of this prop indicates that the content is computationally expensive to render.
45
+ * In other words, the tree is CPU bound and not I/O bound (e.g. due to fetching data).
46
+ * @see {@link https://github.com/facebook/react/pull/19936}
47
+ */
48
+ unstable_expectedLoadTime?: number | undefined;
49
+ }
50
+
42
51
  export type SuspenseListRevealOrder = 'forwards' | 'backwards' | 'together';
43
52
  export type SuspenseListTailMode = 'collapsed' | 'hidden';
44
53
 
@@ -93,4 +102,20 @@ declare module '.' {
93
102
  * @see https://reactjs.org/docs/concurrent-mode-patterns.html#suspenselist
94
103
  */
95
104
  export const SuspenseList: ExoticComponent<SuspenseListProps>;
105
+
106
+ /**
107
+ * this should be an internal type
108
+ */
109
+ interface MutableSource<T> {
110
+ _source: T;
111
+ }
112
+
113
+ export type MutableSourceSubscribe<T> = (source: T, callback: () => void) => () => void;
114
+
115
+ // TODO: This may not be intentionally part of the experimental release considering useMutableSource is no longer available
116
+ /**
117
+ * @param source A source could be anything as long as they can be subscribed to and have a "version".
118
+ * @param getVersion A function returns a value which will change whenever part of the source changes.
119
+ */
120
+ export function unstable_createMutableSource<T>(source: T, getVersion: () => any): MutableSource<T>;
96
121
  }
react/global.d.ts CHANGED
@@ -40,6 +40,7 @@ interface HTMLButtonElement extends HTMLElement { }
40
40
  interface HTMLCanvasElement extends HTMLElement { }
41
41
  interface HTMLDataElement extends HTMLElement { }
42
42
  interface HTMLDataListElement extends HTMLElement { }
43
+ interface HTMLDetailsElement extends HTMLElement { }
43
44
  interface HTMLDialogElement extends HTMLElement { }
44
45
  interface HTMLDivElement extends HTMLElement { }
45
46
  interface HTMLDListElement extends HTMLElement { }
@@ -60,10 +61,12 @@ interface HTMLLIElement extends HTMLElement { }
60
61
  interface HTMLLinkElement extends HTMLElement { }
61
62
  interface HTMLMapElement extends HTMLElement { }
62
63
  interface HTMLMetaElement extends HTMLElement { }
64
+ interface HTMLMeterElement extends HTMLElement { }
63
65
  interface HTMLObjectElement extends HTMLElement { }
64
66
  interface HTMLOListElement extends HTMLElement { }
65
67
  interface HTMLOptGroupElement extends HTMLElement { }
66
68
  interface HTMLOptionElement extends HTMLElement { }
69
+ interface HTMLOutputElement extends HTMLElement { }
67
70
  interface HTMLParagraphElement extends HTMLElement { }
68
71
  interface HTMLParamElement extends HTMLElement { }
69
72
  interface HTMLPreElement extends HTMLElement { }
@@ -83,6 +86,7 @@ interface HTMLTableRowElement extends HTMLElement { }
83
86
  interface HTMLTableSectionElement extends HTMLElement { }
84
87
  interface HTMLTemplateElement extends HTMLElement { }
85
88
  interface HTMLTextAreaElement extends HTMLElement { }
89
+ interface HTMLTimeElement extends HTMLElement { }
86
90
  interface HTMLTitleElement extends HTMLElement { }
87
91
  interface HTMLTrackElement extends HTMLElement { }
88
92
  interface HTMLUListElement extends HTMLElement { }
react/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for React 17.0
1
+ // Type definitions for React 18.0
2
2
  // Project: http://facebook.github.io/react/
3
3
  // Definitions by: Asana <https://asana.com>
4
4
  // AssureSign <http://www.assuresign.com>
@@ -29,10 +29,6 @@
29
29
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
30
30
  // TypeScript Version: 2.8
31
31
 
32
- // NOTE: Users of the upcoming React 18 release should add a reference
33
- // to 'react/next' in their project. See next.d.ts's top comment
34
- // for reference and documentation on how exactly to do it.
35
-
36
32
  // NOTE: Users of the `experimental` builds of React should add a reference
37
33
  // to 'react/experimental' in their project. See experimental.d.ts's top comment
38
34
  // for reference and documentation on how exactly to do it.
@@ -60,6 +56,7 @@ type Booleanish = boolean | 'true' | 'false';
60
56
  declare const UNDEFINED_VOID_ONLY: unique symbol;
61
57
  // Destructors are only allowed to return void.
62
58
  type Destructor = () => void | { [UNDEFINED_VOID_ONLY]: never };
59
+ type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
63
60
 
64
61
  // tslint:disable-next-line:export-just-namespace
65
62
  export = React;
@@ -75,10 +72,6 @@ declare namespace React {
75
72
  [K in keyof JSX.IntrinsicElements]: P extends JSX.IntrinsicElements[K] ? K : never
76
73
  }[keyof JSX.IntrinsicElements] |
77
74
  ComponentType<P>;
78
- /**
79
- * @deprecated Please use `ElementType`
80
- */
81
- type ReactType<P = any> = ElementType<P>;
82
75
  type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>;
83
76
 
84
77
  type JSXElementConstructor<P> =
@@ -155,11 +148,6 @@ declare namespace React {
155
148
  P = Pick<ComponentProps<T>, Exclude<keyof ComponentProps<T>, 'key' | 'ref'>>
156
149
  > extends ReactElement<P, Exclude<T, number>> { }
157
150
 
158
- /**
159
- * @deprecated Please use `FunctionComponentElement`
160
- */
161
- type SFCElement<P> = FunctionComponentElement<P>;
162
-
163
151
  interface FunctionComponentElement<P> extends ReactElement<P, FunctionComponent<P>> {
164
152
  ref?: ('ref' extends keyof P ? P extends { ref?: infer R | undefined } ? R : never : never) | undefined;
165
153
  }
@@ -237,7 +225,7 @@ declare namespace React {
237
225
  * @deprecated Use either `ReactNode[]` if you need an array or `Iterable<ReactNode>` if its passed to a host component.
238
226
  */
239
227
  interface ReactNodeArray extends ReadonlyArray<ReactNode> {}
240
- type ReactFragment = {} | Iterable<ReactNode>;
228
+ type ReactFragment = Iterable<ReactNode>;
241
229
  type ReactNode = ReactChild | ReactFragment | ReactPortal | boolean | null | undefined;
242
230
 
243
231
  //
@@ -396,16 +384,10 @@ declare namespace React {
396
384
  interface SuspenseProps {
397
385
  children?: ReactNode | undefined;
398
386
 
399
- // TODO(react18): `fallback?: ReactNode;`
400
387
  /** A fallback react tree to show when a Suspense child (like React.lazy) suspends */
401
- fallback: NonNullable<ReactNode>|null;
388
+ fallback?: ReactNode;
402
389
  }
403
390
 
404
- // TODO(react18): Updated JSDoc to reflect that Suspense works on the server.
405
- /**
406
- * This feature is not yet available for server-side rendering.
407
- * Suspense support will be added in a later release.
408
- */
409
391
  const Suspense: ExoticComponent<SuspenseProps>;
410
392
  const version: string;
411
393
 
@@ -476,8 +458,7 @@ declare namespace React {
476
458
  *
477
459
  * @see https://reactjs.org/docs/context.html
478
460
  */
479
- // TODO (TypeScript 3.0): unknown
480
- context: any;
461
+ context: unknown;
481
462
 
482
463
  constructor(props: Readonly<P> | P);
483
464
  /**
@@ -497,12 +478,7 @@ declare namespace React {
497
478
  forceUpdate(callback?: () => void): void;
498
479
  render(): ReactNode;
499
480
 
500
- // React.Props<T> is now deprecated, which means that the `children`
501
- // property is not available on `P` by default, even though you can
502
- // always pass children as variadic arguments to `createElement`.
503
- // In the future, if we can define its call signature conditionally
504
- // on the existence of `children` in `P`, then we should remove this.
505
- readonly props: Readonly<P> & Readonly<{ children?: ReactNode | undefined }>;
481
+ readonly props: Readonly<P>;
506
482
  state: Readonly<S>;
507
483
  /**
508
484
  * @deprecated
@@ -529,26 +505,10 @@ declare namespace React {
529
505
  // Class Interfaces
530
506
  // ----------------------------------------------------------------------
531
507
 
532
- /**
533
- * @deprecated as of recent React versions, function components can no
534
- * longer be considered 'stateless'. Please use `FunctionComponent` instead.
535
- *
536
- * @see [React Hooks](https://reactjs.org/docs/hooks-intro.html)
537
- */
538
- type SFC<P = {}> = FunctionComponent<P>;
539
-
540
- /**
541
- * @deprecated as of recent React versions, function components can no
542
- * longer be considered 'stateless'. Please use `FunctionComponent` instead.
543
- *
544
- * @see [React Hooks](https://reactjs.org/docs/hooks-intro.html)
545
- */
546
- type StatelessComponent<P = {}> = FunctionComponent<P>;
547
-
548
508
  type FC<P = {}> = FunctionComponent<P>;
549
509
 
550
510
  interface FunctionComponent<P = {}> {
551
- (props: PropsWithChildren<P>, context?: any): ReactElement<any, any> | null;
511
+ (props: P, context?: any): ReactElement<any, any> | null;
552
512
  propTypes?: WeakValidationMap<P> | undefined;
553
513
  contextTypes?: ValidationMap<any> | undefined;
554
514
  defaultProps?: Partial<P> | undefined;
@@ -568,7 +528,7 @@ declare namespace React {
568
528
  type ForwardedRef<T> = ((instance: T | null) => void) | MutableRefObject<T | null> | null;
569
529
 
570
530
  interface ForwardRefRenderFunction<T, P = {}> {
571
- (props: PropsWithChildren<P>, ref: ForwardedRef<T>): ReactElement | null;
531
+ (props: P, ref: ForwardedRef<T>): ReactElement | null;
572
532
  displayName?: string | undefined;
573
533
  // explicit rejected with `never` required due to
574
534
  // https://github.com/microsoft/TypeScript/issues/36826
@@ -582,12 +542,6 @@ declare namespace React {
582
542
  propTypes?: never | undefined;
583
543
  }
584
544
 
585
- /**
586
- * @deprecated Use ForwardRefRenderFunction. forwardRef doesn't accept a
587
- * "real" component.
588
- */
589
- interface RefForwardingComponent <T, P = {}> extends ForwardRefRenderFunction<T, P> {}
590
-
591
545
  interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
592
546
  new (props: P, context?: any): Component<P, S>;
593
547
  propTypes?: WeakValidationMap<P> | undefined;
@@ -862,7 +816,7 @@ declare namespace React {
862
816
 
863
817
  function memo<P extends object>(
864
818
  Component: FunctionComponent<P>,
865
- propsAreEqual?: (prevProps: Readonly<PropsWithChildren<P>>, nextProps: Readonly<PropsWithChildren<P>>) => boolean
819
+ propsAreEqual?: (prevProps: Readonly<P>, nextProps: Readonly<P>) => boolean
866
820
  ): NamedExoticComponent<P>;
867
821
  function memo<T extends ComponentType<any>>(
868
822
  Component: T,
@@ -901,8 +855,7 @@ declare namespace React {
901
855
  // The identity check is done with the SameValue algorithm (Object.is), which is stricter than ===
902
856
  type ReducerStateWithoutAction<R extends ReducerWithoutAction<any>> =
903
857
  R extends ReducerWithoutAction<infer S> ? S : never;
904
- // TODO (TypeScript 3.0): ReadonlyArray<unknown>
905
- type DependencyList = ReadonlyArray<any>;
858
+ type DependencyList = ReadonlyArray<unknown>;
906
859
 
907
860
  // NOTE: callbacks are _only_ allowed to return either void, or a destructor.
908
861
  type EffectCallback = () => (void | Destructor);
@@ -1109,8 +1062,10 @@ declare namespace React {
1109
1062
  * @version 16.8.0
1110
1063
  * @see https://reactjs.org/docs/hooks-reference.html#usecallback
1111
1064
  */
1112
- // TODO (TypeScript 3.0): <T extends (...args: never[]) => unknown>
1113
- function useCallback<T extends (...args: any[]) => any>(callback: T, deps: DependencyList): T;
1065
+ // A specific function type would not trigger implicit any.
1066
+ // See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/52873#issuecomment-845806435 for a comparison between `Function` and more specific types.
1067
+ // tslint:disable-next-line ban-types
1068
+ function useCallback<T extends Function>(callback: T, deps: DependencyList): T;
1114
1069
  /**
1115
1070
  * `useMemo` will only recompute the memoized value when one of the `deps` has changed.
1116
1071
  *
@@ -1132,6 +1087,83 @@ declare namespace React {
1132
1087
  // it's just the function name without the "use" prefix.
1133
1088
  function useDebugValue<T>(value: T, format?: (value: T) => any): void;
1134
1089
 
1090
+ // must be synchronous
1091
+ export type TransitionFunction = () => VoidOrUndefinedOnly;
1092
+ // strange definition to allow vscode to show documentation on the invocation
1093
+ export interface TransitionStartFunction {
1094
+ /**
1095
+ * State updates caused inside the callback are allowed to be deferred.
1096
+ *
1097
+ * **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
1098
+ *
1099
+ * @param callback A _synchronous_ function which causes state updates that can be deferred.
1100
+ */
1101
+ (callback: TransitionFunction): void;
1102
+ }
1103
+
1104
+ /**
1105
+ * Returns a deferred version of the value that may “lag behind” it for at most `timeoutMs`.
1106
+ *
1107
+ * This is commonly used to keep the interface responsive when you have something that renders immediately
1108
+ * based on user input and something that needs to wait for a data fetch.
1109
+ *
1110
+ * A good example of this is a text input.
1111
+ *
1112
+ * @param value The value that is going to be deferred
1113
+ *
1114
+ * @see https://reactjs.org/docs/concurrent-mode-reference.html#usedeferredvalue
1115
+ */
1116
+ export function useDeferredValue<T>(value: T): T;
1117
+
1118
+ /**
1119
+ * Allows components to avoid undesirable loading states by waiting for content to load
1120
+ * before transitioning to the next screen. It also allows components to defer slower,
1121
+ * data fetching updates until subsequent renders so that more crucial updates can be
1122
+ * rendered immediately.
1123
+ *
1124
+ * The `useTransition` hook returns two values in an array.
1125
+ *
1126
+ * The first is a boolean, React’s way of informing us whether we’re waiting for the transition to finish.
1127
+ * The second is a function that takes a callback. We can use it to tell React which state we want to defer.
1128
+ *
1129
+ * **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
1130
+ *
1131
+ * @param config An optional object with `timeoutMs`
1132
+ *
1133
+ * @see https://reactjs.org/docs/concurrent-mode-reference.html#usetransition
1134
+ */
1135
+ export function useTransition(): [boolean, TransitionStartFunction];
1136
+
1137
+ /**
1138
+ * Similar to `useTransition` but allows uses where hooks are not available.
1139
+ *
1140
+ * @param callback A _synchronous_ function which causes state updates that can be deferred.
1141
+ */
1142
+ export function startTransition(scope: TransitionFunction): void;
1143
+
1144
+ export function useId(): string;
1145
+
1146
+ /**
1147
+ * @param effect Imperative function that can return a cleanup function
1148
+ * @param deps If present, effect will only activate if the values in the list change.
1149
+ *
1150
+ * @see https://github.com/facebook/react/pull/21913
1151
+ */
1152
+ export function useInsertionEffect(effect: EffectCallback, deps?: DependencyList): void;
1153
+
1154
+ /**
1155
+ * @param subscribe
1156
+ * @param getSnapshot
1157
+ *
1158
+ * @see https://github.com/reactwg/react-18/discussions/86
1159
+ */
1160
+ // keep in sync with `useSyncExternalStore` from `use-sync-external-store`
1161
+ export function useSyncExternalStore<Snapshot>(
1162
+ subscribe: (onStoreChange: () => void) => () => void,
1163
+ getSnapshot: () => Snapshot,
1164
+ getServerSnapshot?: () => Snapshot,
1165
+ ): Snapshot;
1166
+
1135
1167
  //
1136
1168
  // Event System
1137
1169
  // ----------------------------------------------------------------------
@@ -1316,26 +1348,6 @@ declare namespace React {
1316
1348
  // Props / DOM Attributes
1317
1349
  // ----------------------------------------------------------------------
1318
1350
 
1319
- /**
1320
- * @deprecated. This was used to allow clients to pass `ref` and `key`
1321
- * to `createElement`, which is no longer necessary due to intersection
1322
- * types. If you need to declare a props object before passing it to
1323
- * `createElement` or a factory, use `ClassAttributes<T>`:
1324
- *
1325
- * ```ts
1326
- * var b: Button | null;
1327
- * var props: ButtonProps & ClassAttributes<Button> = {
1328
- * ref: b => button = b, // ok!
1329
- * label: "I'm a Button"
1330
- * };
1331
- * ```
1332
- */
1333
- interface Props<T> {
1334
- children?: ReactNode | undefined;
1335
- key?: Key | undefined;
1336
- ref?: LegacyRef<T> | undefined;
1337
- }
1338
-
1339
1351
  interface HTMLProps<T> extends AllHTMLAttributes<T>, ClassAttributes<T> {
1340
1352
  }
1341
1353
 
@@ -2780,7 +2792,7 @@ declare namespace React {
2780
2792
  bdi: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2781
2793
  bdo: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2782
2794
  big: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2783
- blockquote: DetailedHTMLFactory<BlockquoteHTMLAttributes<HTMLElement>, HTMLElement>;
2795
+ blockquote: DetailedHTMLFactory<BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
2784
2796
  body: DetailedHTMLFactory<HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>;
2785
2797
  br: DetailedHTMLFactory<HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
2786
2798
  button: DetailedHTMLFactory<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
@@ -2793,8 +2805,8 @@ declare namespace React {
2793
2805
  data: DetailedHTMLFactory<DataHTMLAttributes<HTMLDataElement>, HTMLDataElement>;
2794
2806
  datalist: DetailedHTMLFactory<HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>;
2795
2807
  dd: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2796
- del: DetailedHTMLFactory<DelHTMLAttributes<HTMLElement>, HTMLElement>;
2797
- details: DetailedHTMLFactory<DetailsHTMLAttributes<HTMLElement>, HTMLElement>;
2808
+ del: DetailedHTMLFactory<DelHTMLAttributes<HTMLModElement>, HTMLModElement>;
2809
+ details: DetailedHTMLFactory<DetailsHTMLAttributes<HTMLDetailsElement>, HTMLDetailsElement>;
2798
2810
  dfn: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2799
2811
  dialog: DetailedHTMLFactory<DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>;
2800
2812
  div: DetailedHTMLFactory<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
@@ -2835,14 +2847,14 @@ declare namespace React {
2835
2847
  menu: DetailedHTMLFactory<MenuHTMLAttributes<HTMLElement>, HTMLElement>;
2836
2848
  menuitem: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2837
2849
  meta: DetailedHTMLFactory<MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>;
2838
- meter: DetailedHTMLFactory<MeterHTMLAttributes<HTMLElement>, HTMLElement>;
2850
+ meter: DetailedHTMLFactory<MeterHTMLAttributes<HTMLMeterElement>, HTMLMeterElement>;
2839
2851
  nav: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2840
2852
  noscript: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2841
2853
  object: DetailedHTMLFactory<ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>;
2842
2854
  ol: DetailedHTMLFactory<OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>;
2843
2855
  optgroup: DetailedHTMLFactory<OptgroupHTMLAttributes<HTMLOptGroupElement>, HTMLOptGroupElement>;
2844
2856
  option: DetailedHTMLFactory<OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>;
2845
- output: DetailedHTMLFactory<OutputHTMLAttributes<HTMLElement>, HTMLElement>;
2857
+ output: DetailedHTMLFactory<OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>;
2846
2858
  p: DetailedHTMLFactory<HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>;
2847
2859
  param: DetailedHTMLFactory<ParamHTMLAttributes<HTMLParamElement>, HTMLParamElement>;
2848
2860
  picture: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
@@ -2874,7 +2886,7 @@ declare namespace React {
2874
2886
  tfoot: DetailedHTMLFactory<HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
2875
2887
  th: DetailedHTMLFactory<ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>;
2876
2888
  thead: DetailedHTMLFactory<HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
2877
- time: DetailedHTMLFactory<TimeHTMLAttributes<HTMLElement>, HTMLElement>;
2889
+ time: DetailedHTMLFactory<TimeHTMLAttributes<HTMLTimeElement>, HTMLTimeElement>;
2878
2890
  title: DetailedHTMLFactory<HTMLAttributes<HTMLTitleElement>, HTMLTitleElement>;
2879
2891
  tr: DetailedHTMLFactory<HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>;
2880
2892
  track: DetailedHTMLFactory<TrackHTMLAttributes<HTMLTrackElement>, HTMLTrackElement>;
@@ -3111,7 +3123,7 @@ declare global {
3111
3123
  bdi: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3112
3124
  bdo: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3113
3125
  big: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3114
- blockquote: React.DetailedHTMLProps<React.BlockquoteHTMLAttributes<HTMLElement>, HTMLElement>;
3126
+ blockquote: React.DetailedHTMLProps<React.BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
3115
3127
  body: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>;
3116
3128
  br: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
3117
3129
  button: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
@@ -3124,8 +3136,8 @@ declare global {
3124
3136
  data: React.DetailedHTMLProps<React.DataHTMLAttributes<HTMLDataElement>, HTMLDataElement>;
3125
3137
  datalist: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>;
3126
3138
  dd: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3127
- del: React.DetailedHTMLProps<React.DelHTMLAttributes<HTMLElement>, HTMLElement>;
3128
- details: React.DetailedHTMLProps<React.DetailsHTMLAttributes<HTMLElement>, HTMLElement>;
3139
+ del: React.DetailedHTMLProps<React.DelHTMLAttributes<HTMLModElement>, HTMLModElement>;
3140
+ details: React.DetailedHTMLProps<React.DetailsHTMLAttributes<HTMLDetailsElement>, HTMLDetailsElement>;
3129
3141
  dfn: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3130
3142
  dialog: React.DetailedHTMLProps<React.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>;
3131
3143
  div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
@@ -3166,7 +3178,7 @@ declare global {
3166
3178
  menu: React.DetailedHTMLProps<React.MenuHTMLAttributes<HTMLElement>, HTMLElement>;
3167
3179
  menuitem: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3168
3180
  meta: React.DetailedHTMLProps<React.MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>;
3169
- meter: React.DetailedHTMLProps<React.MeterHTMLAttributes<HTMLElement>, HTMLElement>;
3181
+ meter: React.DetailedHTMLProps<React.MeterHTMLAttributes<HTMLMeterElement>, HTMLMeterElement>;
3170
3182
  nav: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3171
3183
  noindex: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3172
3184
  noscript: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
@@ -3174,7 +3186,7 @@ declare global {
3174
3186
  ol: React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>;
3175
3187
  optgroup: React.DetailedHTMLProps<React.OptgroupHTMLAttributes<HTMLOptGroupElement>, HTMLOptGroupElement>;
3176
3188
  option: React.DetailedHTMLProps<React.OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>;
3177
- output: React.DetailedHTMLProps<React.OutputHTMLAttributes<HTMLElement>, HTMLElement>;
3189
+ output: React.DetailedHTMLProps<React.OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>;
3178
3190
  p: React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>;
3179
3191
  param: React.DetailedHTMLProps<React.ParamHTMLAttributes<HTMLParamElement>, HTMLParamElement>;
3180
3192
  picture: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
@@ -3206,7 +3218,7 @@ declare global {
3206
3218
  tfoot: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
3207
3219
  th: React.DetailedHTMLProps<React.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>;
3208
3220
  thead: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
3209
- time: React.DetailedHTMLProps<React.TimeHTMLAttributes<HTMLElement>, HTMLElement>;
3221
+ time: React.DetailedHTMLProps<React.TimeHTMLAttributes<HTMLTimeElement>, HTMLTimeElement>;
3210
3222
  title: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTitleElement>, HTMLTitleElement>;
3211
3223
  tr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>;
3212
3224
  track: React.DetailedHTMLProps<React.TrackHTMLAttributes<HTMLTrackElement>, HTMLTrackElement>;
react/next.d.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  /**
2
- * These are types for things that are present in the upcoming React 18 release.
3
- *
4
- * Once React 18 is released they can just be moved to the main index file.
2
+ * These are types for things that are present in the React `next` release channel.
5
3
  *
6
4
  * To load the types declared here in an actual project, there are three ways. The easiest one,
7
5
  * if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section,
@@ -23,126 +21,10 @@
23
21
  * Either the import or the reference only needs to appear once, anywhere in the project.
24
22
  */
25
23
 
26
- // See https://github.com/facebook/react/blob/master/packages/react/src/React.js to see how the exports are declared,
24
+ // See https://github.com/facebook/react/blob/main/packages/react/src/React.js to see how the exports are declared,
27
25
 
28
26
  import React = require('.');
29
27
 
30
28
  export {};
31
29
 
32
- declare const UNDEFINED_VOID_ONLY: unique symbol;
33
- type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
34
-
35
- declare module '.' {
36
- export interface SuspenseProps {
37
- /**
38
- * The presence of this prop indicates that the content is computationally expensive to render.
39
- * In other words, the tree is CPU bound and not I/O bound (e.g. due to fetching data).
40
- * @see {@link https://github.com/facebook/react/pull/19936}
41
- */
42
- unstable_expectedLoadTime?: number | undefined;
43
- }
44
-
45
- // must be synchronous
46
- export type TransitionFunction = () => VoidOrUndefinedOnly;
47
- // strange definition to allow vscode to show documentation on the invocation
48
- export interface TransitionStartFunction {
49
- /**
50
- * State updates caused inside the callback are allowed to be deferred.
51
- *
52
- * **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
53
- *
54
- * @param callback A _synchronous_ function which causes state updates that can be deferred.
55
- */
56
- (callback: TransitionFunction): void;
57
- }
58
-
59
- /**
60
- * Returns a deferred version of the value that may “lag behind” it for at most `timeoutMs`.
61
- *
62
- * This is commonly used to keep the interface responsive when you have something that renders immediately
63
- * based on user input and something that needs to wait for a data fetch.
64
- *
65
- * A good example of this is a text input.
66
- *
67
- * @param value The value that is going to be deferred
68
- *
69
- * @see https://reactjs.org/docs/concurrent-mode-reference.html#usedeferredvalue
70
- */
71
- export function useDeferredValue<T>(value: T): T;
72
-
73
- /**
74
- * Allows components to avoid undesirable loading states by waiting for content to load
75
- * before transitioning to the next screen. It also allows components to defer slower,
76
- * data fetching updates until subsequent renders so that more crucial updates can be
77
- * rendered immediately.
78
- *
79
- * The `useTransition` hook returns two values in an array.
80
- *
81
- * The first is a boolean, React’s way of informing us whether we’re waiting for the transition to finish.
82
- * The second is a function that takes a callback. We can use it to tell React which state we want to defer.
83
- *
84
- * **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
85
- *
86
- * @param config An optional object with `timeoutMs`
87
- *
88
- * @see https://reactjs.org/docs/concurrent-mode-reference.html#usetransition
89
- */
90
- export function useTransition(): [boolean, TransitionStartFunction];
91
-
92
- /**
93
- * Similar to `useTransition` but allows uses where hooks are not available.
94
- *
95
- * @param callback A _synchronous_ function which causes state updates that can be deferred.
96
- */
97
- export function startTransition(scope: TransitionFunction): void;
98
-
99
- export function useId(): string;
100
-
101
- /**
102
- * this should be an internal type
103
- */
104
- interface MutableSource<T> {
105
- _source: T;
106
- }
107
-
108
- export type MutableSourceSubscribe<T> = (source: T, callback: () => void) => () => void;
109
-
110
- /**
111
- * @param source A source could be anything as long as they can be subscribed to and have a "version".
112
- * @param getVersion A function returns a value which will change whenever part of the source changes.
113
- */
114
- export function unstable_createMutableSource<T>(source: T, getVersion: () => any): MutableSource<T>;
115
-
116
- /**
117
- * useMutableSource() enables React components to safely and efficiently read from a mutable external source in Concurrent Mode.
118
- * The API will detect mutations that occur during a render to avoid tearing
119
- * and it will automatically schedule updates when the source is mutated.
120
- * @param MutableSource
121
- * @param getSnapshot
122
- * @param subscribe
123
- *
124
- * @see https://github.com/reactjs/rfcs/blob/master/text/0147-use-mutable-source.md
125
- */
126
- export function unstable_useMutableSource<T, TResult extends unknown>(MutableSource: MutableSource<T>, getSnapshot: (source: T) => TResult, subscribe: MutableSourceSubscribe<T>): TResult;
127
-
128
- /**
129
- * @param effect Imperative function that can return a cleanup function
130
- * @param deps If present, effect will only activate if the values in the list change.
131
- *
132
- * @see https://github.com/facebook/react/pull/21913
133
- */
134
- export function useInsertionEffect(effect: EffectCallback, deps?: DependencyList): void;
135
-
136
- /**
137
- * @param subscribe
138
- * @param getSnapshot
139
- *
140
- * @see https://github.com/reactwg/react-18/discussions/86
141
- */
142
- // keep in sync with `useSyncExternalStore` from `use-sync-external-store`
143
- export function useSyncExternalStore<Snapshot>(
144
- subscribe: (onStoreChange: () => void) => () => void,
145
- getSnapshot: () => Snapshot,
146
- getServerSnapshot?: () => Snapshot,
147
- ): Snapshot;
148
- }
30
+ declare module '.' {}
react/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react",
3
- "version": "17.0.42",
3
+ "version": "18.0.0",
4
4
  "description": "TypeScript definitions for React",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
6
6
  "license": "MIT",
@@ -146,6 +146,6 @@
146
146
  "@types/scheduler": "*",
147
147
  "csstype": "^3.0.2"
148
148
  },
149
- "typesPublisherContentHash": "c011feb2208b1232e6acab0b32a72a64cb4d3cf1106a3e334204a40d98259729",
149
+ "typesPublisherContentHash": "6779161312d4a456b9a73a478b25f72f9b02fc5b0117762da5cfd6e0883bb745",
150
150
  "typeScriptVersion": "3.9"
151
151
  }