枚举的功能类似于字面类型+联合类型组合功能,也可以表示一组明确的可选值。枚举:定义一组命名常量。它描述一个值,该值可以是这些命名常量中的一个。 enum Method { get="get", post="post",}function http(method:Method){ console.log(method)}http(Method.get)