title | layout | permalink | oneline |
---|---|---|---|
The TypeScript Handbook |
docs |
/docs/handbook/intro.html |
Your first step to learn TypeScript |
JavaScript๋ ํ๋ก๊ทธ๋๋ฐ ์ปค๋ฎค๋ํฐ์ ๋์ ๋ ์ง 20๋ ์ด ์ง๋ ์ง๊ธ, ๊ฐ์ฅ ๋๋ฆฌ ํผ์ง cross-platform ์ธ์ด ์ค ํ๋์ ๋๋ค. JavaScript๋ ์น ํ์ด์ง์ ์ฌ์ํ ์ํธ์์ฉ์ ์ถ๊ฐํ๊ธฐ ์ํ ์์ ์คํฌ๋ฆฝํ ์ธ์ด๋ก ์์ํ์ฌ, ๊ท๋ชจ์ ์๊ด์์ด ํ๋ก ํธ์๋์ ๋ฐฑ์๋ ์ ํ๋ฆฌ์ผ์ด์ ์์ ์ ํ ๊ฐ๋ฅํ ์ธ์ด๋ก ์ฑ์ฅํ์ต๋๋ค. JavaScript๋ก ์์ฑ๋ ํ๋ก๊ทธ๋จ์ ํฌ๊ธฐ, ๋ฒ์ ๋ฐ ๋ณต์ก์ฑ์ ๊ธฐํ๊ธ์์ ์ผ๋ก ์ปค์ก์ง๋ง, ๋ค๋ฅธ ์ฝ๋ ๋จ์ ๊ฐ์ ๊ด๊ณ๋ฅผ ํํํ๋ JavaScript ์ธ์ด์ ๋ฅ๋ ฅ์ ๊ทธ๋ ์ง ๋ชปํ์ต๋๋ค. JavaScript์ ๋ค์ ํน์ดํ ๋ฐํ์ ์๋ฏธ ์ฒด๊ณ(runtime semantics)์ ๋๋ถ์ด, ์ธ์ด์ ํ๋ก๊ทธ๋จ ๋ณต์ก์ฑ ๊ฐ์ ๋ถ์ผ์น๋ JavaScript ๊ฐ๋ฐ์ ๊ท๋ชจ์ ๋ง๊ฒ ๊ด๋ฆฌํ๊ธฐ ์ด๋ ค์ด ์์ ์ผ๋ก ๋ง๋ค์์ต๋๋ค.
ํ๋ก๊ทธ๋๋จธ๋ค์ด ์์ฑํ๋ ๊ฐ์ฅ ํํ ์ค๋ฅ๋ ํ์ ์ค๋ฅ์ ๋๋ค: ๋ค๋ฅธ ์ข ๋ฅ์ ๊ฐ์ด ์์๋๋ ๊ณณ์ ํน์ ํ ๊ฐ์ด ์ฌ์ฉ๋ ๊ฒฝ์ฐ์ ๋๋ค. ์ด๋ ๋จ์ํ ์คํ, ๋ผ์ด๋ธ๋ฌ๋ฆฌ API๋ฅผ ์ดํดํ์ง ๋ชปํ ๊ฒ, ๋ฐํ์ ๋์์ ๋ํ ์๋ชป๋ ๊ฐ์ ๋๋ ๋ค๋ฅธ ์ค๋ฅ ๋๋ฌธ์ผ ์ ์์ต๋๋ค. TypeScript์ ๋ชฉํ๋ JavaScript ํ๋ก๊ทธ๋จ์ ์ ์ ํ์ ๊ฒ์ฌ์ ์ ๋๋ค. ์ฆ, ์ฝ๋๊ฐ ์คํ๋๊ธฐ ์ ์ ์คํํ๊ณ (์ ์ ), ํ๋ก๊ทธ๋จ ํ์ ์ด ์ ํํ์ง ํ์ธํ๋ ๋๊ตฌ(ํ์ ๊ฒ์ฌ)์ ๋๋ค.
JavaScript์ ๋ํ ๋ฐฐ๊ฒฝ์ง์ ์์ด TypeScript๋ฅผ ์ฒซ ๋ฒ์งธ ์ธ์ด๋ก ์ฌ์ฉํ๋ค๋ฉด, ๋จผ์ Mozilla ์น ๋ฌธ์์์ JavaScript์ ๋ํ ๋ฌธ์๋ฅผ ์ฝ์ด ๋ณด๋ ๊ฒ์ด ์ข์ต๋๋ค. ๋ค๋ฅธ ์ธ์ด์ ๋ํ ๊ฒฝํ์ด ์๋ค๋ฉด, ํธ๋๋ถ์ ์ฝ์ผ๋ฉด์ JavaScript ๊ตฌ๋ฌธ์ ๊ฝค ๋น ๋ฅด๊ฒ ์ตํ ์ ์์ ๊ฒ์ ๋๋ค.
ํธ๋๋ถ์ ๋ ์์ญ์ผ๋ก ๋๋ฉ๋๋ค:
-
ํธ๋๋ถ
TypeScript ํธ๋๋ถ์ ํ๋ฒํ ํ๋ก๊ทธ๋๋จธ๋ค์๊ฒ TypeScript๋ฅผ ์ค๋ช ํ๋ ์ข ํฉ์ ์ธ ๋ฌธ์์ ๋๋ค. ์ผ์ชฝ ๋ฉ๋ด๋ฅผ ํตํด ์์์ ์๋๋ก ์ด๋ํ๋ฉฐ ์ฝ์ ์ ์์ต๋๋ค.
๊ฐ ์ฅ ๋๋ ํ์ด์ง๊ฐ ์ฃผ์ด์ง ๊ฐ๋ ์ ๋ํด ์์ธํ ์ค๋ช ์ ์ ๊ณตํ ๊ฒ์ด๋ผ๊ณ ๊ธฐ๋ํ ๊ฒ์ ๋๋ค. TypeScript ํธ๋๋ถ์ ์ธ์ด์ ๋ํ ์์ ํ ์ค๋ช ์๋ ์๋์ง๋ง, ๋ชจ๋ ํน์ง๊ณผ ๋์์ ๋ํ ์ข ํฉ์ ์ธ ๊ฐ์ด๋์ ๋๋ค.
์ค์ต์ ์๋ฃํ ๋ ์๋ ๋ค์์ ์ํํ ์ ์์ด์ผ ํฉ๋๋ค:
- ์ผ๋ฐ์ ์ผ๋ก ์ฌ์ฉํ๋ TypeScript ๊ตฌ๋ฌธ ๋ฐ ํจํด์ ์ฝ๊ณ ์ดํดํ๊ธฐ
- ์ค์ํ ์ปดํ์ผ๋ฌ ์ต์ ์ ํจ๊ณผ ์ค๋ช ํ๊ธฐ
- ๋๋ถ๋ถ์ ๊ฒฝ์ฐ์์ ํ์ ์์คํ ๋์์ ์ฌ๋ฐ๋ฅด๊ฒ ์์ธกํ๊ธฐ
- ๊ฐ๋จํ ํจ์, ๊ฐ์ฒด ๋๋ ํด๋์ค์ ๋ํ .d.ts ์ ์ธ ์์ฑํ๊ธฐ
ํธ๋๋ถ์ ์ฃผ์ ๋ด์ฉ์ ๋ช ํ์ฑ๊ณผ ๊ฐ๊ฒฐ์ฑ์ ์ํด, ๋ค๋ฃจ์ด์ง๊ณ ์๋ ํน์ง์ ๋ชจ๋ ์ฃ์ง ์ผ์ด์ค ๋๋ ์ธ๋ถ ์ฌํญ์ ํ๊ตฌํ์ง๋ ์์ต๋๋ค. ์ฐธ๊ณ ๋ฌธํ์์ ํน์ ๊ฐ๋ ์ ๋ํ ์์ธํ ๋ด์ฉ์ ์ฐพ์๋ณผ ์ ์์ต๋๋ค.
-
ํธ๋๋ถ ๋ ํผ๋ฐ์ค
ํธ๋๋ถ ๋ ํผ๋ฐ์ค๋ TypeScript์ ํน์ ๋ถ๋ถ์ด ์ด๋ป๊ฒ ์๋ํ๋์ง ํ๋ถํ ์ดํด๋ฅผ ์ ๊ณตํ๊ธฐ ์ํด ์์ฑ๋์์ต๋๋ค. ์์์ ์๋๋ก ์ฝ์ ์ ์์ง๋ง, ์ฐ์์ ์ผ๋ก ์ค๋ช ํ๋ ๊ฒ์ด ์๋๋ผ, ๊ฐ ์น์ ์ ๋จ์ผ ๊ฐ๋ ์ ๋ํ ๋ ๊น์ ์ค๋ช ์ ๊ณต์ ๋ชฉํ๋ก ํฉ๋๋ค.
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.
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.