Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TablePagination][material-ui] Type error for hiddenLabel prop in SelectProps #38487

Closed
2 tasks done
MonstraG opened this issue Aug 15, 2023 · 4 comments · Fixed by #39137
Closed
2 tasks done

[TablePagination][material-ui] Type error for hiddenLabel prop in SelectProps #38487

MonstraG opened this issue Aug 15, 2023 · 4 comments · Fixed by #39137
Labels
bug 🐛 Something doesn't work component: select This is the name of the generic UI component, not the React module! component: TablePagination The React component. package: material-ui Specific to @mui/material ready to take Help wanted. Guidance available. There is a high chance the change will be accepted typescript

Comments

@MonstraG
Copy link
Contributor

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 🕹

Link to live example:
https://codesandbox.io/s/pensive-bardeen-2kq5g6?file=/src/App.tsx

Current behavior 😯

Typescript error
No overload matches this call.
  Overload 1 of 2, '(props: { component: "div"; } & TablePaginationBaseProps & { ActionsComponent?: ElementType<TablePaginationActionsProps>; ... 15 more ...; sx?: SxProps<...>; } & CommonProps & Omit<...>): Element', gave the following error.
    Type '{ variant: "filled"; size: "small"; hiddenLabel: true; disableUnderline: true; }' is not assignable to type 'Partial<SelectProps<unknown>>'.
      Object literal may only specify known properties, and 'hiddenLabel' does not exist in type 'Partial<SelectProps<unknown>>'.
  Overload 2 of 2, '(props: DefaultComponentProps<TablePaginationTypeMap<{}, JSXElementConstructor<TablePaginationBaseProps>>>): Element', gave the following error.
    Type '{ variant: "filled"; size: "small"; hiddenLabel: true; disableUnderline: true; }' is not assignable to type 'Partial<SelectProps<unknown>>'.
      Object literal may only specify known properties, and 'hiddenLabel' does not exist in type 'Partial<SelectProps<unknown>>'.ts(2769)

But hiddenLabel works

Expected behavior 🤔

Everything works without errors

Context 🔦

Workaround:

SelectProps={
	{
		variant: "filled",
		size: "small",
		hiddenLabel: true,
		disableUnderline: true
	} as Omit<FilledInputProps, "onChange">
}

Your environment 🌎

See live link

@MonstraG MonstraG added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Aug 15, 2023
@MonstraG
Copy link
Contributor Author

On related note, size in TablePagination seems to not do anything.

@ZeeshanTamboli
Copy link
Member

@MonstraG Thanks for flagging the problem. It's indeed a bug.

The issue lies for the SelectProps prop used by TablePagination, which uses the Select component's TypeScript types. To resolve this, we can apply prop types on the Select component based on the chosen variant, similar to what we did for TextField in this pull request: #36737.

@ZeeshanTamboli ZeeshanTamboli added bug 🐛 Something doesn't work component: select This is the name of the generic UI component, not the React module! typescript package: material-ui Specific to @mui/material ready to take Help wanted. Guidance available. There is a high chance the change will be accepted and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Sep 20, 2023
@ZeeshanTamboli ZeeshanTamboli changed the title [TablePagination] doesn't allow hiddenLabel [TablePagination]Type error for hiddenLabel prop in SelectProps Sep 20, 2023
@ZeeshanTamboli ZeeshanTamboli changed the title [TablePagination]Type error for hiddenLabel prop in SelectProps [TablePagination] Type error for hiddenLabel prop in SelectProps Sep 20, 2023
@ZeeshanTamboli ZeeshanTamboli changed the title [TablePagination] Type error for hiddenLabel prop in SelectProps [TablePagination][material-ui] Type error for hiddenLabel prop in SelectProps Sep 20, 2023
@PaulKristoffersson
Copy link
Contributor

I can take a look at this issue.

@ZeeshanTamboli
Copy link
Member

@PaulKristoffersson Feel free to create a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: select This is the name of the generic UI component, not the React module! component: TablePagination The React component. package: material-ui Specific to @mui/material ready to take Help wanted. Guidance available. There is a high chance the change will be accepted typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants