enum Weekend {
Friday = 'FRIDAY',
Saturday = 'SATURDAY',
Sunday = 'SUNDAY'
}
I'm interested in working on this feature. Any guidance as to what would be a good place to start?
Also, do we want to support something like this -
enum BooleanLikeHeterogeneousEnum {
No = 0,
Yes = 'YES',
}
Also, do we want to support something like this
I think yes. Actually enum
is just another variant of grouped constants under same namespace, so BooleanLikeHeterogeneousEnum.No
should just replace to 0
and BooleanLikeHeterogeneousEnum.YES
to 'YES'
.
@dcodeIO wdyt?
Type-wise the compiler currently assumes that var a: SomeEnum
is i32
. As such, mixing different kinds of values appears problematic in about the same way union types are. Pure string enums should be possible in the same way
namespace Weekend {
const Friday = 'FRIDAY';
const Saturday = 'SATURDAY';
const Sunday = 'SUNDAY';
}
type Weekend = string;
is. How important would you say string enums are over this syntax?
Removing the good first issue
label here, because this might become quite tricky. Not super tricky, but potentially too tricky for a very first issue.