考虑:enumColors{Red,Green,Blue}它转换成这样:varColors;(function(Colors){Colors[Colors["Red"]=0]="Red";Colors[Colors["Green"]=1]="Green";Colors[Colors["Blue"]=2]="Blue";})(Colors||(Colors={}));有关此结果的大多数问题都在EnumsinTypeScript:whatistheJavaScriptcodedoing?中得到了回答.我引用答案:Thisisan'immediatelyexecutingfunction'进