LoginSignup
1
2

More than 3 years have passed since last update.

TypeScript入門

Posted at

特徴

  • 型定義が使える(変数, 引数、返り値、オブジェクト)
  • インターフェース、クラス
  • 入力補完(vs codeなど)

変数の定義

let name: string; // name を文字列型として宣言
name = "ebihara";
name = 0; // エラー: 文字列ではない

// 直接代入
const name: string = "hogehoge"

変数の定義(配列)

const array: string[] = [];
array.push("ebihara");
array.push(1); // エラー:配列の型と合わない

// 直接代入
const array: string[] = ["hogehoge", "fugafuga"];

クリーンアーキテクチャ

  • 層を分けて実装していくことで仕様変更に強くなる(必要な奏の部分だけの修正でいい)
  • 層→Presentation Layer(UIなど)、Domain Layer(UseCasesなどビジネスロジック), Data Layer(entity定義など)

ex.

  • page(Presentation Layer)
  • EmployeeUseCase(Domain Layer)
  • repositoryやdomain(Data Layer)
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2