Exit codes
tsgo-strict uses three exit codes, following tsc conventions where possible.
| Code | Meaning | What to do |
|---|---|---|
0 | Clean — no strict diagnostics in the selected subset. | Nothing. Let CI pass. |
1 | Strict diagnostics were reported. | Inspect the output; fix or add // @ts-strict-ignore. |
2 | Tool, config, or runtime error. | Check stderr — likely a missing/invalid tsconfig or an unresolvable tsgo binary. |
Distinguishing 1 and 2 in CI
When you want your pipeline to report "type errors" vs "tool broken" differently, branch on the exit code:
bash
npx tsgo-strict
code=$?
case $code in
0) echo "✔ strict clean" ;;
1) echo "✘ strict type errors"; exit 1 ;;
2) echo "!! tsgo-strict itself failed"; exit 2 ;;
esacFrom Node, check result.exitCode from the programmatic API:
ts
const { exitCode } = await run();
if (exitCode === 2) {
throw new Error('tsgo-strict failed to run');
}Common causes of exit code 2
- The
projectpath doesn't resolve to a readabletsconfig.json. - No
tsgobinary was found (neitherTSGO_BINARY,node_modules/.bin/tsgo, norPATHhas one). - The plugin block in
compilerOptions.pluginsis malformed JSON or has the wrong shape. - An
excludePatternglob is invalid.