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

[typescript] Replace Array API with ReadonlyArray #40750

Open
oliviertassinari opened this issue Jan 23, 2024 · 4 comments · Fixed by #40754
Open

[typescript] Replace Array API with ReadonlyArray #40750

oliviertassinari opened this issue Jan 23, 2024 · 4 comments · Fixed by #40754
Labels
enhancement This is not a bug, nor a new feature package: base-ui Specific to @mui/base package: joy-ui Specific to @mui/joy package: material-ui Specific to @mui/material package: system Specific to @mui/system typescript

Comments

@oliviertassinari
Copy link
Member

oliviertassinari commented Jan 23, 2024

Steps to reproduce

A good number of API use Array while using ReadonlyArray would be better DX, examples of such cases

Current behavior

No response

Expected behavior

No response

Context

Compare:

vs.

We have solved this twice already:

#25155
#40481

We might as well solve it once for all.

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: ReadonlyArray

@DiegoAndai
Copy link
Member

This could be a good improvement to ship in v6, will add it to the milestone

@DiegoAndai DiegoAndai added enhancement This is not a bug, nor a new feature and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 23, 2024
@DiegoAndai DiegoAndai added this to the Material UI: v6 milestone Jan 23, 2024
@ant-plotnikov
Copy link

hey everyone. can I pick this up?

@danilo-leal danilo-leal changed the title [typescript] Replace Array API with ReadonlyArray [material-ui][typescript] Replace Array API with ReadonlyArray Jan 23, 2024
@danilo-leal danilo-leal added the package: material-ui Specific to @mui/material label Jan 23, 2024
@oliviertassinari
Copy link
Member Author

oliviertassinari commented Jan 23, 2024

This could be a good improvement to ship in v6, will add it to the milestone

@DiegoAndai I wonder, I feel that major milestones should be focused on changes that require breaking changes (big features that require breaking changes or new major features to offset the removal of deprecated APIs) to decorelate things.
(e.g. I think it's closer to how MUI X operates for majors)

The rest could go into iteration plans like TypeScript has microsoft/TypeScript#56948 (3 months) or VS Code has microsoft/vscode#201255 (1 month).

This issue is small, we could add "good to take" and delegate to the community, optimizing for whenever a community member has time to donate (overall maximizing "time donation" for the community).


It's also a Base UI issue.

@oliviertassinari oliviertassinari added the package: base-ui Specific to @mui/base label Jan 23, 2024
@oliviertassinari oliviertassinari changed the title [material-ui][typescript] Replace Array API with ReadonlyArray [typescript] Replace Array API with ReadonlyArray Jan 23, 2024
@oliviertassinari oliviertassinari removed this from the Material UI: v6 milestone Feb 7, 2024
@oliviertassinari
Copy link
Member Author

oliviertassinari commented Feb 7, 2024

We migrated a good chunk in #40754 and #40972 which is great but I think the issue should be about updating all our public APIs to accept read only arrays, there are more e.g.

type ResponsiveStyleValue<T> = T | Array<T | null> | { [key in Breakpoint]?: T | null };

? Array<Value | AutocompleteFreeSoloValueMapping<FreeSolo>>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is not a bug, nor a new feature package: base-ui Specific to @mui/base package: joy-ui Specific to @mui/joy package: material-ui Specific to @mui/material package: system Specific to @mui/system typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants