TypeScript [TypeScript]関数の型定義
関数の定義 引数のみアノテートし、戻り値は型推論を使う。 const add = (a: number, b:number) => a + b オプションパラメータとデフォルトパラメータ 引数名の後ろに?を付けると省略可能なオプションパラメータとなる。省略時はundefinedとなる。 引数名=値とするとデフォルトパラメータとなる。デフォルト引数は型推論を使う。 const print = (a:...
TypeScript
TypeScript
TypeScript
TypeScript