@types/react 18.2.49 → 18.2.50

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 +75 -25
  3. react/package.json +2 -2
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, 01 Feb 2024 06:07:40 GMT
11
+ * Last updated: Thu, 01 Feb 2024 07:35:21 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
@@ -399,7 +399,7 @@ declare namespace React {
399
399
  * explicitly if you want to display a different name for
400
400
  * debugging purposes.
401
401
  *
402
- * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname}
402
+ * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs}
403
403
  */
404
404
  displayName?: string | undefined;
405
405
  }
@@ -452,7 +452,7 @@ declare namespace React {
452
452
  const version: string;
453
453
 
454
454
  /**
455
- * {@link https://react.dev/reference/react/Profiler#onrender-callback Profiler API}
455
+ * @see {@link https://react.dev/reference/react/Profiler#onrender-callback Profiler API React Docs}
456
456
  */
457
457
  type ProfilerOnRenderCallback = (
458
458
  id: string,
@@ -573,8 +573,8 @@ declare namespace React {
573
573
  * receive a type argument that represents the props the component
574
574
  * receives.
575
575
  *
576
- * @param P - The props the component receives.
577
- * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/function_components}
576
+ * @typeparam P - The props the component receives.
577
+ * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/function_components React TypeScript Cheatsheet}
578
578
  * @alias for {@link React.FunctionComponent}
579
579
  *
580
580
  * @example
@@ -604,8 +604,8 @@ declare namespace React {
604
604
  * receive a type argument that represents the props the component
605
605
  * accepts.
606
606
  *
607
- * @param P - The props the component accepts.
608
- * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/function_components}
607
+ * @typeparam P - The props the component accepts.
608
+ * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/function_components React TypeScript Cheatsheet}
609
609
  *
610
610
  * @example
611
611
  *
