Skip to content

Latest commit

ย 

History

History
57 lines (35 loc) ยท 5.42 KB

the-handbook.md

File metadata and controls

57 lines (35 loc) ยท 5.42 KB
title layout permalink oneline
The TypeScript Handbook
docs
/docs/handbook/intro.html
Your first step to learn TypeScript

ํ•ธ๋“œ๋ถ์— ๋Œ€ํ•ด์„œ (About this Handbook)

JavaScript๋Š” ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์ปค๋ฎค๋‹ˆํ‹ฐ์— ๋„์ž…๋œ ์ง€ 20๋…„์ด ์ง€๋‚œ ์ง€๊ธˆ, ๊ฐ€์žฅ ๋„๋ฆฌ ํผ์ง„ cross-platform ์–ธ์–ด ์ค‘ ํ•˜๋‚˜์ž…๋‹ˆ๋‹ค. JavaScript๋Š” ์›น ํŽ˜์ด์ง€์— ์‚ฌ์†Œํ•œ ์ƒํ˜ธ์ž‘์šฉ์„ ์ถ”๊ฐ€ํ•˜๊ธฐ ์œ„ํ•œ ์ž‘์€ ์Šคํฌ๋ฆฝํŒ… ์–ธ์–ด๋กœ ์‹œ์ž‘ํ•˜์—ฌ, ๊ทœ๋ชจ์— ์ƒ๊ด€์—†์ด ํ”„๋ก ํŠธ์—”๋“œ์™€ ๋ฐฑ์—”๋“œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์—์„œ ์„ ํƒ ๊ฐ€๋Šฅํ•œ ์–ธ์–ด๋กœ ์„ฑ์žฅํ–ˆ์Šต๋‹ˆ๋‹ค. JavaScript๋กœ ์ž‘์„ฑ๋œ ํ”„๋กœ๊ทธ๋žจ์˜ ํฌ๊ธฐ, ๋ฒ”์œ„ ๋ฐ ๋ณต์žก์„ฑ์€ ๊ธฐํ•˜๊ธ‰์ˆ˜์ ์œผ๋กœ ์ปค์กŒ์ง€๋งŒ, ๋‹ค๋ฅธ ์ฝ”๋“œ ๋‹จ์œ„ ๊ฐ„์˜ ๊ด€๊ณ„๋ฅผ ํ‘œํ˜„ํ•˜๋Š” JavaScript ์–ธ์–ด์˜ ๋Šฅ๋ ฅ์€ ๊ทธ๋ ‡์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค. JavaScript์˜ ๋‹ค์†Œ ํŠน์ดํ•œ ๋Ÿฐํƒ€์ž„ ์˜๋ฏธ ์ฒด๊ณ„(runtime semantics)์™€ ๋”๋ถˆ์–ด, ์–ธ์–ด์™€ ํ”„๋กœ๊ทธ๋žจ ๋ณต์žก์„ฑ ๊ฐ„์˜ ๋ถˆ์ผ์น˜๋Š” JavaScript ๊ฐœ๋ฐœ์„ ๊ทœ๋ชจ์— ๋งž๊ฒŒ ๊ด€๋ฆฌํ•˜๊ธฐ ์–ด๋ ค์šด ์ž‘์—…์œผ๋กœ ๋งŒ๋“ค์—ˆ์Šต๋‹ˆ๋‹ค.

