@types/react 18.2.61 → 18.2.63

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 (https://react.dev/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Thu, 29 Feb 2024 12:09:49 GMT
11
+ * Last updated: Tue, 05 Mar 2024 09:07:02 GMT
12
12
  * Dependencies: [@types/prop-types](https://npmjs.com/package/@types/prop-types), [@types/scheduler](https://npmjs.com/package/@types/scheduler), [csstype](https://npmjs.com/package/csstype)
13
13
 
14
14
  # Credits
react/index.d.ts CHANGED
@@ -425,7 +425,8 @@ declare namespace React {
425
425
  */
426
426
  interface ReactNodeArray extends ReadonlyArray<ReactNode> {}
427
427
  /**
428
- * @deprecated - This type is not relevant when using React. Inline the type instead to make the intent clear.
428
+ * WARNING: Not related to `React.Fragment`.
429
+ * @deprecated This type is not relevant when using React. Inline the type instead to make the intent clear.
429
430
  */
430
431
  type ReactFragment = Iterable<ReactNode>;
431
432
 
@@ -755,6 +756,8 @@ declare namespace React {
755
756
  * ```
756
757
  */
757
758
  function createContext<T>(
759
+ // If you thought this should be optional, see
760
+ // https://github.com/DefinitelyTyped/DefinitelyTyped/pull/24509#issuecomment-382213106
758
761
  defaultValue: T,
759
762
  ): Context<T>;
760
763
 
react/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react",
3
- "version": "18.2.61",
3
+ "version": "18.2.63",
4
4
  "description": "TypeScript definitions for react",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
6
6
  "license": "MIT",
@@ -206,6 +206,6 @@
206
206
  "@types/scheduler": "*",
207
207
  "csstype": "^3.0.2"
208
208
  },
209
- "typesPublisherContentHash": "c969d4c49fc5be8c9712e6a7cc38c14d908da611af884cf2da96ba279fe8495e",
209
+ "typesPublisherContentHash": "1c776ccaaf3e7fd3a7453212040e2651d536494da2d21b001a1c76a11b0c565f",
210
210
  "typeScriptVersion": "4.6"
211
211
  }
react/ts5.0/canary.d.ts CHANGED
@@ -95,7 +95,7 @@ declare module "." {
95
95
  /**
96
96
  * Marks all state updates inside the async function as transitions
97
97
  *
98
- * @see {https://react.dev/reference/react/ts5.0/useTransition#starttransition}
98
+ * @see {https://react.dev/reference/react/useTransition#starttransition}
99
99
  *
100
100
  * @param callback
101
101
  */
react/ts5.0/index.d.ts CHANGED
@@ -91,8 +91,11 @@ declare namespace React {
91
91
  | ComponentType<P>;
92
92
 
93
93
  /**
94
- * Represents any user-defined component, either as a function component or
95
- * a class component.
94
+ * Represents any user-defined component, either as a function or a class.
95
+ *
96
+ * Similar to {@link JSXElementConstructor}, but with extra properties like
97
+ * {@link FunctionComponent.defaultProps defaultProps } and
98
+ * {@link ComponentClass.contextTypes contextTypes}.
96
99
  *
97
100
  * @template P The props the component accepts.
98
101
  *
@@ -283,11 +286,14 @@ declare namespace React {
283
286
  interface RefAttributes<T> extends Attributes {
284
287
  /**
285
288
  * Allows getting a ref to the component instance.
286
- * Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref).
287
- * @see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom}
289
+ * Once the component unmounts, React will set `ref.current` to `null`
290
+ * (or call the ref with `null` if you passed a callback ref).
291
+ *
292
+ * @see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}
288
293
  */
289
294
  ref?: LegacyRef<T> | undefined;
290
295
  }
296
+
291
297
  /**
292
298
  * Represents the built-in attributes available to class components.
293
299
  */
@@ -336,7 +342,7 @@ declare namespace React {
336
342
  }
337
343
 
338
344
  /**
339
- * @deprecated Use `ComponentElement<P, ClassicComponent<P, any>>` instead.
345
+ * @deprecated Use {@link ComponentElement} instead.
340
346
  */
341
347
  type ClassicElement<P> = CElement<P, ClassicComponent<P, ComponentState>>;
342
348
 
@@ -420,7 +426,7 @@ declare namespace React {
420
426
  interface ReactNodeArray extends ReadonlyArray<ReactNode> {}
421
427
  /**
422
428
  * WARNING: Not related to `React.Fragment`.
423
- * @deprecated - This type is not relevant when using React. Inline the type instead to make the intent clear.
429
+ * @deprecated This type is not relevant when using React. Inline the type instead to make the intent clear.
424
430
  */
425
431
  type ReactFragment = Iterable<ReactNode>;
426
432
 
@@ -939,7 +945,6 @@ declare namespace React {
939
945
  // Base component for plain JS classes
940
946
  interface Component<P = {}, S = {}, SS = any> extends ComponentLifecycle<P, S, SS> {}
941
947
  class Component<P, S> {
942
- // tslint won't let me format the sample code in a way that vscode likes it :(
943
948
  /**
944
949
  * If set, `this.context` will be set at runtime to the current value of the given Context.
945
950
  *
@@ -968,7 +973,6 @@ declare namespace React {
968
973
  * Should be used with type annotation or static contextType.
969
974
  *
970
975
  * @example
971
- *
972
976
  * ```ts
973
977
  * static contextType = MyContext
974
978
  * // For TS pre-3.7:
@@ -977,14 +981,14 @@ declare namespace React {
977
981
  * declare context: React.ContextType<typeof MyContext>
978
982
  * ```
979
983
  *
980
- * @see {@link https://react.dev/reference/react/Component#context}
984
+ * @see {@link https://react.dev/reference/react/Component#context React Docs}
981
985
  */
982
986
  context: unknown;
983
987
 
984
988
  constructor(props: Readonly<P> | P);
985
989
  /**
986
990
  * @deprecated
987
- * @see {@link https://legacy.reactjs.org/docs/legacy-context.html}
991
+ * @see {@link https://legacy.reactjs.org/docs/legacy-context.html React Docs}
988
992
  */
989
993
  constructor(props: P, context: any);
990
994
 
@@ -1003,7 +1007,8 @@ declare namespace React {
1003
1007
  state: Readonly<S>;
1004
1008
  /**
1005
1009
  * @deprecated
1006
- * https://legacy.reactjs.org/docs/refs-and-the-dom.html#legacy-api-string-refs
1010
+ *
1011
+ * @see {@link https://legacy.reactjs.org/docs/refs-and-the-dom.html#legacy-api-string-refs Legacy React Docs}
1007
1012
  */
1008
1013
  refs: {
1009
1014
  [key: string]: ReactInstance;
@@ -1159,6 +1164,7 @@ declare namespace React {
1159
1164
  * @deprecated - Equivalent to {@link React.FunctionComponent}.
1160
1165
  *
1161
1166
  * @see {@link React.FunctionComponent}
1167
+ * @alias {@link VoidFunctionComponent}
1162
1168
  */
1163
1169
  type VFC<P = {}> = VoidFunctionComponent<P>;
1164
1170
 
@@ -1386,7 +1392,7 @@ declare namespace React {
1386
1392
  * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents
1387
1393
  * this from being invoked.
1388
1394
  *
1389
- * @deprecated 16.3, use componentDidMount or the constructor instead; will stop working in React 17
1395
+ * @deprecated 16.3, use {@link ComponentLifecycle.componentDidMount componentDidMount} or the constructor instead; will stop working in React 17
1390
1396
  * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state}
1391
1397
  * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
1392
1398
  */
@@ -1401,7 +1407,7 @@ declare namespace React {
1401
1407
  * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents
1402
1408
  * this from being invoked.
1403
1409
  *
1404
- * @deprecated 16.3, use componentDidMount or the constructor instead
1410
+ * @deprecated 16.3, use {@link ComponentLifecycle.componentDidMount componentDidMount} or the constructor instead
1405
1411
  * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state}
1406
1412
  * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
1407
1413
  */
@@ -1417,7 +1423,7 @@ declare namespace React {
1417
1423
  * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents
1418
1424
  * this from being invoked.
1419
1425
  *
1420
- * @deprecated 16.3, use static getDerivedStateFromProps instead; will stop working in React 17
1426
+ * @deprecated 16.3, use static {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} instead; will stop working in React 17
1421
1427
  * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props}
1422
1428
  * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
1423
1429
  */
@@ -1435,7 +1441,7 @@ declare namespace React {
1435
1441
  * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents
1436
1442
  * this from being invoked.
1437
1443
  *
1438
- * @deprecated 16.3, use static getDerivedStateFromProps instead
1444
+ * @deprecated 16.3, use static {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} instead
1439
1445
  * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props}
1440
1446
  * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
1441
1447
  */
@@ -1473,7 +1479,9 @@ declare namespace React {
1473
1479
  }
1474
1480
 
1475
1481
  /**
1476
- * @deprecated https://legacy.reactjs.org/blog/2016/07/13/mixins-considered-harmful.html
1482
+ * @deprecated
1483
+ *
1484
+ * @see {@link https://legacy.reactjs.org/blog/2016/07/13/mixins-considered-harmful.html Mixins Considered Harmful}
1477
1485
  */
1478
1486
  interface Mixin<P, S> extends ComponentLifecycle<P, S> {
1479
1487
  mixins?: Array<Mixin<P, S>> | undefined;
@@ -1712,9 +1720,11 @@ declare namespace React {
1712
1720
  propsAreEqual?: (prevProps: Readonly<ComponentProps<T>>, nextProps: Readonly<ComponentProps<T>>) => boolean,
1713
1721
  ): MemoExoticComponent<T>;
1714
1722
 
1715
- type LazyExoticComponent<T extends ComponentType<any>> = ExoticComponent<CustomComponentPropsWithRef<T>> & {
1723
+ interface LazyExoticComponent<T extends ComponentType<any>>
1724
+ extends ExoticComponent<CustomComponentPropsWithRef<T>>
1725
+ {
1716
1726
  readonly _result: T;
1717
- };
1727
+ }
1718
1728
 
1719
1729
  /**
1720
1730
  * Lets you defer loading a component’s code until it is rendered for the first time.
@@ -1744,8 +1754,6 @@ declare namespace React {
1744
1754
  // React Hooks
1745
1755
  // ----------------------------------------------------------------------
1746
1756
 
1747
- // based on the code in https://github.com/facebook/react/pull/13968
1748
-
1749
1757
  /**
1750
1758
  * The instruction passed to a {@link Dispatch} function in {@link useState}
1751
1759
  * to tell React what the next value of the {@link useState} should be.
@@ -3177,6 +3185,7 @@ declare namespace React {
3177
3185
  alt?: string | undefined;
3178
3186
  crossOrigin?: CrossOrigin;
3179
3187
  decoding?: "async" | "auto" | "sync" | undefined;
3188
+ fetchPriority?: "high" | "low" | "auto";
3180
3189
  height?: number | string | undefined;
3181
3190
  loading?: "eager" | "lazy" | undefined;
3182
3191
  referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
@@ -4147,9 +4156,11 @@ declare namespace React {
4147
4156
  /**
4148
4157
  * Captures which component contained the exception, and its ancestors.
4149
4158
  */
4150
- componentStack: string;
4159
+ componentStack?: string | null;
4160
+ digest?: string | null;
4151
4161
  }
4152
4162
 
4163
+ // Keep in sync with JSX namespace in ./jsx-runtime.d.ts and ./jsx-dev-runtime.d.ts
4153
4164
  namespace JSX {
4154
4165
  interface Element extends GlobalJSXElement {}
4155
4166
  interface ElementClass extends GlobalJSXElementClass {}