📜  typescript 设置参数类型 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:12.245000             🧑  作者: Mango

代码示例1
// 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