-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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 errors upgrading MUI from 4.9.5 to 4.9.9 #20441
Comments
Yeah this is problematic. Prettier's trailingCommas: all also applies to TypeScript and I think some trailing commas are only valid in later TS versions. Maybe trailingCommas: es5 for .d.ts files works. |
I'm happy to work on a PR for this one. What shall we do about |
This was by accident. We have an internal |
Oh nice! But still might be good to be able to lint against using the built-in one. I'll raise a PR shortly for trailing commas and using the internal |
Yeah this is what we wanted to avoid but I'd argue that this is more of an issue with a PR that was too big not the tooling. I would rather move forward here though (upcoming |
@eps1lon I wanted to ask about this a couple of days ago, this is an opportunity. What do you think about this diff? diff --git a/docs/src/pages/getting-started/supported-platforms/supported-platforms.md b/docs/src/pages/getting-started/supported-platforms/supported-platforms.md
index befc4ca39..e49aeba94 100644
--- a/docs/src/pages/getting-started/supported-platforms/supported-platforms.md
+++ b/docs/src/pages/getting-started/supported-platforms/supported-platforms.md
@@ -36,3 +36,9 @@ It's a must-do for static pages, but it needs to be put in balance with not doin
Material-UI supports the most recent versions of React, starting with ^16.8.0 (the one with the hooks).
Have a look at the older [versions](https://material-ui.com/versions/) for backward compatibility.
+
+## TypeScript
+
+Material-UI supports the most recent versions of TypeScript.
+However, the codebase doesn't follow semver for types.
+You can expect breaking changes between two minor versions.
+As of now, we support TypeScript ^3.8.0.
+Have a look at the older [versions](https://material-ui.com/versions/) for backward compatibility.
diff --git a/packages/material-ui/package.json b/packages/material-ui/package.json
index e682bb751..0b43f57b5 100644
--- a/packages/material-ui/package.json
+++ b/packages/material-ui/package.json
@@ -39,9 +39,13 @@
"peerDependencies": {
"@types/react": "^16.8.6",
"react": "^16.8.0",
- "react-dom": "^16.8.0"
+ "react-dom": "^16.8.0",
+ "typescript": "^3.8.0"
},
"peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ },
"@types/react": {
"optional": true
} |
I'm happy to add that as long as we say |
@NMinhNguyen So they are a couple of topics:
|
Not sure how well it works as I haven't used optional peer dependencies, but I'm for it
I think (but not 100% sure as I'm not a TS user myself) other packages do tend to follow semver for types, but I'm happy to be corrected!
Preferably the version that MUI v4 originally said it supported ( |
@eps1lon actually I just noticed another error that I initially omitted from the PR description because I thought it was valid, but upon further inspection I see that Should the TS be updated to match JS or the other way around? |
@eps1lon did you see the comment above? |
I think React.ReactNode includes optional |
if I specify EditUpdated the error above by just using |
Current Behavior 😯
I have been able to trace the following errors to some changes made recently to use TS features such as
Omit
which aren't available in 3.2.4 (as far as I understand, that's the minimum TS version that MUI supports) or trailing commas:Omit
)Click to expand
Expected Behavior 🤔
Steps to Reproduce 🕹
Steps:
@material-ui/core@4.9.9
tsc
usingtypescript@3.2.4
Context 🔦
We set a minimum supported version of TypeScript to 3.2.4 in our design system to match Material-UI but seems like the latest MUI version uses newer TypeScript features. This isn't usually a big issue to React projects, but we also support Angular teams via Custom Elements and usually bumping TypeScript requires them to bump their Angular versions too (usually across major version boundaries) which can be a bit painful. For example, Angular 7.2 supports TS 3.2.4, Angular 8.0.0 adds support for 3.4 dropping support for older versions, Angular 9.0.0 requires 3.6/3.7
Your Environment 🌎
The text was updated successfully, but these errors were encountered: