-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Regression in 4.8 where string union type widens to string #50635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
👋 Hi, I'm the Repro bot. I can help narrow down and track compiler bugs across releases! This comment reflects the current state of the repro in the issue body running against the nightly TypeScript. Issue body code block by @me4502
Historical Information
|
This comment was marked as off-topic.
This comment was marked as off-topic.
The change between 4.7.2 and 4.8.2 occurred at a2b785b. |
@typescript-bot agrees with your guess about the cause, which is strange and definitely unintentional since there is no binding pattern in the repro 🤔 |
I think the milestone should be adjusted because that ship has sailed... :) |
Thanks. I forgot to update this issue, but we decided that the fix looked a little risky to ship in a patch when weighed against the small number of reports of this issue we’ve gotten. |
Bug Report
🔎 Search Terms
string union widening
,string union regression
,union widening
🕗 Version & Regression Information
This regression occurred in 4.8.0, and can be reproduced with the
4.8.0-beta
, and nightly (4.9.0-dev.20220904
) tag in TS Playground. This works with4.7.4
.I feel like this might be related to the Improved inference from binding patterns change
⏯ Playground Link
Playground link with relevant code
To reproduce, hover over the "isWorking" variable to see that the type definition includes a union of the strings. Switch to 4.8.0-beta, and note that the type definition is now just
string
.💻 Code
🙁 Actual behavior
String union type is widened to
string
.🙂 Expected behavior
String union type remains a union, rather than widening
The text was updated successfully, but these errors were encountered: