You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
They instead be typed to take ReadonlyArray where the array is not mutated - that then allows the consumer to pass a mutable or a readonly array.
😯 Current Behavior
An error trying to assign a readonly array to a prop that takes a mutable array
💁 Possible Solution
Updating alot of T[] -> ReadonlyArray<T>
🔦 Context
We use readonly arrays frequently to make sure no-one is mutating a value they shouldn't and causing a unintended side effect. The current design means we would need to add a typescript expect error to use readonly arrays or a cast.
🖥️ Steps to Reproduce
N/A
Version
N/A
What browsers are you seeing the problem on?
Other
If other, please specify.
No response
What operating system are you using?
N/A
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response
The text was updated successfully, but these errors were encountered:
Provide a general summary of the issue here
Props that take array's generally use the mutable form e.g. here the columns
https://github.com/adobe/react-spectrum/blob/main/packages/react-aria-components/src/Table.tsx#L529
🤔 Expected Behavior?
They instead be typed to take ReadonlyArray where the array is not mutated - that then allows the consumer to pass a mutable or a readonly array.
😯 Current Behavior
An error trying to assign a readonly array to a prop that takes a mutable array
💁 Possible Solution
Updating alot of
T[]
->ReadonlyArray<T>
🔦 Context
We use readonly arrays frequently to make sure no-one is mutating a value they shouldn't and causing a unintended side effect. The current design means we would need to add a typescript expect error to use readonly arrays or a cast.
🖥️ Steps to Reproduce
N/A
Version
N/A
What browsers are you seeing the problem on?
Other
If other, please specify.
No response
What operating system are you using?
N/A
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response
The text was updated successfully, but these errors were encountered: