[TypeScript TIPS] Interface 를 써야할 때와 Type 을 써야할 때
처음 TypeScript 2.x 버전 대를 익히면서 가장 혼란이 왔던 부분이 어떤 상황에서 Interface 를 사용하고, 어떤 상황에서 Type 을 사용해야하는지 명확하지 않다는 것이다. export type SomeMbmerType = { name: string; age: number; address: string; tier: string; }; export interface SomeMemberInterface { name: string; age: number; address: string; tier: string; } 다행히 최근 lastest 버전의 tslint 에서는 어느 정도 가이드를 잡아준다. Use an interface instead of a type literal.tslint(inter..
개인공부/TypeScript
2019. 4. 29. 00:36