ynchuan / blog

https://github.com/ynchuan/blog/issues
http://ynchuan.github.io/blog
0 stars 0 forks source link

typescript #73

Open ynchuan opened 4 years ago

ynchuan commented 4 years ago

函数

interface Fn {
  (name: string): number
}
const fn1: Fn = function (name) {
  return name.length
}
const fn2 = function (name: string): number {
  return name.length
}
const fn3 = (name: string): number => {
  return name.length
}
function fn4(name: string): number {
  return name.length
}