You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When there is only one member in the enum declaration, const enum A {x = 1}, the enum type obtained through the getTypeAtLocation interface is incorrect. #61917
This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
I was unable to test this on prior versions because _______
⏯ Playground Link
No response
💻 Code
constenumA{x=1};constenumB{x=1,y=1};
🙁 Actual behavior
By using the getTypeAtLocation interface, the type of the enumeration is obtained. Enumeration B gets the enumeration type, while enumeration A gets the enumeration member type.
🙂 Expected behavior
Both Enum A and Enum B can get the enum type, not Enum A is the enum member type
Additional information about the issue
Although special logic bypass can be done through symbol.declarations, why is there a distinction in obtaining enumeration types when they are all enumeration types? Most of the time, obtaining types is to get the current type, and there is no need to directly provide the underlying type.