mui / mui/base-ui

Change SelectValueType to accept readonly arrays

Open Beginner friendly
#5,707 4 comments 0 reactions 0 assignees View on GitHub
good first issue
Dominant language
TypeScript
Stars
10.9k
Forks
543
Avg merge
1d 20h
Merged PRs (30d)
101

Description

# Feature request

## Summary

```ts
- type SelectValueType = Multiple extends true ? Value[] : Value;
+ type SelectValueType = Multiple extends true ? readonly Value[] : Value;
```

Allow passing `readonly` (immutable) array as value for Select.

## Examples in other libraries

Maybe not the best example because it's options and not value:
https://github.com/mui/material-ui/blob/77245fd41663c22eeedd3f7072deafd7aa1284da/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts#L298

## Motivation

I'm in react, so approximately all of my arrays are readonly, and I'm trying to write correct types.

Contributor guide

Open the contributing guide

Research direction

Find the SelectValueType definition in the TypeScript Select component and read its surrounding value type declarations. Update the multiple-value typing to accept readonly arrays, then run the relevant Select type checks or tests; done means readonly array values are accepted without weakening the single-value case.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.