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
- SSE
- Node.js기본
- node.js란
- frontend
- 개발자
- EventSource
- 열공하자
- Lag
- 파티셔닝
- 실시간알림
- 성장기
- Partition
- partitioning
- mariadb
- node.js
- ServerSentEvent
- PostgreSQL
- localStorage
Archives
- Today
- Total
써치킴의 우당탕탕 개발 블로그
[TypeScript][ch5][Interface] type alias vs interface 본문
// [function]
// type alias
type EatType = (food: string) => void;
// interface
interface IEat {
(food: string): void;
}
// [array]
// type alias
type PersonList = string[];
// interface
interface IPersonList {
[index: number]: string;
}
// [union type]
interface Bird{
fly(): void;
layEggs(): void;
}
interface Fish{
swim(): void;
layEggs(): void;
}
type PetType = Bird | Fish;
// interface IPet extends PetType {}; // Error
// Class Pet implements PetType {}; // Error
// [Deciaration Merging - interface]
// 같은 이름의 인터페이스를 선언해도 나중에 사용할때는 하나로 합쳐진다.
// (type alias는 불가능)
interface MergingInterface {
a: string;
}
interface MergingInterface {
b: string;
}
let mi: MergingInterface;
'TypeScript 합시다' 카테고리의 다른 글
[TypeScript][ch6][Class] Quick Start - class (0) | 2022.02.15 |
---|---|
[TypeScript][ch6][Class] What are Class (0) | 2022.02.15 |
[TypeScript][ch5][Interface] Readonly Interface Properties (0) | 2022.02.14 |
[TypeScript][ch5][Interface] function interface (0) | 2022.02.14 |
[TypeScript][ch5][Interface] interface extends interface (0) | 2022.02.14 |
Comments