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 |
Tags
- JS console
- 티스토리꾸미기
- React.js
- reactjs
- 리액트
- click and drag
- react
- 공통컴포넌트
- 폰트적용하기
- NonNullable
- 성능최적화
- vue.js
- React Native
- 누구나 자료구조와 알고리즘
- const 단언문
- 타입좁히기
- 커스텀
- CSS
- javascript
- 타입스크립트
- 레이아웃쪼개기
- returnType
- 제네릭
- utilty type
- TSDoc
- 개발콘텐츠
- Chart.js
- 2022
- typescript
- 반복줄이기
Archives
- Today
- Total
목록타입좁히기 (1)
몽땅뚝딱 개발자


📍 클릭 시 이동! 1. 분기문 사용하기 2. instanceof 사용하기 3. 속성 체크하기 4. 명시적 '태그' 붙이기 5. 사용자 정의 타입 가드 사용하기 추가. 주의할 점 ◽ 1. 분기문 사용하기 예제 1. if문 const el = document.getElementById('foo') // 타입: HTMLElement | null if(el) { el // 타입: HTMLElement } else { el // 타입: null } 예제 2. 에러 던지기 const el = document.getElementById('foo') // 타입: HTMLElement | null if(!el) throw new Error('변수를 찾을 수 없습니다.') el // 타입: HTMLElement ◽ 2...
Development/Typescript
2022. 11. 20. 16:10