-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
3.4.1 tsc works 20! times slower than 3.3.4 #30663
Comments
Same here. I also got some significant performance hit in my front-end build (and I'm also using |
Same here, rollback to TypeScript |
Same issue here, switched back to |
I have investigated this with TypeScript 3.4.1, and the issue does not show up (for me) with @types/styled-components v4.1.10, but does happen with @types/styled-components v4.1.11. The change between these two versions is related to distributing over union types. Perhaps this helps figure it out. |
I tried downgrading to @types/styled-components v4.1.10, but still see unbelievable slowdown on TS versions >= 3.4.0. It's a big project, with lots of dependencies so it's hard to pinpoint what exactly is triggering it, but right now compilation is so slow that development is nearly impossible – 80 seconds for every compile, 75 secs in type checking. WebStorm can't even recompile the code because of the timeouts. Fans are spinning like crazy on i7, 4x2 HT cores, 42 GB RAM, 4GB node heap iMac. I don't think we can wait until 3.5.0 for the fix, it would just mean that we would just need to skip 3.4.0 entirely. Disabling strict function type checking is a very radical decision for a complex project. |
相关Typescript [issue](microsoft/TypeScript#30663)
I can confirm that a downgrade to @weswigham So could you maybe revert the concerned commit (probably 6605356e) in the styled-components typings to workaround this issue? |
@ulrichb I checked downgrade seanario to |
My observations of the front-end build times (
@ TS Team: Note that my problem is not really the additional ~1 min 20 sec in the build script, but that my IDE (WebStorm) time-outs during type-checking => so I don't get any red squiggles in TSX modules containing styled-components (which concerns almost my whole front-end code base) :/ A downgrade to styled-components 4.1.10 solves/workarounds this issue. |
@ulrichb you compared build time, but not |
Yesterday, without looking for the issue in this repo, I opened this issue in @types/styled-components DefinitelyTyped/DefinitelyTyped#34391. @michsa saw that the performance change was done between the builds Maybe it's worth to cross the info on both threads to find down the root of this issue. |
That's really unfortunate. The fix likely responsible for the performance regression was applied before 3.4 was released. We couldn't detect major performance regressions so it seemed fine. The same fix was also applied to |
FYI, I've done some preliminary investigation, and the performance impact is caused by a large union of types (eg, the union of all possible jsx components) being pushed thru multiple layers of distributive conditionals with nested |
I am also experiencing a significant slow-down after upgrading TypeScript from 3.3.4000 to 3.4.1. As a result, live IDE type checking is almost inoperable. Also have |
Yeah, count me in too. |
Same here with "typescript" => "3.4.1" and "styled-components" => "4.2.0", my vscode hint popups just hang up while trying to infer any types for minutes. |
Affiliated issue here, I am experiencing compile-time heap overflow |
@jewseppi Is it an issue with |
@weswigham would I have to eject to get access to a babel.rc |
Maybe? If you're using CRA,I don't think so - you should just be able to update the version of what you've installed. |
I tried |
Do we know a rough timeframe for 3.5 release? |
@fabb: May 2019, as per roadmap. |
- This commit also fixes lag caused by styled-components types and TypeScript by downgrading. microsoft/TypeScript#30663
- Styled Components types were not playing well with TypeScript 3.4. Downgrading to 3.3.3333 until it is fixed in 3.5. microsoft/TypeScript#30663
I am using
Still a memory leak and crash. |
You have a repro you can share? |
I think it may be a similar problem. |
…3.* til 3.4.* ble det noe tull med typesystemet som gjorde at typesjekkinga tok evigheter. Følg med her for å se når det er løst: microsoft/TypeScript#31227, microsoft/TypeScript#30663
@FishOrBear Your crash is fixed in the latest nightlies and the |
@weswigham |
Hi there, I'm trying to fix this issue myself and having a hard time understanding which versions of @types/styled-components, etc. to use to solve the problem. I'm currently using: react-scripts@3.0.1 I'm using VS Code and still having some noticeable delays for things like underlining type errors in files that use styled-components. Commenting out any styled components removes the delay. Am I missing a package upgrade somewhere? |
Actually I just figured it out. My VS Code workspace was still using 3.4.5. Changing the workspace to use 3.5.1 fixed the problem. |
Having a similar issue. See facebook/create-react-app#7003 |
If you're still on an older version of TS that has the problem, you're still going to have the issue ❤️ I'm going to lock this issue - anyone with a perf problem on the latest version of TS has a distinct and different problem and should open a new thread. Anyone finding this from google search results and is looking for a solution - try using TS 3.5+ (and then if your problem persists, let us know in a new issue), or try downgrading your |
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:
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:
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
:add in package json tsc script in scripts section:
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 fasterExpected 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
3.3.4000:
3.4.1:
Related Issues:
The text was updated successfully, but these errors were encountered: