Microsoft/TypeScript
GitHub ã§èŠãDouble error message when referencing variable of type union of string literals from ambient declaration
Open
#63,050 opened on 2026幎1æ25æ¥
Domain: Error MessagesFix AvailableHelp WantedPossible Improvement
Repository metrics
- Stars
- Â (48,455 stars)
- PR merge metrics
-  (å¹³åããŒãž 6d 17h) (30d ã§ 9 merged PRs)
説æ
ð Search Terms
double error, same message twice, ambient declaration, string literal union
ð Version & Regression Information
This changed between versions 3.9.7 and 4.0.5
⯠Playground Link
ð» Code
declare const x: "a" | "b"
const y: number = x
// ~
// Type 'string' is not assignable to type 'number'.
// Type 'string' is not assignable to type 'number'. (2322)
ð Actual behavior
You see same error message twice
ð Expected behavior
The error message should be the one in 3.9.7 ie...
Type '"a" | "b"' is not assignable to type 'number'.
Type '"a"' is not assignable to type 'number'. (2322)
Or the following message just once also works...
Type 'string' is not assignable to type 'number'. (2322)
Additional information about the issue
No response