[Typescript] 9장 제네릭
1. 제네릭 제네릭은 함수, 클래스, 인터페이스를 정의할 때 특정 데이터 타입을 지정하지 않고, 나중에 사용할 데이터 타입을 매개변수로 받아서 사용할 수 있게 해줍니다.function identity(arg: T): T { return arg;}const output1 = identity('Hello, Generics!'); // 문자열const output2 = identity(123); // 숫자const output3 = identity(false); // booleanconsole.log(output1); // "Hello, Generics!"console.log(output2); // 123console.log(output3); // false2. 제네릭 타입 변수 작업제네릭 타입 변수를 사용..