what does the colon mean in Javascript after function?

后端 未结 2 712
不知归路
不知归路 2021-01-19 15:57

I saw the Facebook F8 app code there is a \":\" after the function

function setup(): React.Component {
  ...
}

what does this mean?

<
2条回答
  •  旧时难觅i
    2021-01-19 16:17

    Usually it's flowtype annotation and in this case means that setup() returns a React.Component. Or it could be TypeScript as well, can't make sophisticated guess in this particular case.

提交回复
热议问题