whyts

v0.8.10
io.github.musatoktas/whyts Checked 4 days ago Published 1 month ago

Find out why a TypeScript project is slow: measured analysis and before/after comparison.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

analyze

Find out why a TypeScript project is slow. Runs one traced type check of the project (plus `runs` untraced timing runs) and returns compact JSON: Check time, file count, compiler error summary (not the full list of errors), `diagnoses` (a known slow-type pattern with location, evidence and a fix), the top 5 measured findings, and warnings. It takes as long as a full type check of the project (seconds to minutes), plus the extra timing runs.

ParameterTypeDescription
project *stringAbsolute path to a directory with a tsconfig.json, or to a tsconfig file.
maxOldSpaceMbintegerHeap limit in MB for the compiler process. Ignored with TypeScript 7.
runsintegerUntraced timing runs for a stable Check time (default 1). Each run is one more full type check. Use 3 or more for a median.
timeoutSecondsnumberCompiler timeout in seconds for each type check. Default 900.
typescriptstringPath to a typescript package directory to use instead of the one in the project (5.x, 6.x or 7.x).

compare

Prove whether a change made type checking faster or slower. Runs the full type check `runs` times for the baseline and for the candidate project (a copy or a git worktree of the same project, before and after the change), alternating the order, and returns a decision: `separated` (the ranges do not overlap, a real change, with direction), `within-noise` (no change can be claimed) or `not-comparable` (a side has compiler errors or the compilers differ). It takes about (2 x runs + 2) type checks, so it is slow: `runs` 3 gives a quick answer and 5 or more a firm one.

ParameterTypeDescription
baseline *stringAbsolute path to the project before the change (directory with tsconfig.json, or a tsconfig file).
candidate *stringAbsolute path to the project after the change. It must be a separate directory, for example a git worktree.
maxOldSpaceMbintegerHeap limit in MB for the compiler process. Ignored with TypeScript 7.
runsintegerMeasured runs per side (default 5, minimum 3 for a verdict).
timeoutSecondsnumberCompiler timeout in seconds for each type check. Default 900.
typescriptstringPath to a typescript package directory to use instead of the one in the project (5.x, 6.x or 7.x).

explain

Show why one file is in the TypeScript program: the shortest import chain from a configured root and the direct importers. It reads the import graph only and does not run the type checker, so it finishes in seconds.

ParameterTypeDescription
file *stringFile to explain, relative to the tsconfig directory.
project *stringAbsolute path to a directory with a tsconfig.json, or to a tsconfig file.
typescriptstringPath to a typescript package directory to use instead of the one in the project (5.x, 6.x or 7.x).