-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Open
Labels
Domain: APIRelates to the public API for TypeScriptRelates to the public API for TypeScriptExperimentation NeededSomeone needs to try this out to see what happensSomeone needs to try this out to see what happensSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
Bug Report
🔎 Search Terms
single member enum, reference types, compiler API
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about symbol references
💻 Code
export enum CoolEnum {
// ^^^^^^^^ symbol.id = 103
FOO,
// ^^^ symbol.id = 104
}
export interface Response {
x: CoolEnum
// ^ type.symbol.id = 104
}If I add a second member to the enum, the symbol references change to work as expected.
export enum CoolEnum {
// ^^^^^^^^ symbol.id = 103
FOO,
// ^^^ symbol.id = 104
BAR,
// ^^^ symbol.id = 105
}
export interface Response {
x: CoolEnum
// ^ type.symbol.id = 103
}🙁 Actual behavior
When enums have a single value, reference types which point to them have the type's symbol set to the only member of the enum, not to the enum's symbol.
🙂 Expected behavior
When enums have any number of values, reference types pointing to them should point to the enum itself.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Domain: APIRelates to the public API for TypeScriptRelates to the public API for TypeScriptExperimentation NeededSomeone needs to try this out to see what happensSomeone needs to try this out to see what happensSuggestionAn idea for TypeScriptAn idea for TypeScript