Some checks failed
CI/CD Pipeline / unit-tests (push) Failing after 1m16s
CI/CD Pipeline / integration-tests (push) Failing after 2m32s
CI/CD Pipeline / lint (push) Successful in 5m22s
CI/CD Pipeline / e2e-tests (push) Has been skipped
CI/CD Pipeline / build (push) Has been skipped
18 lines
951 B
TypeScript
18 lines
951 B
TypeScript
import * as React from 'react';
|
|
import { DistributiveOmit, OverridableTypeMap } from '@mui/types';
|
|
/**
|
|
* A component whose root component can be controlled explicitly with a generic type parameter.
|
|
* Adjusts valid props based on the type of `RootComponent`.
|
|
*
|
|
* @template TypeMap The interface the defines the props and a default root element of the component.
|
|
*/
|
|
export type PolymorphicComponent<TypeMap extends OverridableTypeMap> = {
|
|
<RootComponent extends React.ElementType = TypeMap['defaultComponent']>(props: PolymorphicProps<TypeMap, RootComponent>): React.JSX.Element | null;
|
|
propTypes?: any;
|
|
displayName?: string | undefined;
|
|
};
|
|
/**
|
|
* Own props of the component augmented with props of the root component.
|
|
*/
|
|
export type PolymorphicProps<TypeMap extends OverridableTypeMap, RootComponent extends React.ElementType> = TypeMap['props'] & DistributiveOmit<React.ComponentPropsWithRef<RootComponent>, keyof TypeMap['props']>;
|