@@ -637,7 +637,7 @@ declare namespace React {
637
637
  * We recommend using TypeScript instead of checking prop
638
638
  * types at runtime.
639
639
  *
640
- * @see {@link https://react.dev/reference/react/Component#static-proptypes}
640
+ * @see {@link https://react.dev/reference/react/Component#static-proptypes React Docs}
641
641
  */
642
642
  propTypes?: WeakValidationMap<P> | undefined;
643
643
  /**
@@ -646,14 +646,14 @@ declare namespace React {
646
646
  * Lets you specify which legacy context is consumed by
647
647
  * this component.
648
648
  *
649
- * @see {@link https://legacy.reactjs.org/docs/legacy-context.html}
649
+ * @see {@link https://legacy.reactjs.org/docs/legacy-context.html Legacy React Docs}
650
650
  */
651
651
  contextTypes?: ValidationMap<any> | undefined;
652
652
  /**
653
653
  * Used to define default values for the props accepted by
654
654
  * the component.
655
655
  *
656
- * @see {@link https://react.dev/reference/react/Component#static-defaultprops}
656
+ * @see {@link https://react.dev/reference/react/Component#static-defaultprops React Docs}
657
657
  *
658
658
  * @example
659
659
  *
@@ -675,7 +675,7 @@ declare namespace React {
675
675
  * explicitly if you want to display a different name for
676
676
  * debugging purposes.
677
677
  *
678
- * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname}
678
+ * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs}
679
679
  *
680
680
  * @example
681
681
  *
@@ -721,10 +721,10 @@ declare namespace React {
721
721
  /**
722
722
  * The type of the function passed to {@link forwardRef}.
723
723
  *
724
- * @param props Props passed to the component, if any.
725
- * @param ref A ref forwarded to the component of type {@link ForwardedRef}.
724
+ * @typeparam props Props passed to the component, if any.
725
+ * @typeparam ref A ref forwarded to the component of type {@link ForwardedRef}.
726
726
  *
727
- * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/forward_and_create_ref/}
727
+ * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/forward_and_create_ref/ React TypeScript Cheatsheet}
728
728
  * @see {@link forwardRef}
729
729
  */
730
730
  interface ForwardRefRenderFunction<T, P = {}> {
@@ -737,37 +737,82 @@ declare namespace React {
737
737
  * Will show `ForwardRef(${Component.displayName || Component.name})`
738
738
  * in devtools by default, but can be given its own specific name.
739
739
  *
740
- * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname}
740
+ * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs}
741
741
  */
742
742
  displayName?: string | undefined;
743
743
  /**
744
744
  * defaultProps are not supported on components passed to forwardRef.
745
745
  *
746
- * @see {@link https://github.com/microsoft/TypeScript/issues/36826} for context
747
- * @see {@link https://react.dev/reference/react/Component#static-defaultprops}
746
+ * @see {@link https://github.com/microsoft/TypeScript/issues/36826 linked GitHub issue} for context
747
+ * @see {@link https://react.dev/reference/react/Component#static-defaultprops React Docs}
748
748
  */
749
749
  defaultProps?: never | undefined;
750
750
  /**
751
751
  * propTypes are not supported on components passed to forwardRef.
752
752
  *
753
- * @see {@link https://github.com/microsoft/TypeScript/issues/36826} for context
754
- * @see {@link https://react.dev/reference/react/Component#static-proptypes}
753
+ * @see {@link https://github.com/microsoft/TypeScript/issues/36826 linked GitHub issue} for context
754
+ * @see {@link https://react.dev/reference/react/Component#static-proptypes React Docs}
755
755
  */
756
756
  propTypes?: never | undefined;
757
757
  }
758
758
 
759
+ /**
760
+ * Represents a component class in React.
761
+ *
762
+ * @typeparam P The props the component accepts.
763
+ * @typeparam S The internal state of the component.
764
+ */
759
765
  interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
760
766
  new(props: P, context?: any): Component<P, S>;
767
+ /**
768
+ * Used to declare the types of the props accepted by the
769
+ * component. These types will be checked during rendering
770
+ * and in development only.
771
+ *
772
+ * We recommend using TypeScript instead of checking prop
773
+ * types at runtime.
774
+ *
775
+ * @see {@link https://react.dev/reference/react/Component#static-proptypes React Docs}
776
+ */
761
777
  propTypes?: WeakValidationMap<P> | undefined;
762
778
  contextType?: Context<any> | undefined;
779
+ /**
780
+ * @deprecated use {@link ComponentClass.contextType} instead
781
+ *
782
+ * Lets you specify which legacy context is consumed by
783
+ * this component.
784
+ *
785
+ * @see {@link https://legacy.reactjs.org/docs/legacy-context.html Legacy React Docs}
786
+ */
763
787
  contextTypes?: ValidationMap<any> | undefined;
788
+ /**
789
+ * @deprecated
790
+ *
791
+ * @see {@link https://legacy.reactjs.org/docs/legacy-context.html#how-to-use-context Legacy React Docs}
792
+ */
764
793
  childContextTypes?: ValidationMap<any> | undefined;
794
+ /**
795
+ * Used to define default values for the props accepted by
796
+ * the component.
797
+ *
798
+ * @see {@link https://react.dev/reference/react/Component#static-defaultprops React Docs}
799
+ */
765
800
  defaultProps?: Partial<P> | undefined;
801
+ /**
802
+ * Used in debugging messages. You might want to set it
803
+ * explicitly if you want to display a different name for
804
+ * debugging purposes.
805
+ *
806
+ * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs}
807
+ */
766
808
  displayName?: string | undefined;
767
809
  }
768
810
 
769
811
  /**
770
812
  * @deprecated Use `ClassicComponentClass` from `create-react-class`
813
+ *
814
+ * @see {@link https://legacy.reactjs.org/docs/react-without-es6.html Legacy React Docs}
815
+ * @see {@link https://www.npmjs.com/package/create-react-class `create-react-class` on npm}
771
816
  */
772
817
  interface ClassicComponentClass<P = {}> extends ComponentClass<P> {
773
818
  new(props: P, context?: any): ClassicComponent<P, ComponentState>;
@@ -775,7 +820,10 @@ declare namespace React {
775
820
  }
776
821
 
777
822
  /**
778
- * We use an intersection type to infer multiple type parameters from
823
+ * Used in {@link createElement} and {@link createFactory} to represent
824
+ * a class.
825
+ *
826
+ * An intersection type is used to infer multiple type parameters from
779
827
  * a single argument, which is useful for many top-level API defs.
780
828
  * See https://github.com/Microsoft/TypeScript/issues/7234 for more info.
781
829
  */
@@ -968,7 +1016,9 @@ declare namespace React {
968
1016
  }
969
1017
 
970
1018
  /**
971
- * @deprecated https://legacy.reactjs.org/blog/2016/07/13/mixins-considered-harmful.html
1019
+ * @deprecated
1020
+ *
1021
+ * @see {@link https://legacy.reactjs.org/blog/2016/07/13/mixins-considered-harmful.html Mixins Considered Harmful}
972
1022
  */
973
1023
  interface ComponentSpec<P, S> extends Mixin<P, S> {
974
1024
  render(): ReactNode;
@@ -994,8 +1044,8 @@ declare namespace React {
994
1044
  * Lets your component expose a DOM node to parent component
995
1045
  * using a ref.
996
1046
  *
997
- * @see {@link https://react.dev/reference/react/forwardRef}
998
- * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/forward_and_create_ref/}
1047
+ * @see {@link https://react.dev/reference/react/forwardRef React Docs}
1048
+ * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/forward_and_create_ref/ React TypeScript Cheatsheet}
999
1049
  *
1000
1050
  * @param render See the {@link ForwardRefRenderFunction}.
1001
1051
  *
@@ -1048,7 +1098,7 @@ declare namespace React {
1048
1098
  * instead of this type, as they let you be explicit about whether or not to include
1049
1099
  * the `ref` prop.
1050
1100
  *
1051
- * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/}
1101
+ * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet}
1052
1102
  *
1053
1103
  * @example
1054
1104
  *
@@ -1076,7 +1126,7 @@ declare namespace React {
1076
1126
  * passed a string, indicating a DOM element (e.g. 'div', 'span', etc.) or the
1077
1127
  * type of a React component.
1078
1128
  *
1079
- * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/}
1129
+ * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet}
1080
1130
  *
1081
1131
  * @example
1082
1132
  *
@@ -1123,7 +1173,7 @@ declare namespace React {
1123
1173
  * passed a string, indicating a DOM element (e.g. 'div', 'span', etc.) or the
1124
1174
  * type of a React component.
1125
1175
  *
1126
- * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/}
1176
+ * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet}
1127
1177
  *
1128
1178
  * @example
1129
1179
  *
react/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react",
3
- "version": "18.2.49",
3
+ "version": "18.2.50",
4
4
  "description": "TypeScript definitions for react",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
6
6
  "license": "MIT",
@@ -201,6 +201,6 @@
201
201
  "@types/scheduler": "*",
202
202
  "csstype": "^3.0.2"
203
203
  },
204
- "typesPublisherContentHash": "0eb7a991a00ce343b222b32fb0879928350f9dd65227c90a49a1d8ceccf4a389",
204
+ "typesPublisherContentHash": "de06a0c7b26443a49092798af7022732df079fdccd6114cb9ad9dbe3f9d35963",
205
205
  "typeScriptVersion": "4.6"
206
206
  }