TS Interface vs Type

신재민·2021년 1월 7일
0
post-thumbnail

tslint guide에서는 Use an interface instead of a type literal.tslint(interface-over-type-literal)로 정의하고 있다.

  • 요약하자면 Type은 literal사용시에만, Object는 Interface를 쓰라고 할 수 있다.

  • 추가적으로 Reducer의 case를 정의할 때에도 type을 사용한다.

    +typescript 3.x부터는 tslint가 모든 Interface의 네이밍 시에 앞에 대문자I를 붙이도록 강제한다.

profile
I am jerry

0개의 댓글