ํ”„๋กœ๊ทธ๋ž˜๋จธ๋“ค์ด ์ž‘์„ฑํ•˜๋Š” ๊ฐ€์žฅ ํ”ํ•œ ์˜ค๋ฅ˜๋Š” ํƒ€์ž… ์˜ค๋ฅ˜์ž…๋‹ˆ๋‹ค: ๋‹ค๋ฅธ ์ข…๋ฅ˜์˜ ๊ฐ’์ด ์˜ˆ์ƒ๋˜๋Š” ๊ณณ์— ํŠน์ •ํ•œ ๊ฐ’์ด ์‚ฌ์šฉ๋œ ๊ฒฝ์šฐ์ž…๋‹ˆ๋‹ค. ์ด๋Š” ๋‹จ์ˆœํ•œ ์˜คํƒ€, ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ API๋ฅผ ์ดํ•ดํ•˜์ง€ ๋ชปํ•œ ๊ฒƒ, ๋Ÿฐํƒ€์ž„ ๋™์ž‘์— ๋Œ€ํ•œ ์ž˜๋ชป๋œ ๊ฐ€์ • ๋˜๋Š” ๋‹ค๋ฅธ ์˜ค๋ฅ˜ ๋•Œ๋ฌธ์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. TypeScript์˜ ๋ชฉํ‘œ๋Š” JavaScript ํ”„๋กœ๊ทธ๋žจ์˜ ์ •์  ํƒ€์ž… ๊ฒ€์‚ฌ์ž ์ž…๋‹ˆ๋‹ค. ์ฆ‰, ์ฝ”๋“œ๊ฐ€ ์‹คํ–‰๋˜๊ธฐ ์ „์— ์‹คํ–‰ํ•˜๊ณ (์ •์ ), ํ”„๋กœ๊ทธ๋žจ ํƒ€์ž…์ด ์ •ํ™•ํ•œ์ง€ ํ™•์ธํ•˜๋Š” ๋„๊ตฌ(ํƒ€์ž… ๊ฒ€์‚ฌ)์ž…๋‹ˆ๋‹ค.

JavaScript์— ๋Œ€ํ•œ ๋ฐฐ๊ฒฝ์ง€์‹ ์—†์ด TypeScript๋ฅผ ์ฒซ ๋ฒˆ์งธ ์–ธ์–ด๋กœ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด, ๋จผ์ € Mozilla ์›น ๋ฌธ์„œ์—์„œ JavaScript์— ๋Œ€ํ•œ ๋ฌธ์„œ๋ฅผ ์ฝ์–ด ๋ณด๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ์–ธ์–ด์— ๋Œ€ํ•œ ๊ฒฝํ—˜์ด ์žˆ๋‹ค๋ฉด, ํ•ธ๋“œ๋ถ์„ ์ฝ์œผ๋ฉด์„œ JavaScript ๊ตฌ๋ฌธ์„ ๊ฝค ๋น ๋ฅด๊ฒŒ ์ตํž ์ˆ˜ ์žˆ์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค.

ํ•ธ๋“œ๋ถ์€ ์–ด๋–ป๊ฒŒ ๊ตฌ์„ฑ๋˜์–ด ์žˆ๋Š”๊ฐ€? (How is this Handbook Structured)

