-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed as not planned
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
π Search Terms
enum const string computed value 18033
π Version & Regression Information
I tried 2 TS versions, reproducible with both:
- 5.6.2
- 5.7.3
β― Playground Link
π» Code
const option2 = 'option2';
const option3 = 'option3' as const;
export enum TestEnum {
Option1 = 'option1',
Option2 = option2, // <<< no errors here
Option3 = option3, // <<< ts(18033) error here
}
π Actual behavior
Blocked by ts(18033)
error
π Expected behavior
No ts(18033)
error
Additional information about the issue
When string variable created as const
it's impossible to use it as an enum value because of ts(18033)
error.
As far as I'm aware this behaviour should've been implemented as part of this issue #40793
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created