Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- Angular Router
- mysql if
- prisma
- Router
- angular modal
- 앵귤러 모달
- ApexChart
- angular animation
- 호버
- 셀렉트박스 커스텀
- angular button
- 옵저버블
- 스크롤 이벤트 감지
- 검색
- 아이오닉 스크롤 이벤트
- scroll
- modal
- Ionic modal
- Oracle LISTAGG 사용 예시
- route
- TAILWIND
- egov spring ajax 사용 예시
- formgroup
- 모달
- 앵귤러 애니메이션
- flex-1
- angular route
- ajax 사용 예시
- summary
- 스크롤 이벤트
Archives
- Today
- Total
목록타입스크립트 제네릭 (2)
깜놀하는 해므찌로
TypeScript Generic
https://www.typescriptlang.org/docs/handbook/2/generics.html Documentation - Generics Types which take parameters www.typescriptlang.org function loggingIdentity(arg: Array): Array { console.log(arg.length); // Array has a .length, so no more error return arg; } 1. 값이 아닌 타입을 파라미터처럼 전달하여 사용할 수 있습니다.
IT
2023. 7. 3. 11:38
typescript Generic 활용 예시
/** Generic */ function getSize(arr:T[]){ // TypeParameter 일반적으로 T 사용 return arr.length; } const arr1 = [1, 2, 3]; getSize(arr1); const arr2 = ["1", "2", "3"]; getSize(arr2); const arr3 = [true, false, true]; getSize(arr3); // 호출 시 제네릭 입력 생략 가능 /** 인터페이스 예시 */ interface Mobile{ name : string; price : number; option : T; } const mobile1:Mobile = { name : "안드로이드", price : 1000, option : { color : ..
IT
2023. 5. 27. 13:10