ํ•ธ๋“œ๋ถ์€ ๋‘ ์˜์—ญ์œผ๋กœ ๋‚˜๋‰ฉ๋‹ˆ๋‹ค:

  • ํ•ธ๋“œ๋ถ

    TypeScript ํ•ธ๋“œ๋ถ์€ ํ‰๋ฒ”ํ•œ ํ”„๋กœ๊ทธ๋ž˜๋จธ๋“ค์—๊ฒŒ TypeScript๋ฅผ ์„ค๋ช…ํ•˜๋Š” ์ข…ํ•ฉ์ ์ธ ๋ฌธ์„œ์ž…๋‹ˆ๋‹ค. ์™ผ์ชฝ ๋ฉ”๋‰ด๋ฅผ ํ†ตํ•ด ์œ„์—์„œ ์•„๋ž˜๋กœ ์ด๋™ํ•˜๋ฉฐ ์ฝ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

    ๊ฐ ์žฅ ๋˜๋Š” ํŽ˜์ด์ง€๊ฐ€ ์ฃผ์–ด์ง„ ๊ฐœ๋…์— ๋Œ€ํ•ด ์ž์„ธํ•œ ์„ค๋ช…์„ ์ œ๊ณตํ•  ๊ฒƒ์ด๋ผ๊ณ  ๊ธฐ๋Œ€ํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค. TypeScript ํ•ธ๋“œ๋ถ์€ ์–ธ์–ด์— ๋Œ€ํ•œ ์™„์ „ํ•œ ์„ค๋ช…์„œ๋Š” ์•„๋‹ˆ์ง€๋งŒ, ๋ชจ๋“  ํŠน์ง•๊ณผ ๋™์ž‘์— ๋Œ€ํ•œ ์ข…ํ•ฉ์ ์ธ ๊ฐ€์ด๋“œ์ž…๋‹ˆ๋‹ค.

    ์‹ค์Šต์„ ์™„๋ฃŒํ•œ ๋…์ž๋Š” ๋‹ค์Œ์„ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค:

    • ์ผ๋ฐ˜์ ์œผ๋กœ ์‚ฌ์šฉํ•˜๋Š” TypeScript ๊ตฌ๋ฌธ ๋ฐ ํŒจํ„ด์„ ์ฝ๊ณ  ์ดํ•ดํ•˜๊ธฐ
    • ์ค‘์š”ํ•œ ์ปดํŒŒ์ผ๋Ÿฌ ์˜ต์…˜์˜ ํšจ๊ณผ ์„ค๋ช…ํ•˜๊ธฐ
    • ๋Œ€๋ถ€๋ถ„์˜ ๊ฒฝ์šฐ์—์„œ ํƒ€์ž… ์‹œ์Šคํ…œ ๋™์ž‘์„ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์˜ˆ์ธกํ•˜๊ธฐ
    • ๊ฐ„๋‹จํ•œ ํ•จ์ˆ˜, ๊ฐ์ฒด ๋˜๋Š” ํด๋ž˜์Šค์— ๋Œ€ํ•œ .d.ts ์„ ์–ธ ์ž‘์„ฑํ•˜๊ธฐ

    ํ•ธ๋“œ๋ถ์˜ ์ฃผ์š” ๋‚ด์šฉ์€ ๋ช…ํ™•์„ฑ๊ณผ ๊ฐ„๊ฒฐ์„ฑ์„ ์œ„ํ•ด, ๋‹ค๋ฃจ์–ด์ง€๊ณ  ์žˆ๋Š” ํŠน์ง•์˜ ๋ชจ๋“  ์—ฃ์ง€ ์ผ€์ด์Šค ๋˜๋Š” ์„ธ๋ถ€ ์‚ฌํ•ญ์„ ํƒ๊ตฌํ•˜์ง€๋Š” ์•Š์Šต๋‹ˆ๋‹ค. ์ฐธ๊ณ ๋ฌธํ—Œ์—์„œ ํŠน์ • ๊ฐœ๋…์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์„ ์ฐพ์•„๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • ํ•ธ๋“œ๋ถ ๋ ˆํผ๋Ÿฐ์Šค

    ํ•ธ๋“œ๋ถ ๋ ˆํผ๋Ÿฐ์Šค๋Š” TypeScript์˜ ํŠน์ • ๋ถ€๋ถ„์ด ์–ด๋–ป๊ฒŒ ์ž‘๋™ํ•˜๋Š”์ง€ ํ’๋ถ€ํ•œ ์ดํ•ด๋ฅผ ์ œ๊ณตํ•˜๊ธฐ ์œ„ํ•ด ์ž‘์„ฑ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์œ„์—์„œ ์•„๋ž˜๋กœ ์ฝ์„ ์ˆ˜ ์žˆ์ง€๋งŒ, ์—ฐ์†์ ์œผ๋กœ ์„ค๋ช…ํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ, ๊ฐ ์„น์…˜์€ ๋‹จ์ผ ๊ฐœ๋…์— ๋Œ€ํ•œ ๋” ๊นŠ์€ ์„ค๋ช… ์ œ๊ณต์„ ๋ชฉํ‘œ๋กœ ํ•ฉ๋‹ˆ๋‹ค.

Non-Goals

The Handbook is also intended to be a concise document that can be comfortably read in a few hours. Certain topics won't be covered in order to keep things short.

Specifically, the Handbook does not fully introduce core JavaScript basics like functions, classes, and closures. Where appropriate, we'll include links to background reading that you can use to read up on those concepts.

The Handbook also isn't intended to be a replacement for a language specification. In some cases, edge cases or formal descriptions of behavior will be skipped in favor of high-level, easier-to-understand explanations. Instead, there are separate reference pages that more precisely and formally describe many aspects of TypeScript's behavior. The reference pages are not intended for readers unfamiliar with TypeScript, so they may use advanced terminology or reference topics you haven't read about yet.

Finally, the Handbook won't cover how TypeScript interacts with other tools, except where necessary. Topics like how to configure TypeScript with webpack, rollup, parcel, react, babel, closure, lerna, rush, bazel, preact, vue, angular, svelte, jquery, yarn, or npm are out of scope - you can find these resources elsewhere on the web.

Get Started

Before getting started with Basic Types, we recommend reading one of the following introductory pages. These introductions are intended to highlight key similarities and differences between TypeScript and your favored programming language, and clear up common misconceptions specific to those languages.