/
githubmirror
/
material-ui
Обзор
Документация
Войти
/
githubmirror
/
material-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
packages/mui-material/src/utils/PolymorphicComponent.ts
25 строк
965 B
Marija Najdova
[material] Remove dependency to @mui/base (#42907)
12 июл 2024, 14:31
Не верифицирован
12 июл 2024, 14:31
3bbff37
Код
Авторство
О чём код?
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']>;