TypeScript | Type Annotation and Inference in TypeScript | Question5

Last Updated :
Discuss
Comments

How do you explicitly declare a function’s return type in TypeScript?

function add(a: number, b: number) -> number {}

function add(a: number, b: number): number {}

function add(a: number, b: number) = number {}

function add(a: number, b: number) returns number {}

Share your thoughts in the comments