@types/react 18.2.48 → 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.
- react/README.md +1 -1
- react/index.d.ts +346 -29
- 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:
|
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
@@ -371,25 +371,36 @@ declare namespace React {
|
|
371
371
|
children: (value: T) => ReactNode;
|
372
372
|
}
|
373
373
|
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
374
|
+
/**
|
375
|
+
* An object masquerading as a component. These are created by
|
376
|
+
* {@link forwardRef}, {@link memo}, and {@link createContext}.
|
377
|
+
*
|
378
|
+
* In order to make TypeScript work, we pretend that they are normal
|
379
|
+
* components.
|
380
|
+
*
|
381
|
+
* But they are, in fact, not callable - instead, they are objects which
|
382
|
+
* are treated specially by the renderer.
|
383
|
+
*
|
384
|
+
* @see {@link forwardRef}
|
385
|
+
* @see {@link memo}
|
386
|
+
* @see {@link createContext}
|
387
|
+
*/
|
384
388
|
interface ExoticComponent<P = {}> {
|
385
|
-
/**
|
386
|
-
* **NOTE**: Exotic components are not callable.
|
387
|
-
*/
|
388
389
|
(props: P): ReactNode;
|
389
390
|
readonly $$typeof: symbol;
|
390
391
|
}
|
391
392
|
|
393
|
+
/**
|
394
|
+
* An {@link ExoticComponent} with a `displayName` property applied to it.
|
395
|
+
*/
|
392
396
|
interface NamedExoticComponent<P = {}> extends ExoticComponent<P> {
|
397
|
+
/**
|
398
|
+
* Used in debugging messages. You might want to set it
|
399
|
+
* explicitly if you want to display a different name for
|
400
|
+
* debugging purposes.
|
401
|
+
*
|
402
|
+
* @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs}
|
403
|
+
*/
|
393
404
|
displayName?: string | undefined;
|
394
405
|
}
|
395
406
|
|
@@ -441,7 +452,7 @@ declare namespace React {
|
|
441
452
|
const version: string;
|
442
453
|
|
443
454
|
/**
|
444
|
-
* {@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}
|
445
456
|
*/
|
446
457
|
type ProfilerOnRenderCallback = (
|
447
458
|
id: string,
|
@@ -557,23 +568,140 @@ declare namespace React {
|
|
557
568
|
// Class Interfaces
|
558
569
|
// ----------------------------------------------------------------------
|
559
570
|
|
571
|
+
/**
|
572
|
+
* Represents the type of a function component. Can optionally
|
573
|
+
* receive a type argument that represents the props the component
|
574
|
+
* receives.
|
575
|
+
*
|
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
|
+
* @alias for {@link React.FunctionComponent}
|
579
|
+
*
|
580
|
+
* @example
|
581
|
+
*
|
582
|
+
* ```tsx
|
583
|
+
* // With props:
|
584
|
+
* type Props = { name: string }
|
585
|
+
*
|
586
|
+
* const MyComponent: FC<Props> = (props) => {
|
587
|
+
* return <div>{props.name}</div>
|
588
|
+
* }
|
589
|
+
* ```
|
590
|
+
*
|
591
|
+
* @example
|
592
|
+
*
|
593
|
+
* ```tsx
|
594
|
+
* // Without props:
|
595
|
+
* const MyComponentWithoutProps: FC = () => {
|
596
|
+
* return <div>MyComponentWithoutProps</div>
|
597
|
+
* }
|
598
|
+
* ```
|
599
|
+
*/
|
560
600
|
type FC<P = {}> = FunctionComponent<P>;
|
561
601
|
|
602
|
+
/**
|
603
|
+
* Represents the type of a function component. Can optionally
|
604
|
+
* receive a type argument that represents the props the component
|
605
|
+
* accepts.
|
606
|
+
*
|
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
|
+
*
|
610
|
+
* @example
|
611
|
+
*
|
612
|
+
* ```tsx
|
613
|
+
* // With props:
|
614
|
+
* type Props = { name: string }
|
615
|
+
*
|
616
|
+
* const MyComponent: FunctionComponent<Props> = (props) => {
|
617
|
+
* return <div>{props.name}</div>
|
618
|
+
* }
|
619
|
+
* ```
|
620
|
+
*
|
621
|
+
* @example
|
622
|
+
*
|
623
|
+
* ```tsx
|
624
|
+
* // Without props:
|
625
|
+
* const MyComponentWithoutProps: FunctionComponent = () => {
|
626
|
+
* return <div>MyComponentWithoutProps</div>
|
627
|
+
* }
|
628
|
+
* ```
|
629
|
+
*/
|
562
630
|
interface FunctionComponent<P = {}> {
|
563
631
|
(props: P, context?: any): ReactNode;
|
632
|
+
/**
|
633
|
+
* Used to declare the types of the props accepted by the
|
634
|
+
* component. These types will be checked during rendering
|
635
|
+
* and in development only.
|
636
|
+
*
|
637
|
+
* We recommend using TypeScript instead of checking prop
|
638
|
+
* types at runtime.
|
639
|
+
*
|
640
|
+
* @see {@link https://react.dev/reference/react/Component#static-proptypes React Docs}
|
641
|
+
*/
|
564
642
|
propTypes?: WeakValidationMap<P> | undefined;
|
643
|
+
/**
|
644
|
+
* @deprecated
|
645
|
+
*
|
646
|
+
* Lets you specify which legacy context is consumed by
|
647
|
+
* this component.
|
648
|
+
*
|
649
|
+
* @see {@link https://legacy.reactjs.org/docs/legacy-context.html Legacy React Docs}
|
650
|
+
*/
|
565
651
|
contextTypes?: ValidationMap<any> | undefined;
|
652
|
+
/**
|
653
|
+
* Used to define default values for the props accepted by
|
654
|
+
* the component.
|
655
|
+
*
|
656
|
+
* @see {@link https://react.dev/reference/react/Component#static-defaultprops React Docs}
|
657
|
+
*
|
658
|
+
* @example
|
659
|
+
*
|
660
|
+
* ```tsx
|
661
|
+
* type Props = { name?: string }
|
662
|
+
*
|
663
|
+
* const MyComponent: FC<Props> = (props) => {
|
664
|
+
* return <div>{props.name}</div>
|
665
|
+
* }
|
666
|
+
*
|
667
|
+
* MyComponent.defaultProps = {
|
668
|
+
* name: 'John Doe'
|
669
|
+
* }
|
670
|
+
* ```
|
671
|
+
*/
|
566
672
|
defaultProps?: Partial<P> | undefined;
|
673
|
+
/**
|
674
|
+
* Used in debugging messages. You might want to set it
|
675
|
+
* explicitly if you want to display a different name for
|
676
|
+
* debugging purposes.
|
677
|
+
*
|
678
|
+
* @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs}
|
679
|
+
*
|
680
|
+
* @example
|
681
|
+
*
|
682
|
+
* ```tsx
|
683
|
+
*
|
684
|
+
* const MyComponent: FC = () => {
|
685
|
+
* return <div>Hello!</div>
|
686
|
+
* }
|
687
|
+
*
|
688
|
+
* MyComponent.displayName = 'MyAwesomeComponent'
|
689
|
+
* ```
|
690
|
+
*/
|
567
691
|
displayName?: string | undefined;
|
568
692
|
}
|
569
693
|
|
570
694
|
/**
|
571
|
-
* @deprecated - Equivalent
|
695
|
+
* @deprecated - Equivalent to {@link React.FunctionComponent}.
|
696
|
+
*
|
697
|
+
* @see {@link React.FunctionComponent}
|
572
698
|
*/
|
573
699
|
type VFC<P = {}> = VoidFunctionComponent<P>;
|
574
700
|
|
575
701
|
/**
|
576
|
-
* @deprecated - Equivalent
|
702
|
+
* @deprecated - Equivalent to {@link React.FunctionComponent}.
|
703
|
+
*
|
704
|
+
* @see {@link React.FunctionComponent}
|
577
705
|
*/
|
578
706
|
interface VoidFunctionComponent<P = {}> {
|
579
707
|
(props: P, context?: any): ReactNode;
|
@@ -583,35 +711,108 @@ declare namespace React {
|
|
583
711
|
displayName?: string | undefined;
|
584
712
|
}
|
585
713
|
|
714
|
+
/**
|
715
|
+
* The type of the ref received by a {@link ForwardRefRenderFunction}.
|
716
|
+
*
|
717
|
+
* @see {@link ForwardRefRenderFunction}
|
718
|
+
*/
|
586
719
|
type ForwardedRef<T> = ((instance: T | null) => void) | MutableRefObject<T | null> | null;
|
587
720
|
|
721
|
+
/**
|
722
|
+
* The type of the function passed to {@link forwardRef}.
|
723
|
+
*
|
724
|
+
* @typeparam props Props passed to the component, if any.
|
725
|
+
* @typeparam ref A ref forwarded to the component of type {@link ForwardedRef}.
|
726
|
+
*
|
727
|
+
* @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/forward_and_create_ref/ React TypeScript Cheatsheet}
|
728
|
+
* @see {@link forwardRef}
|
729
|
+
*/
|
588
730
|
interface ForwardRefRenderFunction<T, P = {}> {
|
589
731
|
(props: P, ref: ForwardedRef<T>): ReactNode;
|
732
|
+
/**
|
733
|
+
* Used in debugging messages. You might want to set it
|
734
|
+
* explicitly if you want to display a different name for
|
735
|
+
* debugging purposes.
|
736
|
+
*
|
737
|
+
* Will show `ForwardRef(${Component.displayName || Component.name})`
|
738
|
+
* in devtools by default, but can be given its own specific name.
|
739
|
+
*
|
740
|
+
* @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs}
|
741
|
+
*/
|
590
742
|
displayName?: string | undefined;
|
591
|
-
// explicit rejected with `never` required due to
|
592
|
-
// https://github.com/microsoft/TypeScript/issues/36826
|
593
743
|
/**
|
594
|
-
* defaultProps are not supported on
|
744
|
+
* defaultProps are not supported on components passed to forwardRef.
|
745
|
+
*
|
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}
|
595
748
|
*/
|
596
749
|
defaultProps?: never | undefined;
|
597
750
|
/**
|
598
|
-
* propTypes are not supported on
|
751
|
+
* propTypes are not supported on components passed to forwardRef.
|
752
|
+
*
|
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}
|
599
755
|
*/
|
600
756
|
propTypes?: never | undefined;
|
601
757
|
}
|
602
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
|
+
*/
|
603
765
|
interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
|
604
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
|
+
*/
|
605
777
|
propTypes?: WeakValidationMap<P> | undefined;
|
606
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
|
+
*/
|
607
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
|
+
*/
|
608
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
|
+
*/
|
609
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
|
+
*/
|
610
808
|
displayName?: string | undefined;
|
611
809
|
}
|
612
810
|
|
613
811
|
/**
|
614
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}
|
615
816
|
*/
|
616
817
|
interface ClassicComponentClass<P = {}> extends ComponentClass<P> {
|
617
818
|
new(props: P, context?: any): ClassicComponent<P, ComponentState>;
|
@@ -619,7 +820,10 @@ declare namespace React {
|
|
619
820
|
}
|
620
821
|
|
621
822
|
/**
|
622
|
-
*
|
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
|
623
827
|
* a single argument, which is useful for many top-level API defs.
|
624
828
|
* See https://github.com/Microsoft/TypeScript/issues/7234 for more info.
|
625
829
|
*/
|
@@ -812,7 +1016,9 @@ declare namespace React {
|
|
812
1016
|
}
|
813
1017
|
|
814
1018
|
/**
|
815
|
-
* @deprecated
|
1019
|
+
* @deprecated
|
1020
|
+
*
|
1021
|
+
* @see {@link https://legacy.reactjs.org/blog/2016/07/13/mixins-considered-harmful.html Mixins Considered Harmful}
|
816
1022
|
*/
|
817
1023
|
interface ComponentSpec<P, S> extends Mixin<P, S> {
|
818
1024
|
render(): ReactNode;
|
@@ -822,13 +1028,45 @@ declare namespace React {
|
|
822
1028
|
|
823
1029
|
function createRef<T>(): RefObject<T>;
|
824
1030
|
|
825
|
-
|
826
|
-
|
1031
|
+
/**
|
1032
|
+
* The type of the component returned from {@link forwardRef}.
|
1033
|
+
*
|
1034
|
+
* @typeparam P The props the component accepts, if any.
|
1035
|
+
*
|
1036
|
+
* @see {@link ExoticComponent}
|
1037
|
+
*/
|
827
1038
|
interface ForwardRefExoticComponent<P> extends NamedExoticComponent<P> {
|
828
1039
|
defaultProps?: Partial<P> | undefined;
|
829
1040
|
propTypes?: WeakValidationMap<P> | undefined;
|
830
1041
|
}
|
831
1042
|
|
1043
|
+
/**
|
1044
|
+
* Lets your component expose a DOM node to parent component
|
1045
|
+
* using a ref.
|
1046
|
+
*
|
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}
|
1049
|
+
*
|
1050
|
+
* @param render See the {@link ForwardRefRenderFunction}.
|
1051
|
+
*
|
1052
|
+
* @typeparam T The type of the DOM node.
|
1053
|
+
* @typeparam P The props the component accepts, if any.
|
1054
|
+
*
|
1055
|
+
* @example
|
1056
|
+
*
|
1057
|
+
* ```tsx
|
1058
|
+
* interface Props {
|
1059
|
+
* children?: ReactNode;
|
1060
|
+
* type: "submit" | "button";
|
1061
|
+
* }
|
1062
|
+
*
|
1063
|
+
* export const FancyButton = forwardRef<HTMLButtonElement, Props>((props, ref) => (
|
1064
|
+
* <button ref={ref} className="MyClassName" type={props.type}>
|
1065
|
+
* {props.children}
|
1066
|
+
* </button>
|
1067
|
+
* ));
|
1068
|
+
* ```
|
1069
|
+
*/
|
832
1070
|
function forwardRef<T, P = {}>(
|
833
1071
|
render: ForwardRefRenderFunction<T, P>,
|
834
1072
|
): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
|
@@ -852,28 +1090,107 @@ declare namespace React {
|
|
852
1090
|
type PropsWithChildren<P = unknown> = P & { children?: ReactNode | undefined };
|
853
1091
|
|
854
1092
|
/**
|
855
|
-
*
|
856
|
-
*
|
1093
|
+
* Used to retrieve the props a component accepts. Can either be passed a string,
|
1094
|
+
* indicating a DOM element (e.g. 'div', 'span', etc.) or the type of a React
|
1095
|
+
* component.
|
1096
|
+
*
|
1097
|
+
* It's usually better to use {@link ComponentPropsWithRef} or {@link ComponentPropsWithoutRef}
|
1098
|
+
* instead of this type, as they let you be explicit about whether or not to include
|
1099
|
+
* the `ref` prop.
|
1100
|
+
*
|
1101
|
+
* @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet}
|
1102
|
+
*
|
1103
|
+
* @example
|
1104
|
+
*
|
1105
|
+
* ```tsx
|
1106
|
+
* // Retrieves the props an 'input' element accepts
|
1107
|
+
* type InputProps = React.ComponentProps<'input'>;
|
1108
|
+
* ```
|
1109
|
+
*
|
1110
|
+
* @example
|
1111
|
+
*
|
1112
|
+
* ```tsx
|
1113
|
+
* const MyComponent = (props: { foo: number, bar: string }) => <div />;
|
1114
|
+
*
|
1115
|
+
* // Retrieves the props 'MyComponent' accepts
|
1116
|
+
* type MyComponentProps = React.ComponentProps<typeof MyComponent>;
|
1117
|
+
* ```
|
857
1118
|
*/
|
858
1119
|
type ComponentProps<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = T extends
|
859
1120
|
JSXElementConstructor<infer P> ? P
|
860
1121
|
: T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T]
|
861
1122
|
: {};
|
1123
|
+
|
862
1124
|
/**
|
863
|
-
*
|
1125
|
+
* Used to retrieve the props a component accepts with its ref. Can either be
|
1126
|
+
* passed a string, indicating a DOM element (e.g. 'div', 'span', etc.) or the
|
1127
|
+
* type of a React component.
|
1128
|
+
*
|
1129
|
+
* @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet}
|
864
1130
|
*
|
865
|
-
*
|
1131
|
+
* @example
|
1132
|
+
*
|
1133
|
+
* ```tsx
|
1134
|
+
* // Retrieves the props an 'input' element accepts
|
1135
|
+
* type InputProps = React.ComponentPropsWithRef<'input'>;
|
1136
|
+
* ```
|
1137
|
+
*
|
1138
|
+
* @example
|
1139
|
+
*
|
1140
|
+
* ```tsx
|
1141
|
+
* const MyComponent = (props: { foo: number, bar: string }) => <div />;
|
1142
|
+
*
|
1143
|
+
* // Retrieves the props 'MyComponent' accepts
|
1144
|
+
* type MyComponentPropsWithRef = React.ComponentPropsWithRef<typeof MyComponent>;
|
1145
|
+
* ```
|
866
1146
|
*/
|
867
1147
|
type ComponentPropsWithRef<T extends ElementType> = T extends (new(props: infer P) => Component<any, any>)
|
868
1148
|
? PropsWithoutRef<P> & RefAttributes<InstanceType<T>>
|
869
1149
|
: PropsWithRef<ComponentProps<T>>;
|
870
1150
|
/**
|
871
|
-
*
|
1151
|
+
* Used to retrieve the props a custom component accepts with its ref.
|
1152
|
+
*
|
1153
|
+
* Unlike {@link ComponentPropsWithRef}, this only works with custom
|
1154
|
+
* components, i.e. components you define yourself. This is to improve
|
1155
|
+
* type-checking performance.
|
1156
|
+
*
|
1157
|
+
* @example
|
1158
|
+
*
|
1159
|
+
* ```tsx
|
1160
|
+
* const MyComponent = (props: { foo: number, bar: string }) => <div />;
|
1161
|
+
*
|
1162
|
+
* // Retrieves the props 'MyComponent' accepts
|
1163
|
+
* type MyComponentPropsWithRef = React.CustomComponentPropsWithRef<typeof MyComponent>;
|
1164
|
+
* ```
|
872
1165
|
*/
|
873
1166
|
type CustomComponentPropsWithRef<T extends ComponentType> = T extends (new(props: infer P) => Component<any, any>)
|
874
1167
|
? (PropsWithoutRef<P> & RefAttributes<InstanceType<T>>)
|
875
1168
|
: T extends ((props: infer P, legacyContext?: any) => ReactNode) ? PropsWithRef<P>
|
876
1169
|
: never;
|
1170
|
+
|
1171
|
+
/**
|
1172
|
+
* Used to retrieve the props a component accepts without its ref. Can either be
|
1173
|
+
* passed a string, indicating a DOM element (e.g. 'div', 'span', etc.) or the
|
1174
|
+
* type of a React component.
|
1175
|
+
*
|
1176
|
+
* @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet}
|
1177
|
+
*
|
1178
|
+
* @example
|
1179
|
+
*
|
1180
|
+
* ```tsx
|
1181
|
+
* // Retrieves the props an 'input' element accepts
|
1182
|
+
* type InputProps = React.ComponentPropsWithoutRef<'input'>;
|
1183
|
+
* ```
|
1184
|
+
*
|
1185
|
+
* @example
|
1186
|
+
*
|
1187
|
+
* ```tsx
|
1188
|
+
* const MyComponent = (props: { foo: number, bar: string }) => <div />;
|
1189
|
+
*
|
1190
|
+
* // Retrieves the props 'MyComponent' accepts
|
1191
|
+
* type MyComponentPropsWithoutRef = React.ComponentPropsWithoutRef<typeof MyComponent>;
|
1192
|
+
* ```
|
1193
|
+
*/
|
877
1194
|
type ComponentPropsWithoutRef<T extends ElementType> = PropsWithoutRef<ComponentProps<T>>;
|
878
1195
|
|
879
1196
|
type ComponentRef<T extends ElementType> = T extends NamedExoticComponent<
|
react/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/react",
|
3
|
-
"version": "18.2.
|
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": "
|
204
|
+
"typesPublisherContentHash": "de06a0c7b26443a49092798af7022732df079fdccd6114cb9ad9dbe3f9d35963",
|
205
205
|
"typeScriptVersion": "4.6"
|
206
206
|
}
|