Skip to content

Debugging long check times with TypeScript? #24435

Closed
@AnyhowStep

Description

@AnyhowStep

TypeScript Version: 2.9.0-dev.20180516

I have a toy project I've been working on and, in general, it takes about 50-60s to type check, and, sometimes, I get out of memory exceptions.

> node --max-old-space-size=8192 ./node_modules/typescript/lib/tsc.js --noEmit --noErrorTruncation --diagnostics

Files:            166
Lines:          57676
Nodes:         312303
Identifiers:   108968
Symbols:       158671
Types:          75995
Memory used: 1354006K
I/O read:       0.04s
I/O write:      0.00s
Parse time:     2.18s
Bind time:      0.90s
Check time:    60.80s
Emit time:      0.00s
Total time:    63.89s

I'm unsure if such wait times are normal or if it's just me.

I'm finally writing this question because I added one method to a class and it caused tsc to not terminate. I've waited over twenty minutes and it's still not ending.

If I comment out the method I just added, I can get tsc to terminate without errors.


The code in question is here

(Ignore that the folder is called declaration-v2, I never got around to renaming it)


Is there a way to get tsc to output what phase of the check it's at and what files it's reading as it checks, etc.?

Something like,

Reading file X.ts
Checking class A
Checking class B
Reading file Y.ts
Checking class C

--listFiles isn't particularly helpful for this case because it outputs that at the end, and tsc won't even terminate at the moment.

Or are there other guidelines I can use to debug long check times?

I understand the type system is very complex but I feel my productivity has been taking a huge hit when I can barely get IntelliSense and type checking to work with VS code, and Atom with atom-typescript just crashes, (I assume it's related to the long check times) and have to resort to using the terminal every once in a while to sanity check my code.


I understand that this issues page is not for questions like these but I've found the answers on StackOverflow unsatisfactory, and sitting here waiting for tsc to terminate is kind of frustrating.

I'm unsure if I can even reduce this to a minimal example because the project is huge. But at least I've found the method to comment/uncomment to reproduce the issue.


[EDIT]

This is also the first time I've encountered this problem. I'd actually be relieved if I could get an out of memory exception right now. Memory usage is actually surprisingly low. But it's just not terminating...

Maybe an infinite loop?

Metadata

Metadata

Assignees

Labels

DiscussionIssues which may not have code impact

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions