【基础】【联合类型】例子可能有点小问题
chokingwin opened this issue · 2 comments
chokingwin commented
原文地址:访问联合类型的属性或方法
这个例子貌似有点小问题,返回值不能设置成 string 类型
function getString(something: string | number): string { return something.toString(); }
xcatliu commented
chokingwin opened this issue · 2 comments
原文地址:访问联合类型的属性或方法
这个例子貌似有点小问题,返回值不能设置成 string 类型
function getString(something: string | number): string { return something.toString(); }