Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

typescript function type

// define your parameter's type inside the parenthesis
// define your return type after the parenthesis

function sayHello(name: string): string  {
  console.log(`Hello, ${name}`!);
}

sayHello('Bob'); // Hello, Bob!
Source by www.typescriptlang.org #
 
PREVIOUS NEXT
Tagged: #typescript #function #type
ADD COMMENT
Topic
Name
7+5 =