Skip to content

Conversation

@oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Sep 2, 2023

Before
Screenshot 2023-09-02 at 23 51 05

After
Screenshot 2023-09-02 at 23 51 16

See for why https://github.com/DefinitelyTyped/DefinitelyTyped/blob/486ea9a7bc7f758d8d8f940e244dd3f447b905ea/types/react/v17/index.d.ts#L1040

The difference is that:
Screenshot 2023-09-02 at 23 52 18

interface RefObject<T> {
  readonly current: T | null;
}

interface MutableRefObject<T> {
  current: T;
}

Does it matter? Probably not, but it seems to be closer to how the API is supposed to be used. It's more accurate.

@oliviertassinari oliviertassinari added typescript internal Behind-the-scenes enhancement. Formerly called “core”. labels Sep 2, 2023
@mui-bot
Copy link

mui-bot commented Sep 2, 2023

Netlify deploy preview

https://deploy-preview-38762--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against 00dead4

@michaldudak michaldudak added package: @mui/base Specific to @mui/base (legacy). package: joy-ui Specific to Joy UI. and removed internal Behind-the-scenes enhancement. Formerly called “core”. labels Sep 4, 2023
Copy link
Member

@michaldudak michaldudak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good!

@michaldudak michaldudak changed the title [core] None mutable refs [core] Use immutable refs Sep 4, 2023
@michaldudak michaldudak changed the title [core] Use immutable refs [typescript][base-ui][joy-ui] Use immutable refs Sep 4, 2023
@oliviertassinari oliviertassinari changed the title [typescript][base-ui][joy-ui] Use immutable refs [core] Use immutable refs Sep 4, 2023
@oliviertassinari oliviertassinari added the internal Behind-the-scenes enhancement. Formerly called “core”. label Sep 4, 2023
@oliviertassinari oliviertassinari merged commit 45f7e73 into mui:master Sep 4, 2023
@oliviertassinari oliviertassinari deleted the ref-non-mutable branch September 4, 2023 20:35
@oliviertassinari
Copy link
Member Author

oliviertassinari commented Sep 4, 2023

Haha, I'm guilty of perfectionism as it likely doesn't matter 🙃, but loved the dopamine hit.

mnajdova pushed a commit to mnajdova/material-ui that referenced this pull request Sep 8, 2023
mnajdova pushed a commit to mnajdova/material-ui that referenced this pull request Sep 8, 2023
xcode-it pushed a commit to xcode-it/material-ui that referenced this pull request Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Behind-the-scenes enhancement. Formerly called “core”. package: joy-ui Specific to Joy UI. package: @mui/base Specific to @mui/base (legacy). typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants