Skip to Content
이펙티브 타입스크립트
book

이펙티브 타입스크립트

by Dan Vanderkam, Won Ho Jang
November 2021
Intermediate to advanced
364 pages
9h 52m
Korean
Insight
Content preview from 이펙티브 타입스크립트
TypeScript
69
아이템 13 타입과 인터페이스의 차이점 알기
문을 적용하는 것이 좋습니다.
··
만약 같은 타입 시그니처를 반복적으로 작성한 코드가 있다면 함수 타입을
분리해 내거나 이미 존재하는 타입을 찾아보도록 합니다. 라이브러리를 직
접 만든다면 공통 콜백에 타입을 제공해야 합니다.
··
다른 함수의 시그니처를 참조하려면
typeof fn
을 사용하면 됩니다.
󻨓󻱃󼘫 󼖏󻱔󺇋󽴔󻱇󼗿󼡧󻱃󻝳󻰧󽴔󼃷󻱃󻳟󽴔󻨛󺋿
타입스크립트에서 명명된 타입(named type)을 정의하는 방법은 두 가지가 있
습니다. 다음처럼 타입을 사용할 수 있습니다.
type TState
=
{
name: string;
capital: string;
}
또는 인터페이스를 사용해도 됩니다.
interface IState {
name: string;
capital: string;
}
(명명된 타입을 정의할 때 인터페이스 대신 클래스를 사용할 수도 있지만, 클
래스는 값으로도 쓰일 수 있는 자바스크립트 런타임의 개념입니다. 이 내용은
아이템 8에서 다룹니다.)
대부분의 경우에는 타입을 사용해도 되고 인터페이스를 사용해도 됩니다.
그러나 타입과 인터페이스 사이에 존재하는 차이를 분명하게 알고, 같은 상황
에서는 동일한 방법으로 명명된 타입을 정의해 일관성을 유지해야 합니다. 그
러려면 하나의 타입에
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

러닝 타입스크립트

러닝 타입스크립트

조시 골드버그
고성능 파이썬(2판)

고성능 파이썬(2판)

오현석, 미샤 고렐릭, 이안 오스발트
타입스크립트 프로그래밍

타입스크립트 프로그래밍

Boris Czerny, U Jung Eun

Publisher Resources

ISBN: 9788966263134