I have this in a TypeScript enum:
export enum LMXLockRequestError {
MaxRetries = 'bad_args',
BadArgumentsError = 'bad_args',
}
this doesn't seem to cause a compilation error. It transpiles to this:
var LMXLockRequestError;
(function (LMXLockRequestError) {
LMXLockRequestError["MaxRetries"] = "bad_args";
LMXLockRequestError["BadArgumentsError"] = "bad_args";
})(LMXLockRequestError = exports.LMXLockRequestError || (exports.LMXLockRequestError = {}));
if I were to then use it to do:
if(v === LMXLockRequestError.MaxRetries){
}
if v was 'bad_args' it would match both MaxRetries and BadArgumentsError.
Is this supposed to happen? Or should I file an issue with TypeScript on Github?
To me an enum should have different keys, but maybe not necessarily different values? It would be nice if there was a way to tell the enum that it must have different values.