== Why is this an issue?

TypeScript provides both numeric and string-based enums. Members of enums can be assigned strings, numbers, both, or none, which default to numbers starting from zero. Although it is possble to mix the types of enum member values, it is generally considered confusing and a bad practice.

Enum members should be consistently assigned values of the same type, that is, strings or numbers.

== How to fix it

Either assign all enum members with values of the same type or none of them.

=== Code examples

==== Noncompliant code example

[source,typescript,diff-id=1,diff-type=noncompliant]
----
enum Color {
    Red, // 0 by default
    Green = 1,
    Blue = "blue"
}
----

==== Compliant solution

[source,typescript,diff-id=1,diff-type=compliant]
----
enum Color {
    Red = "red",
    Green = "green",
    Blue = "blue"
}
----

==== Noncompliant code example

[source,typescript,diff-id=2,diff-type=noncompliant]
----
enum Status {
    SYN = 0,
    SYN_ACK,
    ACK = "ack"
}
----

==== Compliant solution

[source,typescript,diff-id=2,diff-type=compliant]
----
enum Direction {
    SYN,
    SYN_ACK,
    ACK
}
----

== Resources

=== Documentation

* TypeScript Documentation - https://www.typescriptlang.org/docs/handbook/enums.html[Enums]
