Skip to content

[v6] Link get No overload matches this call with Material-UI #7831

@nuanyang233

Description

@nuanyang233

Version

6.0.0-beta.0

Test Case

function ListItemLinkUnStyled({ nested, ...props }: LinkProps & ListItemProps & { nested?: boolean; to: string }) {
    return <MuiListItem button component={Link} selected={!!useMatch(props.to)} {...props} />
}

Expected Behavior

working fine

Actual Behavior

The compont={Link} get a ts error

The last overload gave the following error.
    Type '{ replace?: boolean | undefined; state?: State | undefined; to: To & string; className?: string | undefined; style?: CSSProperties | undefined; slot?: string | undefined; ... 276 more ...; component: ForwardRefExoticComponent<...>; }' is not assignable to type 'IntrinsicAttributes & { button: true; } & { alignItems?: "flex-start" | "center" | undefined; autoFocus?: boolean | undefined; children?: ReactNode; ... 8 more ...; sx?: SxProps<...> | undefined; } & Omit<...> & CommonProps & Pick<...>'.
      Property 'component' does not exist on type 'IntrinsicAttributes & { button: true; } & { alignItems?: "flex-start" | "center" | undefined; autoFocus?: boolean | undefined; children?: ReactNode; ... 8 more ...; sx?: SxProps<...> | undefined; } & Omit<...> & CommonProps & Pick<...>'.

Here is working fine in v5 version, I checked the code and found that the type definition of Link in v6 is different from that in v5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions