타입스크립트 Typescript 제네릭
Typescript // Generic function getSize(arr: T[]): number { return arr.length; } const arr1 = [1, 2, 3]; getSize(arr1); const arr2 = ["1", "2", "3"]; getSize(arr2); interface Mobile { name: string; price: number; option: T; } const m1: Mobile = { name: "s21", price: 1000, option: { color: "red", coupon: false, } } const m2: Mobile = { name: "s20", price: 900, option: "good" } interface User { nam..