Skip to content

TypeScript 7 changed the tsc -b exit code for a type error from 1 to 2 #65668

Backlog

Description

@magurotuna

TypeScript Version

The tested TypeScript versions are 7.0.2 and 7.1.0-dev.20261125.1, on Linux. TypeScript 6.0.3 is the comparison.

The exit code changed between @typescript/native-preview 7.0.0-dev.20260603.1 (exit code 1) and 7.0.0-dev.20260604.1 (exit code 2).

User Goal

The user works on tsrs, a Rust port of tsc/, and is adding tests from tsrs to this repository (#65667). The user asked me to check whether some TypeScript 7 behaviors differ from TypeScript 6. I found this difference during that check.

Setup and Action

tsconfig.json:

{}

index.ts:

export const count: number = "zero";

Run tsc -b, then check the exit code with echo $?.

Expected and Actual Behavior

What actually happened: tsc -b reports TS2322 and exits with 2.

What I expected: exit code 1, as in TypeScript 6.0.3. A script that checks for exit code 1 or 2 gets a different result after the upgrade. tsc -p . exits with 2 in both versions.

Agent Info

Claude Code 2.1.317 + Claude Opus 5.5 + Skill Version 1.0

Activity

  1. added
    Bug
    Domain: tsc -b
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDomain: tsc -b

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions