I aim using hitTest to get values of features that i have on my map and show them in my HTML table i do it so:
There are few a steps to something like this.
The layer has a fields property
Looking at the field, it has a domain property
Domain could be range or codedValue type
CodedValue has a method called getName that I think will do what you are looking for.
Which could end up looking like this.
const field = layer.fields.find((field) => field.name === FIELD_NAME); const domain = field.domain; const domainValue = field.getName(attributes[FIELD_NAME]);
I think, I haven't had to do something like this in a while, but that should get you on the right track.