-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
typeof with identically named type and value causes invalid .d.ts output #58390
Comments
Bisects to #57772 |
@RyanCavanaugh Is this not worth patching into TS 5.5? Given how easy this is to repro, I'd assume this would occur often in the wild. Issues like this that are only exposed in build output are also particularly insidious because most library authors don't explicitly check their build output, and most consumers use |
This would be quite a disaster especially considering this only occurs in the .d.ts which for libraries are often generated just before publishing. |
Following as Effect may be affected |
Given that this was introduced before release wouldn't it be a better strategy to revert the commit that introduced the bug and defer that commit to 5.6? It feels a bit odd to introduce a bug, recognize that it is a bug and defer the fix till a further version. I would understand the choice if this didn't came up pre-release |
Hmm this matches a ton of common behavior, even the humble export const Color = {
Red: "Red",
Green: "Green",
Blue: "Blue"
} as const
export type Color = typeof Color
export type Colors = Color[keyof Color] This being broked^ export const Color = {
Red: "Red",
Green: "Green",
Blue: "Blue"
} as const
export type Color = typeof Color[keyof typeof Color] hmmmm |
Yeah, good points all around |
π Search Terms
type, value, .d.ts, circular, circularity, invalid, output, declaration
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?ts=5.5.0-dev.20240501#code/KYDwDg9gTgLgBAYwgOwM7wCbFQqBLMGPFVOAXjgG8AoOOAMwggC44AiAIwEMo3qBfatVCRYcGAE8wwOFhz5CxNOXFTgEerOy4CREkA
π» Code
π Actual behavior
Actual .d.ts output:
π Expected behavior
Expected .d.ts output:
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: