-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Description
Steps to reproduce
Steps:
- Open this link to live example: https://stackblitz.com/edit/github-jgrb4bnu-1angvf1e?file=src%2FcreateTheme.tsx
- stop the vite dev server
- run
npm run tsc
Current behavior
Compiling the presented code leads to a long compile time of about 3.8 seconds with a diagnostics like this:
The Diagnostics should look somewhat like this:
Files: 668
Lines: 105797
Identifiers: 106872
Symbols: 215281
Types: 51020
Instantiations: 450384
Memory used: 0K
I/O read: 0.02s
I/O write: 0.00s
Parse time: 0.40s
Bind time: 0.09s
Check time: 3.27s
Emit time: 0.00s
Total time: 3.77s
Expected behavior
The compile time should be much much lower for a small project like this and by changing line 16 and 17 the compile time goes down to 0.8 seconds with a diagnostics like this:
Files: 668
Lines: 105799
Identifiers: 106875
Symbols: 75712
Types: 7125
Instantiations: 29965
Memory used: 0K
I/O read: 0.02s
I/O write: 0.00s
Parse time: 0.41s
Bind time: 0.09s
Check time: 0.25s
Emit time: 0.00s
Total time: 0.76s
Context
When passing a Theme Object into the createTheme function, instead of some ThemeOptions. the compile time increases due to circular depencencies. This problem is adresses in this PoC: #47069 and would be fixed by it, but currently this leads to a long compile time.
Maybe a little warning on the createTheme page would be enough so Users know that they should not do that (or cast theme as ThemeOptions)
Your environment
npx @mui/envinfo
Don't forget to mention which browser you used.
Output from `npx @mui/envinfo` goes here.
Search keywords: createThme, Theme