mui / material-ui

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
https://mui.com/material-ui/
MIT License
93.6k stars 32.21k forks source link

[Typescript] ListItemTypeMap Type error #18930

Closed kaflan closed 3 years ago

kaflan commented 4 years ago

example solved

export interface ListItemTypeMap<P, D extends ElementType> {
  props: P & {
    alignItems?: 'flex-start' | 'center';
    autoFocus?: boolean;
    button?: boolean;
    ContainerComponent?: any;
    ContainerProps?: any;
    dense?: boolean;
    disabled?: boolean;
    disableGutters?: boolean;
    divider?: boolean;
    focusVisibleClassName?: string;
    selected?: boolean;
  };
  defaultComponent: D;
  classKey: ListItemCl

The last overload gave the following error.

Type '"li"' is not assignable to type '"object" | "abbr" | "address" | "article" | "aside" | "b" | "bdi" | "bdo" | "big" | "blockquote" | "caption" | "cite" | "code" | "col" | "colgroup" | "dd" | "del" | "details" | "dfn" | ... 61 more ... | undefined'.
<ListItem
                        ContainerComponent="li" // error
                        ContainerProps={{ ref: provided.innerRef }} // error
                        {...providedChild.draggableProps}
                        {...providedChild.dragHandleProps}
                        style={getItemStyle(
                          providedSnapshot.isDragging,
                          providedChild.draggableProps.style,
                        )}
                      >

https://codesandbox.io/s/4qp6vjp319?from-embed example

eps1lon commented 4 years ago

@kaflan We're not actively working on 3.x anymore.

If you still face this issue in 4.x please update your sandbox and fill out the issue template.

oliviertassinari commented 4 years ago

@kaflan Also, if you could provide a reproduction with TypeScript, it would help, it's almost not actionable for us otherwise (your codesandbox uses JavaScript).

mnajdova commented 3 years ago

Should we close, there hasn't been reproduction added for a year and a half?

eps1lon commented 3 years ago

Should we close, there hasn't been reproduction added for a year and a half?

Yep, looks like I just forgot to label it as "incomplete"