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 |
Tags
- xlsx-js-style
- supabase authentication
- Spring
- array
- TS
- 글또10기x코드트리
- meatadata
- 스크롤이벤트
- 상속
- 이진탐색
- generic
- javascript
- async
- 타입스크립트
- react
- 슬라이딩윈도우
- map
- set
- 페이지네이션
- code-push-standalone
- Next.js
- reactnative
- extends
- supabase 페이지네이션
- interface
- 코드푸시
- codepush
- supabase auth
- app.post
- Filter
Archives
- Today
- Total
목록destructuring type (1)
rhanziy
TS - rest 파라미터, destructuring type지정
함수의 파라미터로 rest형식, 디스트럭쳐링형식이 들어왔을 때 type지정하는 방법. 일단 rest parameter는 파라미터가 몇개 들어올지 미리 정의를 할 수 없을 때 ... 으로 만들어주는거 function 전부더하기(...a){ console.log(a) } 전부더하기(1,2,3,4,5) console을 찍어보면 a값은 [ ] 어레이 안에 담겨져 있다. function 전부더하기(...a : number[]){ console.log(a) } 전부더하기(1,2,3,4,5) 그래서 타입지정도 array처럼 해주면 됨. array나 object 괄호 벗길 때 사용하는 Spread operator와는 다르니 유의 rest parameter type지정 예시) 입력된 숫자들의 최대 값을 return하는 ..
Html_css_js
2023. 1. 28. 15:42