复制代码enum StatusCode { ok = 200, fail = 400,}let code: string | number = 200;if (code === StatusCode.ok) { console.log("成功");} else if (code === StatusCode.fail) { console.log("失败");}