@types/react 18.2.7 → 18.2.9

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: Wed, 24 May 2023 14:32:47 GMT
11
+ * Last updated: Wed, 07 Jun 2023 20:32:46 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
@@ -82,7 +82,7 @@ declare namespace React {
82
82
  * @deprecated https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-stateless-function-components
83
83
  */
84
84
  deprecatedLegacyContext?: any,
85
- ) => ReactElement<any, any> | null)
85
+ ) => ReactNode)
86
86
  | (new (props: P) => Component<any, any>);
87
87
 
88
88
  interface RefObject<T> {
@@ -113,7 +113,7 @@ declare namespace React {
113
113
  C extends
114
114
  | ForwardRefExoticComponent<any>
115
115
  | { new (props: any): Component<any> }
116
- | ((props: any, context?: any) => ReactElement | null)
116
+ | ((props: any, context?: any) => ReactNode)
117
117
  | keyof JSX.IntrinsicElements
118
118
  > =
119
119
  // need to check first if `ref` is a valid prop for ts@3.0
@@ -380,7 +380,7 @@ declare namespace React {
380
380
  /**
381
381
  * **NOTE**: Exotic components are not callable.
382
382
  */
383
- (props: P): (ReactElement|null);
383
+ (props: P): ReactNode;
384
384
  readonly $$typeof: symbol;
385
385
  }
386
386
 
@@ -550,7 +550,7 @@ declare namespace React {
550
550
  type FC<P = {}> = FunctionComponent<P>;
551
551
 
552
552
  interface FunctionComponent<P = {}> {
553
- (props: P, context?: any): ReactElement<any, any> | null;
553
+ (props: P, context?: any): ReactNode;
554
554
  propTypes?: WeakValidationMap<P> | undefined;
555
555
  contextTypes?: ValidationMap<any> | undefined;
556
556
  defaultProps?: Partial<P> | undefined;
@@ -566,7 +566,7 @@ declare namespace React {
566
566
  * @deprecated - Equivalent with `React.FunctionComponent`.
567
567
  */
568
568
  interface VoidFunctionComponent<P = {}> {
569
- (props: P, context?: any): ReactElement<any, any> | null;
569
+ (props: P, context?: any): ReactNode;
570
570
  propTypes?: WeakValidationMap<P> | undefined;
571
571
  contextTypes?: ValidationMap<any> | undefined;
572
572
  defaultProps?: Partial<P> | undefined;
@@ -576,7 +576,7 @@ declare namespace React {
576
576
  type ForwardedRef<T> = ((instance: T | null) => void) | MutableRefObject<T | null> | null;
577
577
 
578
578
  interface ForwardRefRenderFunction<T, P = {}> {
579
- (props: P, ref: ForwardedRef<T>): ReactElement | null;
579
+ (props: P, ref: ForwardedRef<T>): ReactNode;
580
580
  displayName?: string | undefined;
581
581
  // explicit rejected with `never` required due to
582
582
  // https://github.com/microsoft/TypeScript/issues/36826
@@ -1633,6 +1633,16 @@ declare namespace React {
1633
1633
  */
1634
1634
  'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both' | undefined;
1635
1635
  /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user. */
1636
+ /**
1637
+ * Defines a string value that labels the current element, which is intended to be converted into Braille.
1638
+ * @see aria-label.
1639
+ */
1640
+ 'aria-braillelabel'?: string | undefined;
1641
+ /**
1642
+ * Defines a human-readable, author-localized abbreviated description for the role of an element, which is intended to be converted into Braille.
1643
+ * @see aria-roledescription.
1644
+ */
1645
+ 'aria-brailleroledescription'?: string | undefined;
1636
1646
  'aria-busy'?: Booleanish | undefined;
1637
1647
  /**
1638
1648
  * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.
@@ -1649,6 +1659,11 @@ declare namespace React {
1649
1659
  * @see aria-colcount @see aria-colspan.
1650
1660
  */
1651
1661
  'aria-colindex'?: number | undefined;
1662
+ /**
1663
+ * Defines a human readable text alternative of aria-colindex.
1664
+ * @see aria-rowindextext.
1665
+ */
1666
+ 'aria-colindextext'?: string | undefined;
1652
1667
  /**
1653
1668
  * Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.
1654
1669
  * @see aria-colindex @see aria-rowspan.
@@ -1666,6 +1681,11 @@ declare namespace React {
1666
1681
  * @see aria-labelledby
1667
1682
  */
1668
1683
  'aria-describedby'?: string | undefined;
1684
+ /**
1685
+ * Defines a string value that describes or annotates the current element.
1686
+ * @see related aria-describedby.
1687
+ */
1688
+ 'aria-description'?: string | undefined;
1669
1689
  /**
1670
1690
  * Identifies the element that provides a detailed, extended description for the object.
1671
1691
  * @see aria-describedby.
@@ -1779,6 +1799,11 @@ declare namespace React {
1779
1799
  * @see aria-rowcount @see aria-rowspan.
1780
1800
  */
1781
1801
  'aria-rowindex'?: number | undefined;
1802
+ /**
1803
+ * Defines a human readable text alternative of aria-rowindex.
1804
+ * @see aria-colindextext.
1805
+ */
1806
+ 'aria-rowindextext'?: string | undefined;
1782
1807
  /**
1783
1808
  * Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.
1784
1809
  * @see aria-rowindex @see aria-colspan.
@@ -3125,7 +3150,9 @@ declare namespace React {
3125
3150
  componentStack: string;
3126
3151
  }
3127
3152
 
3153
+ // Keep in sync with JSX namespace in ./jsx-runtime.d.ts and ./jsx-dev-runtime.d.ts
3128
3154
  namespace JSX {
3155
+ type ElementType = GlobalJSXElementType;
3129
3156
  interface Element extends GlobalJSXElement {}
3130
3157
  interface ElementClass extends GlobalJSXElementClass {}
3131
3158
  interface ElementAttributesProperty extends GlobalJSXElementAttributesProperty {}
@@ -3188,6 +3215,18 @@ declare global {
3188
3215
  * @deprecated Use `React.JSX` instead of the global `JSX` namespace.
3189
3216
  */
3190
3217
  namespace JSX {
3218
+ // We don't just alias React.ElementType because React.ElementType
3219
+ // historically does more than we need it to.
3220
+ // E.g. it also contains .propTypes and so TS also verifies the declared
3221
+ // props type does match the declared .propTypes.
3222
+ // But if libraries declared their .propTypes but not props type,
3223
+ // or they mismatch, you won't be able to use the class component
3224
+ // as a JSX.ElementType.
3225
+ // We could fix this everywhere but we're ultimately not interested in
3226
+ // .propTypes assignability so we might as well drop it entirely here to
3227
+ // reduce the work of the type-checker.
3228
+ // TODO: Check impact of making React.ElementType<P = any> = React.JSXElementConstructor<P>
3229
+ type ElementType = string | React.JSXElementConstructor<any>;
3191
3230
  interface Element extends React.ReactElement<any, any> { }
3192
3231
  interface ElementClass extends React.Component<any> {
3193
3232
  render(): React.ReactNode;
@@ -3394,6 +3433,7 @@ declare global {
3394
3433
  // React.JSX needs to point to global.JSX to keep global module augmentations intact.
3395
3434
  // But we can't access global.JSX so we need to create these aliases instead.
3396
3435
  // Once the global JSX namespace will be removed we replace React.JSX with the contents of global.JSX
3436
+ type GlobalJSXElementType = JSX.ElementType;
3397
3437
  interface GlobalJSXElement extends JSX.Element {}
3398
3438
  interface GlobalJSXElementClass extends JSX.ElementClass {}
3399
3439
  interface GlobalJSXElementAttributesProperty extends JSX.ElementAttributesProperty {}
@@ -1,6 +1,7 @@
1
1
  import * as React from './';
2
2
 
3
3
  export namespace JSX {
4
+ type ElementType = React.JSX.ElementType;
4
5
  interface Element extends React.JSX.Element {}
5
6
  interface ElementClass extends React.JSX.ElementClass {}
6
7
  interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {}
react/jsx-runtime.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as React from './';
2
2
 
3
3
  export namespace JSX {
4
+ type ElementType = React.JSX.ElementType;
4
5
  interface Element extends React.JSX.Element {}
5
6
  interface ElementClass extends React.JSX.ElementClass {}
6
7
  interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {}
react/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react",
3
- "version": "18.2.7",
3
+ "version": "18.2.9",
4
4
  "description": "TypeScript definitions for React",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
6
6
  "license": "MIT",
@@ -158,7 +158,7 @@
158
158
  "@types/scheduler": "*",
159
159
  "csstype": "^3.0.2"
160
160
  },
161
- "typesPublisherContentHash": "bb5350973ee9e7716f78b08a665dedf1d8a38f1c9720199a6716cbcd7568e4df",
161
+ "typesPublisherContentHash": "830e4d7bc5822cf6ff77d3cb527f1cf755418081f5afbd1cc9d6c9ff0c8a9e2d",
162
162
  "typeScriptVersion": "4.3",
163
163
  "exports": {
164
164
  ".": {
react/ts5.0/index.d.ts CHANGED
@@ -1601,6 +1601,16 @@ declare namespace React {
1601
1601
  */
1602
1602
  'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both' | undefined;
1603
1603
  /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user. */
1604
+ /**
1605
+ * Defines a string value that labels the current element, which is intended to be converted into Braille.
1606
+ * @see aria-label.
1607
+ */
1608
+ 'aria-braillelabel'?: string | undefined;
1609
+ /**
1610
+ * Defines a human-readable, author-localized abbreviated description for the role of an element, which is intended to be converted into Braille.
1611
+ * @see aria-roledescription.
1612
+ */
1613
+ 'aria-brailleroledescription'?: string | undefined;
1604
1614
  'aria-busy'?: Booleanish | undefined;
1605
1615
  /**
1606
1616
  * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.
@@ -1617,6 +1627,11 @@ declare namespace React {
1617
1627
  * @see aria-colcount @see aria-colspan.
1618
1628
  */
1619
1629
  'aria-colindex'?: number | undefined;
1630
+ /**
1631
+ * Defines a human readable text alternative of aria-colindex.
1632
+ * @see aria-rowindextext.
1633
+ */
1634
+ 'aria-colindextext'?: string | undefined;
1620
1635
  /**
1621
1636
  * Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.
1622
1637
  * @see aria-colindex @see aria-rowspan.
@@ -1634,6 +1649,11 @@ declare namespace React {
1634
1649
  * @see aria-labelledby
1635
1650
  */
1636
1651
  'aria-describedby'?: string | undefined;
1652
+ /**
1653
+ * Defines a string value that describes or annotates the current element.
1654
+ * @see related aria-describedby.
1655
+ */
1656
+ 'aria-description'?: string | undefined;
1637
1657
  /**
1638
1658
  * Identifies the element that provides a detailed, extended description for the object.
1639
1659
  * @see aria-describedby.
@@ -1747,6 +1767,11 @@ declare namespace React {
1747
1767
  * @see aria-rowcount @see aria-rowspan.
1748
1768
  */
1749
1769
  'aria-rowindex'?: number | undefined;
1770
+ /**
1771
+ * Defines a human readable text alternative of aria-rowindex.
1772
+ * @see aria-colindextext.
1773
+ */
1774
+ 'aria-rowindextext'?: string | undefined;
1750
1775
  /**
1751
1776
  * Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.
1752
1777
  * @see aria-rowindex @see aria-colspan.