[icons-material] Simplify type declaration in built package.json#48724
[icons-material] Simplify type declaration in built package.json#48724ClementValot wants to merge 11 commits into
Conversation
Deploy previewhttps://deploy-preview-48724--material-ui.netlify.app/ Bundle size
Check out the code infra dashboard for more information about this PR. |
|
The above Bundle size preview doesn't include icons-material :( |
|
Hmmm the |
|
Does this PR have the same goal as #48689 ? |
|
Nope, this one only touches the |
…simplify-type-declaration
|
Still, I found a standard Typescript solution in typesVersions so that everything - yarn, attw, tsc, and everyone's disk space - is finally happy :) |
|
The |
|
Actually mui support for node10 and TS 7 is not mutually exclusive; Only the tests in In the end, the resulting types should still be transparent for the consumers, so I'm happy with where my trick landed 🤞 |
Hi 👋
The
@mui/icons-materialpackage exposes several thousands.d.tsand.d.mtsfiles, which all have the exact same content under a different filename.This helped uncover a silly edge case with yarn, which will be fixed, but also led me to think of a possible optimization in this package.
Having the wildcard export point to a single file reduces the overall volume of the package, with no loss of information for the type checker. I've run some tests, and from what I know from Typescript's type resolution, this should be a transparent change for the package consumers, and even a small relief for the TS engine :)
Also, the
index.d.mtsseemed to be entirely unused so that's one fewer big file