You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
430 B

2 years ago
  1. // 返回值类型:只关注返回值类型本身
  2. // 返回值类型是原始类型:
  3. type F5 = () => string
  4. type F6 = () => string
  5. let f5: F5
  6. let f6: F6
  7. // 返回值类型一样,f5 和 f6 可以相互赋值。 例: f6 = f5 f5 = f6
  8. // 返回值类型是对象类型:
  9. type F7 = () => { name: string }
  10. type F8 = () => { name: string; age: number }
  11. let f7: F7
  12. let f8: F8
  13. // 成员多的赋值给成员少的 f7 = f8