Hello there,
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
https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fields
Looking at the field, it has a domain property
https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Field.html
Domain could be range or codedValue type
https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Field.html#domain
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.