You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of now, the definition of each status name looks like this:
readonly'100_NAME': string;
Can it be explicit, like:
readonly'100_NAME': 'CONTINUE';
Motivation
The reason for that request is that when we use the name for generic mapping, TS can't properly infer it:
constname=status[`${status.TOO_MANY_REQUESTS}_NAME`];// its value is indeed "TOO_MANY_REQUESTS"// but the type is simply "string" (any string)// which is technically true, and yet cumbersome// because of that, creating a map doesn't work as best as it could:constmap={[`${status.TOO_MANY_REQUESTS}_NAME`]: 'custom message or something',}// IDE cannot figure out that map should contain "TOO_MANY_REQUESTS" key
Alternative
Duplicate names as keys, but that doesn't feel right.