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
- 스크롤이벤트
- 타입스크립트
- xlsx-js-style
- extends
- supabase 페이지네이션
- 슬라이딩윈도우
- app.post
- 이진탐색
- generic
- javascript
- Filter
- meatadata
- 상속
- code-push-standalone
- TS
- 페이지네이션
- supabase auth
- codepush
- reactnative
- async
- 글또10기x코드트리
- set
- interface
- array
- Next.js
- map
- supabase authentication
- react
- 코드푸시
- Spring
Archives
- Today
- Total
목록literal type (1)
rhanziy
TS - Literal types로 값 지정하기
const보다 더 엄격한 값 지정이라고 생각하면 된다. let 이름 :123; let 나 : '30살' | '백수'; 이러면 무조건 이름엔 123이 들어가야하고, 나 라는 변수에는 30살 or 백수라는 값만 넣을 수 있다. function testFunction(hand :'가위'|'바위'|'보') :('가위'|'바위'|'보')[]{ console.log(hand); return [ '보' ]; } testFunction('가위'); testFunction 함수의 파라미터에는 '가위' or '바위' or '보' 라는 문자만 들어올 수 있고, return 값도 동일. 그럼 obj.key의 값을 파라미터로 사용하고 싶으면!!! var data = { name : 'kim' } as const // 1. ob..
Html_css_js
2023. 1. 5. 18:06