So I have this in the javascript for my page:
var TEST_ERROR = { \'SUCCESS\' : 0, \'FAIL\' : -1, \'ID_ERROR\' : -2
Building on Victor's excellent answer, so it works in TypeScript:
enumToStr(enumeration: any, value: any): string { for (var k in enumeration) if (enumeration[k] == value) return k; return null; }