목록Generics (1)
뉴히의 개발 로그
[TIL]20230801 - typescript generics 타입선언, type/interface
제네릭 타입 선언 type SuperPrint = (a: T[]) => T const superPrint : SuperPrint = (a) => a[0] const a = superPrint([1, 2, 3, 4]) const b = superPrint([true, false, true]) const c = superPrint(["a", "b", "c"]) const d = superPrint([1, 2, true, false, "hello"]) function superPrint(a: T[]){ return a[0] } const a = superPrint([1, 2, 3, 4]) // 안써주면 타입스크립트가 알아서 유추함 const b = superPrint([true, false, true]) co..
개발일지/TIL
2023. 8. 1. 20:39