@types/react 18.0.2 → 18.0.5

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 +23 -3
  3. 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: Tue, 12 Apr 2022 06:01:18 GMT
11
+ * Last updated: Thu, 14 Apr 2022 07:01:23 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
@@ -377,7 +377,15 @@ declare namespace React {
377
377
 
378
378
  function isValidElement<P>(object: {} | null | undefined): object is ReactElement<P>;
379
379
 
380
- const Children: ReactChildren;
380
+ // Sync with `ReactChildren` until `ReactChildren` is removed.
381
+ const Children: {
382
+ map<T, C>(children: C | ReadonlyArray<C>, fn: (child: C, index: number) => T):
383
+ C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>;
384
+ forEach<C>(children: C | ReadonlyArray<C>, fn: (child: C, index: number) => void): void;
385
+ count(children: any): number;
386
+ only<C>(children: C): C extends any[] ? never : C;
387
+ toArray(children: ReactNode | ReactNode[]): Array<Exclude<ReactNode, boolean | null | undefined>>;
388
+ };
381
389
  const Fragment: ExoticComponent<{ children?: ReactNode | undefined }>;
382
390
  const StrictMode: ExoticComponent<{ children?: ReactNode | undefined }>;
383
391
 
@@ -515,8 +523,14 @@ declare namespace React {
515
523
  displayName?: string | undefined;
516
524
  }
517
525
 
526
+ /**
527
+ * @deprecated - Equivalent with `React.FC`.
528
+ */
518
529
  type VFC<P = {}> = VoidFunctionComponent<P>;
519
530
 
531
+ /**
532
+ * @deprecated - Equivalent with `React.FunctionComponent`.
533
+ */
520
534
  interface VoidFunctionComponent<P = {}> {
521
535
  (props: P, context?: any): ReactElement<any, any> | null;
522
536
  propTypes?: WeakValidationMap<P> | undefined;
@@ -2999,6 +3013,10 @@ declare namespace React {
2999
3013
  // React.Children
3000
3014
  // ----------------------------------------------------------------------
3001
3015
 
3016
+ /**
3017
+ * @deprecated - Use `typeof React.Children` instead.
3018
+ */
3019
+ // Sync with type of `const Children`.
3002
3020
  interface ReactChildren {
3003
3021
  map<T, C>(children: C | ReadonlyArray<C>, fn: (child: C, index: number) => T):
3004
3022
  C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>;
@@ -3070,6 +3088,8 @@ type MergePropTypes<P, T> =
3070
3088
  & Pick<P, Exclude<keyof P, keyof T>>
3071
3089
  : never;
3072
3090
 
3091
+ type InexactPartial<T> = { [K in keyof T]?: T[K] | undefined };
3092
+
3073
3093
  // Any prop that has a default prop becomes optional, but its type is unchanged
3074
3094
  // Undeclared default props are augmented into the resulting allowable attributes
3075
3095
  // If declared props have indexed properties, ignore default props entirely as keyof gets widened
@@ -3077,8 +3097,8 @@ type MergePropTypes<P, T> =
3077
3097
  type Defaultize<P, D> = P extends any
3078
3098
  ? string extends keyof P ? P :
3079
3099
  & Pick<P, Exclude<keyof P, keyof D>>
3080
- & Partial<Pick<P, Extract<keyof P, keyof D>>>
3081
- & Partial<Pick<D, Exclude<keyof D, keyof P>>>
3100
+ & InexactPartial<Pick<P, Extract<keyof P, keyof D>>>
3101
+ & InexactPartial<Pick<D, Exclude<keyof D, keyof P>>>
3082
3102
  : never;
3083
3103
 
3084
3104
  type ReactManagedAttributes<C, P> = C extends { propTypes: infer T; defaultProps: infer D; }
react/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react",
3
- "version": "18.0.2",
3
+ "version": "18.0.5",
4
4
  "description": "TypeScript definitions for React",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
6
6
  "license": "MIT",
@@ -146,7 +146,7 @@
146
146
  "@types/scheduler": "*",
147
147
  "csstype": "^3.0.2"
148
148
  },
149
- "typesPublisherContentHash": "7d3fad9fdebf12d4eb21720c98b1ef727d5d5028c97aefce26cfeb16a9eac1ef",
149
+ "typesPublisherContentHash": "7a47bc7effee7ef102e1fab4d1b9150cf19fde731dec26d7af2c1b3395c51d7b",
150
150
  "typeScriptVersion": "3.9",
151
151
  "exports": {
152
152
  ".": {