[Typescript] Function defination

Define a function type and params type:

// The function init
// Accept two params which are both type string
// Return void
const init: (s: string, e: string) => void
  = (start, end) => {
  console.log(start, end);
}

init("start", "end");

 

posted @ 2016-04-01 20:38  Zhentiw  阅读(225)  评论(0编辑  收藏  举报