Open
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.