-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Description
TypeScript Version: 2.9.2
Search Terms:
MUI slow typescript
TSC compiles all MUI files
Code
In a react project, I use the UI library MUI (1.0).
In total, I'm doing around 15 imports of this library, always in the following way:
import CircularProgress from '@material-ui/core/CircularProgress/CircularProgress';
tsconfig.json
{
"compilerOptions": {
"baseUrl": "./src",
"outDir": "build/dist",
"target": "es5",
"lib": ["es6", "es7", "dom"],
"sourceMap": true,
"allowJs": false,
"jsx": "react",
"esModuleInterop": true,
"skipLibCheck": true,
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"rootDir": "./src",
"noEmitOnError": false,
"isolatedModules": true,
"strictPropertyInitialization": false,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"noErrorTruncation": true,
"noImplicitReturns": true,
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"diagnostics": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": true
},
"include": [
"src/**/*"
],
"exclude": [
"dist",
"build",
"node_modules",
"src/**/__tests__"
],
"defaultSeverity": "warning"
}Expected behavior:
TS picks up only the type definitions it needs from that library. (around 20 files, as I counted)
Code compiles in 3-6 seconds, if I remove MUI (with lots of errors, certainly)

Actual behavior:
TS pulls the entire MUI library, with over 600.000 types
Compilation (type checking) usually takes >1min

tsc --extendedDiagnostics --listFiles --noEmit

and it goes on...
I would expect this to happen if I was importing from the core modules, which exports all types, but I am most definitely not.
Related Issues:
No :( I found other cases of slow compilation, but not of this sort.