Description
TypeScript Version: 3.4.1
Search Terms:
tsc, slow, typecheck, 3.4.1, styled-components
Code
I have simple typecheck script in my package.json:
"typecheck": "tsc --project tsconfig.json --noEmit --skipLibCheck",
It work 20 times slower on 3.4.1, than on 3.3.4000 (91s vs 4.5s)
It's almost impossible to work with that, because IDE almost can't analyse anything in this conditions. I have same behaviour on MacOS 10.14.3 and on Windows 10
My tsconfig file:
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve"
},
"include": [
"src"
]
}
EDIT: I found the reason of this slowness - styled-components, so faster way to reproduce this issue: (also online demo added below)
yarn create react-app my-app --typescript
cd my-app
yarn add styled-components @types/styled-components
add to src/index.tsx
:
import styled from 'styled-components'
const Styled = styled.div``
add in package json tsc script in scripts section:
"tsc": "tsc"
run yarn tsc
if you'll downgrade typescript version to 3.3.4000 or comment 2 lines of code in src/index.tsx
it will work 20 times faster
Expected behavior:
It should works with same acceptable time
Actual behavior:
It works 20 times slower
Playground Link:
I will try to create reproducible example, but I have pretty simple react CRA 2.0 application.
EDIT: Reproducible demo here: https://repl.it/@EugeneDraitsev/slow-tsc-341
Related Issues: