Repository: mui/material-ui
File: packages/mui-base/src/MultiSelectUnstyled/MultiSelectUnstyled.types.ts (TypeScript)

Code before:
  defaultComponent: D;
}

export type MultiSelectUnstyledProps<
  TValue,
  D extends React.ElementType = MultiSelectUnstyledTypeMap<TValue>['defaultComponent'],
> = OverrideProps<MultiSelectUnstyledTypeMap<TValue, {}, D>, D> & {
  component?: D;
};

// OverridableComponent cannot be used below as MultiSelectUnstyled's props are generic.
export interface MultiSelectUnstyledType {
  <TValue, C extends React.ElementType>(
    props: {
      /**
       * The component used for the root node.
       * Either a string to use a HTML element or a component.
       */
      component: C;
    } & OverrideProps<MultiSelectUnstyledTypeMap<TValue>, C>,
  ): JSX.Element | null;
  <TValue>(props: DefaultComponentProps<MultiSelectUnstyledTypeMap<TValue>>): JSX.Element | null;
  propTypes?: any;
}

export interface MultiSelectUnstyledOwnerState<TValue> extends MultiSelectUnstyledProps<TValue> {
  active: boolean;
  disabled: boolean;
  open: boolean;
  focusVisible: boolean;
}

export type MultiSelectUnstyledRootSlotProps<TValue> = Simplify<
  UseSelectButtonSlotProps & {
    className?: string;
    children?: React.ReactNode;
    ownerState: MultiSelectUnstyledOwnerState<TValue>;
  }
>;

export type MultiSelectUnstyledListboxSlotProps<TValue> = Simplify<
  UseSelectListboxSlotProps & {
    className?: string;
    children?: React.ReactNode;
    ownerState: MultiSelectUnstyledOwnerState<TValue>;
  }
>;

export type MultiSelectUnstyledPopperSlotProps<TValue> = {
  anchorEl: PopperUnstyledProps['anchorEl'];
  children?: PopperUnstyledProps['children'];

Review comment (bug):
For all those changes, I don't understand the typing. We have `TValue extends {}`, but in the example we often pass strings.

Is this constrain wrong ?
Should we put another constraint ?
Is the inconsistency intended ?

With the prop types correctly generated, I had test failing.

Code after:
  defaultComponent: D;
}

export type MultiSelectUnstyledProps<
  TValue extends {},
  D extends React.ElementType = MultiSelectUnstyledTypeMap<TValue>['defaultComponent'],
> = OverrideProps<MultiSelectUnstyledTypeMap<TValue, {}, D>, D> & {
  component?: D;
};

// OverridableComponent cannot be used below as MultiSelectUnstyled's props are generic.
export interface MultiSelectUnstyledType {
  <TValue extends {}, C extends React.ElementType>(
    props: {
      /**
       * The component used for the root node.
       * Either a string to use a HTML element or a component.
       */
      component: C;
    } & OverrideProps<MultiSelectUnstyledTypeMap<TValue>, C>,
  ): JSX.Element | null;
  <TValue extends {}>(
    props: DefaultComponentProps<MultiSelectUnstyledTypeMap<TValue>>,
  ): JSX.Element | null;
  propTypes?: any;
}

export interface MultiSelectUnstyledOwnerState<TValue extends {}>
  extends MultiSelectUnstyledProps<TValue> {
  active: boolean;
  disabled: boolean;
  open: boolean;
  focusVisible: boolean;
}

export type MultiSelectUnstyledRootSlotProps<TValue extends {}> = Simplify<
  UseSelectButtonSlotProps & {
    className?: string;
    children?: React.ReactNode;
    ownerState: MultiSelectUnstyledOwnerState<TValue>;
  }
>;

export type MultiSelectUnstyledListboxSlotProps<TValue extends {}> = Simplify<
  UseSelectListboxSlotProps & {
    className?: string;
    children?: React.ReactNode;
    ownerState: MultiSelectUnstyledOwnerState<TValue>;
  }
>;