Skip to content

Add minimal tsc output format#3698

Draft
JoviDeCroock wants to merge 1 commit intomicrosoft:mainfrom
JoviDeCroock:jovi/minimal-tsc-output-format
Draft

Add minimal tsc output format#3698
JoviDeCroock wants to merge 1 commit intomicrosoft:mainfrom
JoviDeCroock:jovi/minimal-tsc-output-format

Conversation

@JoviDeCroock
Copy link
Copy Markdown

@JoviDeCroock JoviDeCroock commented May 4, 2026

Summary

Adds an explicit --outputFormat minimal command-line option for tsgo diagnostics. The minimal reporter emits one diagnostic per line in the form:

path/to/file.ts:line:character: TS1234: message | chained message

This keeps the default output unchanged while giving tooling and agents a compact, stable format that is easier to parse and significantly cheaper to feed back into LLM context windows.

Motivation

AI coding agents frequently run tsc/tsgo and then include the compiler output in the next prompt. The existing pretty/default diagnostics are excellent for humans, but they include context, spacing, colors, and multi-line message chains that add a lot of tokens. A compact output format reduces token usage and makes repeated fix/test loops less noisy without taking away the current default human-facing experience.

As a future follow-up, we could also auto-select this format when tsgo is run by an agent. A similar principle is being explored in oxc by detecting agent-specific environment variables and switching to an agent-oriented output format: oxc-project/oxc#22068. That PR mirrors the environment detection used by unjs/std-env agents detection, which is also used by tools like Vitest.

},
})

want := "src/index.ts:1:17: TS2322: Type 'number' is not assignable to type 'string'. | The expected type comes from property 'x'\n"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be writing end-to-end tests in tsctests, not unit tests here (or elsehwere, really)

Copy link
Copy Markdown
Author

@JoviDeCroock JoviDeCroock May 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the feedback, very new to GO so appreciate you chiming in quickly here. The tests were generated ahead of time by an LLM so I had something sane to work against.

I explicitly left it in Draft for that reason so we could talk through the desire for this feature. I think it could be valuable in terms of working towards a future where we save tokens of diagnostics coming from testing/linting/...

@JoviDeCroock JoviDeCroock force-pushed the jovi/minimal-tsc-output-format branch from e22ba95 to 0dd2de9 Compare May 4, 2026 17:11
@JoviDeCroock
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants