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
- Lag
- 파티셔닝
- node.js
- SSE
- frontend
- EventSource
- Partition
- mariadb
- 실시간알림
- 열공하자
- 개발자
- PostgreSQL
- ServerSentEvent
- localStorage
- Node.js기본
- 성장기
- partitioning
- node.js란
Archives
- Today
- Total
써치킴의 우당탕탕 개발 블로그
[TypeScript][ch6][Class] index Signatures in class 본문
// class -> object를 만들어 냄
// Ex.
// {searchkim : 'female', jade: 'male'}
// {mark : 'male', chloe: 'female', anna: 'female'}
class Students {
[index: string] : 'male' | 'female';
// [index: string] : string이면 무조건 올 수 있다.
// (프로퍼티를 동적으로 구현할 때 사용)
}
const a = new Students();
a.searchkim = 'female';
a.jade = 'male';
console.log(a);
const b = new Students();
b.mark = 'male';
b.chloe = 'female';
b.anna = 'female';
console.log(b);
'TypeScript 합시다' 카테고리의 다른 글
[TypeScript][ch6][Class] Singletons (0) | 2022.02.15 |
---|---|
[TypeScript][ch6][Class] Static Properties & Methods (0) | 2022.02.15 |
[TypeScript][ch6][Class] readonly properties (0) | 2022.02.15 |
[TypeScript][ch6][Class] Getter & Setter (0) | 2022.02.15 |
[TypeScript][ch6][Class] initialization in constructor parameters (0) | 2022.02.15 |
Comments