How to declare Return Types for Functions in TypeScript

后端 未结 4 1304
花落未央
花落未央 2020-12-13 17:05

I checked here https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md which is the TypeScript Language Specifications but I couldn\'t see one thing that how I can d

4条回答
  •  有刺的猬
    2020-12-13 17:27

    Return types using arrow notation is the same as previous answers:

    const sum = (a: number, b: number) : number => a + b;
    

提交回复
热议问题