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

[material-ui] Update TypeScript supports in v6 #40996

Closed
oliviertassinari opened this issue Feb 7, 2024 · 5 comments · Fixed by #43116
Closed

[material-ui] Update TypeScript supports in v6 #40996

oliviertassinari opened this issue Feb 7, 2024 · 5 comments · Fixed by #43116
Assignees
Labels
breaking change package: base-ui Specific to @mui/base package: material-ui Specific to @mui/material package: system Specific to @mui/system typescript v6.x

Comments

@oliviertassinari
Copy link
Member

oliviertassinari commented Feb 7, 2024

Summary

We likely can increase the minimum version of TypeScript supported: https://mui.com/material-ui/getting-started/supported-platforms/#typescript. I don't know about how much but likely some level.

Related issue with TypeScript support (which could indicate how far down we need to support TypeScript in terms of versions)

Examples

No response

Motivation

No response

Search keywords: TypeScript minimum version

@oliviertassinari oliviertassinari added breaking change package: system Specific to @mui/system package: material-ui Specific to @mui/material status: waiting for maintainer These issues haven't been looked at yet by a maintainer package: base-ui Specific to @mui/base labels Feb 7, 2024
@oliviertassinari oliviertassinari added this to the Material UI: v6 milestone Feb 7, 2024
@danilo-leal danilo-leal removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Mar 5, 2024
@oliviertassinari
Copy link
Member Author

oliviertassinari commented Apr 20, 2024

Base UI is in theory not allowed to do this in its latest version: https://github.com/mui/base-ui/blob/4a4ccebd750dea6252cfdc07c55eb4ea474eaebe/packages/mui-base/src/index.ts#L16 cc @atomiks for context (Base UI version range can only be wider than Material UI since it's a dependency)

It breaks https://mui.com/material-ui/getting-started/supported-platforms/#typescript because this was only added in v4.5: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-5.html#type-modifiers-on-import-names.

So 👍 on my end to at the very least bump TypeScrpt min version support from v3.5 to v3.8 to get access to https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html. It's actually already broken today in Material UI and I didn't see issues about it.

Also worth looking at: https://tools-public.mui.com/prod/pages/npmVersion?package=typescript. It looks like we could bump this to at least v4.0:

SCR-20240421-cfvv

Should we maybe go to v4.5 to get import { type Foo }? I don't know. It's already old: https://devblogs.microsoft.com/typescript/announcing-typescript-4-5/. So maybe we could say:

3.8 was released February 20th, 2020. Material UI v5 was released Sep 16, 2021. We could hence pick the TypeScript version that is 18 months old: TypeScript 4.9.

If we instead uses https://github.com/DefinitelyTyped/DefinitelyTyped?tab=readme-ov-file#support-window

SCR-20240421-ckvs

we would then go with v4.8. I guess it's the simplest we can do? What we already say we do in the docs:

Material UI requires a minimum version of TypeScript 3.5. This aims to match the policy of DefinitelyTyped, with the support of the versions of TypeScript that are less than two years old.

@DiegoAndai
Copy link
Member

Hey, @oliviertassinari!

Do you think this issue should include work besides updating the minimum typescript version mentioned in the docs? Or is that all that needs to be done?

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Jul 18, 2024

@DiegoAndai For the stable release, upgrading the minimum version in the docs, e.g. migration guide from v3.5 to v4.5 seems to be all that is needed.

After, I imagine that we could start to

  • adopt the type import. Base UI is already using those.
  • else?

Should we even go further?

  • v4.7 has export type field in package.json. Maybe it's relevant
  • else?

@oliviertassinari
Copy link
Member Author

Actually, there is code to remove from the docs:

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Aug 16, 2024

Actually, there is code to remove from the docs: https://github.com/search?q=org%3Amui+%22TypeScript+3.x%22&type=code

Moved to mui/mui-x#14239 to guarantee we don't miss the ones in MUI X.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change package: base-ui Specific to @mui/base package: material-ui Specific to @mui/material package: system Specific to @mui/system typescript v6.x
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants