Repository navigation
Description
Summary
When rtk tsc runs with the --pretty flag, type errors are silently swallowed and RTK reports TypeScript: No errors found even though tsc exits with a non-zero status. Without --pretty, RTK parses errors correctly. The bug is reliably reproducible.
Affected version
rtk 0.39.0 (latest at time of filing, installed via Homebrew on macOS arm64).
Reproduction
/tmp/rtk-test.ts:
const x: number = "string";/tmp/tsconfig-rtk-test.json:
{
"compilerOptions": {
"strict": true,
"noEmit": true,
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "node"
},
"files": ["/tmp/rtk-test.ts"]
}Run both:
$ rtk tsc --noEmit -p /tmp/tsconfig-rtk-test.json
../../../../tmp/rtk-test.ts(1,7): error TS2322: Type 'string' is not assignable to type 'number'.
═══════════════════════════════════════
TypeScript: 1 errors in 1 files
# exit code: 2
$ rtk tsc --noEmit --pretty -p /tmp/tsconfig-rtk-test.json
TypeScript: No errors found
# exit code: 2
Expected vs actual
- Expected: With
--pretty, RTK should still display the errors (or at least not lie) — minimum bar is that the textual summary matches reality whentscexits non-zero. - Actual: Exit code is correctly propagated (2), but stdout reports
No errors found. A consumer looking at output (human or LLM) sees a fake success message.
This is dangerous in CI/agent contexts: errors get hidden by a wrapper that claims success, and downstream steps (e.g. && next build) may proceed as if green. Concretely, this was discovered while running npx tsc --noEmit --pretty from a Claude Code session — the wrapper hid type errors that Vercel's build then caught, causing a failed deploy.
Root cause hypothesis
tsc --pretty emits ANSI escape codes (colors, formatting) on each error line. RTK's regex for matching tsc error lines (path(L,C): error TSxxxx: ...) does not account for embedded ANSI sequences, so it counts zero matches. With zero parsed errors, RTK synthesizes No errors found regardless of the actual exit code.
Suggested fix
Either (or both):
- Strip ANSI escape sequences from each line before regex-matching error lines.
- Cross-check parsed error count against the child exit code: if
exit != 0 && parsed_errors == 0, fall back to passthrough of the raw output rather than synthesizing a success summary. This is a good general invariant — RTK's summary should never contradict the wrapped tool's exit code.
Option 2 is the safer default since it also catches future tsc output format changes that the regex hasn't adapted to.
Activity
pszymkowiak commentedon May 27, 2026
🔍 Automated Triage
bughighSummary
RTK's tsc wrapper fails to parse ANSI-colored output from --pretty flag, synthesizing a false 'No errors found' summary while correctly propagating a non-zero exit code — dangerous in CI/agent pipelines.
📁 Relevant files
src/wrappers/tsc.rsTriaged automatically by wshm · This is an automated analysis, not a human review.
SQReder commentedon Aug 16, 2026
Still reproduces on
0.45.0, and there is a trigger that needs no--prettyflag at all — which I think raises the severity of this issue.@typescript/native(tsgo, the TypeScript 7 native preview) emits the pretty format unconditionally, including when stdout is a pipe. Classictscturns pretty off automatically when it is not writing to a TTY, which is why this bug normally hides behind an explicit--pretty. tsgo does not, so in any workspace whosenode_modules/.bin/tscresolves to@typescript/native, an ordinary invocation with no flags silently reports a clean typecheck.Verified against
@typescript/native7.0.2 on rtk 0.45.0, one source file containing two genuineTS2322errors:Same compiler, same project, same errors; the only difference is the output format. Note that tsgo exits 1 on type errors where classic
tscexits 2, so an exit-code guard should test!= 0rather than a specific value.Minimal repro on stock
[email protected](rtk 0.45.0), for a version that does not need the native preview installed:Two things that may help whoever picks this up:
The tee log written alongside the false summary contains the complete, correct error output. The data reaches rtk intact — only the summariser's regex misses it. Parsing the pretty form is a matter of stripping ANSI first and then matching
^(?<file>.+?):(?<line>\d+):(?<col>\d+) - error (?<code>TS\d+):in addition to the existingpath(line,col): error TSxxxxform.Independently of the regex, the exit-code guard proposed in tsc filter: "TypeScript: No errors found" is printed on a non-zero exit, so a tsc that never ran reads as a clean typecheck #3220 would have contained this: when the wrapped command exits non-zero but zero diagnostics were parsed, print that the output could not be parsed and point at the tee log rather than a success line. The two issues have different root causes but the same blast radius, and that guard is the one that fails safe for both.
Context for why the severity is worth a second look: rtk's whole purpose is to be the layer an agent reads instead of raw output, so a false green is the one failure mode that cannot be recovered downstream. In our case a real
TS2304: Cannot find name '...'(a missing import) passed a typecheck this way and surfaced only later, as a 500 in an integration test.fix(tsc): handle pretty diagnostics
fix(tsc): handle pretty diagnostics