Tim Perry
Tim Perry

Reputation: 13216

How to debug TypeScript compilation performance issues

My TypeScript project has been going for a while now, and is quite large. Recently compile time performance has become significantly worse. I think it's likely that some of the 'neat' typing tricks that I've included somewhere are causing this.

Unfortunately it's a large project, and includes many other large TypeScript dependencies, so it's hard to know the exact root cause.

Are there any tools to debug TS compiler typechecking performance in situations like this? E.g. to see which files/types take TypeScript the most time to compile.

Upvotes: 17

Views: 3459

Answers (1)

TypeScript 4.1 introduced a generateTrace flag to make it easier to identify the parts of a program that are taking the most time to compile.

There is a dedicated WIKI here

Please keep in mind:

This feature is still experimental and will likely change significantly in TS 4.2

Upvotes: 7

Related Questions