@types/react 17.0.17 → 17.0.21

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.
Files changed (3) hide show
  1. react/README.md +1 -1
  2. react/index.d.ts +49 -17
  3. react/package.json +3 -3
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, 11 Aug 2021 02:31:26 GMT
11
+ * Last updated: Tue, 14 Sep 2021 21:01:34 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
@@ -805,11 +805,10 @@ declare namespace React {
805
805
 
806
806
  /** Ensures that the props do not include ref at all */
807
807
  type PropsWithoutRef<P> =
808
- // Just Pick would be sufficient for this, but I'm trying to avoid unnecessary mapping over union types
808
+ // Pick would not be sufficient for this. We'd like to avoid unnecessary mapping and need a distributive conditional to support unions.
809
+ // see: https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types
809
810
  // https://github.com/Microsoft/TypeScript/issues/28339
810
- 'ref' extends keyof P
811
- ? Pick<P, Exclude<keyof P, 'ref'>>
812
- : P;
811
+ P extends any ? ('ref' extends keyof P ? Pick<P, Exclude<keyof P, 'ref'>> : P) : P;
813
812
  /** Ensures that the props do not include string ref, which cannot be forwarded */
814
813
  type PropsWithRef<P> =
815
814
  // Just "P extends { ref?: infer R }" looks sufficient, but R will infer as {} if P is {}.
@@ -840,6 +839,14 @@ declare namespace React {
840
839
  type ComponentPropsWithoutRef<T extends ElementType> =
841
840
  PropsWithoutRef<ComponentProps<T>>;
842
841
 
842
+ type ComponentRef<T extends ElementType> = T extends NamedExoticComponent<
843
+ ComponentPropsWithoutRef<T> & RefAttributes<infer Method>
844
+ >
845
+ ? Method
846
+ : ComponentPropsWithRef<T> extends RefAttributes<infer Method>
847
+ ? Method
848
+ : never;
849
+
843
850
  // will show `Memo(${Component.displayName || Component.name})` in devtools by default,
844
851
  // but can be given its own specific name
845
852
  type MemoExoticComponent<T extends ComponentType<any>> = NamedExoticComponent<ComponentPropsWithRef<T>> & {
@@ -1555,14 +1562,14 @@ declare namespace React {
1555
1562
  /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */
1556
1563
  'aria-activedescendant'?: string | undefined;
1557
1564
  /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute. */
1558
- 'aria-atomic'?: boolean | 'false' | 'true' | undefined;
1565
+ 'aria-atomic'?: Booleanish | undefined;
1559
1566
  /**
1560
1567
  * Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be
1561
1568
  * presented if they are made.
1562
1569
  */
1563
1570
  'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both' | undefined;
1564
1571
  /** 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. */
1565
- 'aria-busy'?: boolean | 'false' | 'true' | undefined;
1572
+ 'aria-busy'?: Booleanish | undefined;
1566
1573
  /**
1567
1574
  * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.
1568
1575
  * @see aria-pressed @see aria-selected.
@@ -1604,7 +1611,7 @@ declare namespace React {
1604
1611
  * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
1605
1612
  * @see aria-hidden @see aria-readonly.
1606
1613
  */
1607
- 'aria-disabled'?: boolean | 'false' | 'true' | undefined;
1614
+ 'aria-disabled'?: Booleanish | undefined;
1608
1615
  /**
1609
1616
  * Indicates what functions can be performed when a dragged object is released on the drop target.
1610
1617
  * @deprecated in ARIA 1.1
@@ -1616,7 +1623,7 @@ declare namespace React {
1616
1623
  */
1617
1624
  'aria-errormessage'?: string | undefined;
1618
1625
  /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */
1619
- 'aria-expanded'?: boolean | 'false' | 'true' | undefined;
1626
+ 'aria-expanded'?: Booleanish | undefined;
1620
1627
  /**
1621
1628
  * Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion,
1622
1629
  * allows assistive technology to override the general default of reading in document source order.
@@ -1626,14 +1633,14 @@ declare namespace React {
1626
1633
  * Indicates an element's "grabbed" state in a drag-and-drop operation.
1627
1634
  * @deprecated in ARIA 1.1
1628
1635
  */
1629
- 'aria-grabbed'?: boolean | 'false' | 'true' | undefined;
1636
+ 'aria-grabbed'?: Booleanish | undefined;
1630
1637
  /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */
1631
1638
  'aria-haspopup'?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' | undefined;
1632
1639
  /**
1633
1640
  * Indicates whether the element is exposed to an accessibility API.
1634
1641
  * @see aria-disabled.
1635
1642
  */
1636
- 'aria-hidden'?: boolean | 'false' | 'true' | undefined;
1643
+ 'aria-hidden'?: Booleanish | undefined;
1637
1644
  /**
1638
1645
  * Indicates the entered value does not conform to the format expected by the application.
1639
1646
  * @see aria-errormessage.
@@ -1656,11 +1663,11 @@ declare namespace React {
1656
1663
  /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */
1657
1664
  'aria-live'?: 'off' | 'assertive' | 'polite' | undefined;
1658
1665
  /** Indicates whether an element is modal when displayed. */
1659
- 'aria-modal'?: boolean | 'false' | 'true' | undefined;
1666
+ 'aria-modal'?: Booleanish | undefined;
1660
1667
  /** Indicates whether a text box accepts multiple lines of input or only a single line. */
1661
- 'aria-multiline'?: boolean | 'false' | 'true' | undefined;
1668
+ 'aria-multiline'?: Booleanish | undefined;
1662
1669
  /** Indicates that the user may select more than one item from the current selectable descendants. */
1663
- 'aria-multiselectable'?: boolean | 'false' | 'true' | undefined;
1670
+ 'aria-multiselectable'?: Booleanish | undefined;
1664
1671
  /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */
1665
1672
  'aria-orientation'?: 'horizontal' | 'vertical' | undefined;
1666
1673
  /**
@@ -1688,14 +1695,14 @@ declare namespace React {
1688
1695
  * Indicates that the element is not editable, but is otherwise operable.
1689
1696
  * @see aria-disabled.
1690
1697
  */
1691
- 'aria-readonly'?: boolean | 'false' | 'true' | undefined;
1698
+ 'aria-readonly'?: Booleanish | undefined;
1692
1699
  /**
1693
1700
  * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified.
1694
1701
  * @see aria-atomic.
1695
1702
  */
1696
1703
  'aria-relevant'?: 'additions' | 'additions removals' | 'additions text' | 'all' | 'removals' | 'removals additions' | 'removals text' | 'text' | 'text additions' | 'text removals' | undefined;
1697
1704
  /** Indicates that user input is required on the element before a form may be submitted. */
1698
- 'aria-required'?: boolean | 'false' | 'true' | undefined;
1705
+ 'aria-required'?: Booleanish | undefined;
1699
1706
  /** Defines a human-readable, author-localized description for the role of an element. */
1700
1707
  'aria-roledescription'?: string | undefined;
1701
1708
  /**
@@ -1717,7 +1724,7 @@ declare namespace React {
1717
1724
  * Indicates the current "selected" state of various widgets.
1718
1725
  * @see aria-checked @see aria-pressed.
1719
1726
  */
1720
- 'aria-selected'?: boolean | 'false' | 'true' | undefined;
1727
+ 'aria-selected'?: Booleanish | undefined;
1721
1728
  /**
1722
1729
  * Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.
1723
1730
  * @see aria-posinset.
@@ -2159,6 +2166,31 @@ declare namespace React {
2159
2166
  dateTime?: string | undefined;
2160
2167
  }
2161
2168
 
2169
+ type HTMLInputTypeAttribute =
2170
+ | 'button'
2171
+ | 'checkbox'
2172
+ | 'color'
2173
+ | 'date'
2174
+ | 'datetime-local'
2175
+ | 'email'
2176
+ | 'file'
2177
+ | 'hidden'
2178
+ | 'image'
2179
+ | 'month'
2180
+ | 'number'
2181
+ | 'password'
2182
+ | 'radio'
2183
+ | 'range'
2184
+ | 'reset'
2185
+ | 'search'
2186
+ | 'submit'
2187
+ | 'tel'
2188
+ | 'text'
2189
+ | 'time'
2190
+ | 'url'
2191
+ | 'week'
2192
+ | (string & {});
2193
+
2162
2194
  interface InputHTMLAttributes<T> extends HTMLAttributes<T> {
2163
2195
  accept?: string | undefined;
2164
2196
  alt?: string | undefined;
@@ -2190,7 +2222,7 @@ declare namespace React {
2190
2222
  size?: number | undefined;
2191
2223
  src?: string | undefined;
2192
2224
  step?: number | string | undefined;
2193
- type?: string | undefined;
2225
+ type?: HTMLInputTypeAttribute | undefined;
2194
2226
  value?: string | ReadonlyArray<string> | number | undefined;
2195
2227
  width?: number | string | undefined;
2196
2228
 
react/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react",
3
- "version": "17.0.17",
3
+ "version": "17.0.21",
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": "287e66205ff8670bcdf14521b4a38ebc3d8e1509541124f707aa254ded4ee0d6",
150
- "typeScriptVersion": "3.6"
149
+ "typesPublisherContentHash": "657f17803ced16330ffb4269377e68db9893c764d3a1a97e1368236513759be5",
150
+ "typeScriptVersion": "3.7"
151
151
  }