I have a class property with a type that's the union of multiple string literals:
public reaction? : 'haha' | 'wow' | 'angry' | 'sad' | 'like';
What I'm trying to do was to have these strings defined somewhere else in some kind of array and then just use the array in the property definition. So something like:
allowedStrings = ['haha','wow','angry','sad','like'];
public reaction? : allowedStrings;
I get that the above is not possible but it's the general idea. Does typescript offer anything that does the job?