Is there any way to have a literal type like in Python or typescript?
E.g. in typescript can do:
type Hello = "Hello"
const x: Hello = "Hello"
const y: Hello = "Bye" // fails
I couldn't find a way to do this in Nim? Is it possible?
Maybe like this:
type Hello = distinct string
const validValue = Hello"Hello"
const x: Hello = validValue # ok
const y: Hello = "Bye" # not ok
Or maybe you're looking for enum.
If all the values being tested against are const or otherwise known at compile time, as in your example, then use an enum. If you need to test strings obtained at runtime, use HashSet[string].
It would really help to know how you want to use this.