Answers for "typescript set argument type"

0

typescript set argument type

// non typed function
function add(x, y) {
  return x + y;
}

// typed function
function add(x: number, y: number): number {
  return x + y;
}

// types can be found here: https://www.typescriptlang.org/docs/handbook/basic-types.html
Posted by: Guest on February-16-2021

Code answers related to "TypeScript"

Browse Popular Code Answers by Language