**要求:尽量充分的利用类型推导,而不用额外写一写奇奇怪怪的东西。** 问题点: 1. `func(str)` 有正常的类型推导,很完美; 2. `func(obj.bbb)` 为什么不能像前者一样? type VmsType = "2D" | "3D" | "lpo" | "lips"; function func(type: VmsType) { console.log("🚀 ~ func ~ type:", type); } const str = "2D"; const obj = { bbb: "2D" }; // ok func(str); // Argument of type 'string' is not assignable to parameter of type 'VmsType'. func(obj.bbb);  我知道可以下面两种办法: 1. 类型断言(Type Assertion) func(obj.bbb as VmsType) 2. 类型声明 const obj: { bbb: VmsType } = { bbb: "2D" }; **我想知道有没有更好的办法?**