プリミティブ型
TypeScript では、JavaScript のプリミティブ型に対応する型が用意されています。
const name: string = "Alice";
const age: number = 25;
const isActive: boolean = true;配列とタプル
const numbers: number[] = [1, 2, 3];
const tuple: [string, number] = ["hello", 42];オブジェクト型
interface User {
name: string;
age: number;
}
const user: User = { name: "Bob", age: 30 };