๐Ÿ›  TypeScript Essential - 1. tsconfig.json

์ด์ถ˜๊ธธยท2021๋…„ 10์›” 27์ผ
0
post-thumbnail

๐Ÿฑโ€๐Ÿ ๋ชฉํ‘œ

  • tsconfig.json

๐Ÿ“Œ 1. tsconfig.json

  • tsconfig.json ํŒŒ์ผ์€ ํ”„๋กœ์ ํŠธ๋ฅผ ์ปดํŒŒ์ผ ํ•˜๋Š”๋ฐ ํ•„์š”ํ•œ ๋ฃจํŠธ ํŒŒ์ผ๊ณผ ์ปดํŒŒ์ผ๋Ÿฌ ์˜ต์…˜์„ ์ง€์ •
{
 ...Top Level
 "compilerOptions": {...},
 "watchOptions": {...},
 "typeAcquisition": {...}
}
  • ๋ฌด์ˆ˜ํžˆ ๋งŽ์€ ์ปดํŒŒ์ผ๋Ÿฌ ์˜ต์…˜๋“ค์ด ์กด์žฌ
  • ๊ณต์‹ ๊ฐ€์ด๋“œ ๋ฌธ์„œ ์ฐธ๊ณ ํ•˜๋ฉฐ, ๊ธฐํ˜ธ์— ๋งž๋Š” ํ”„๋กœ์ ํŠธ ์„ค์ •
  • ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ_tsconfing

1-1) ๋Œ€ํ‘œ ์„ค์ • ์•Œ์•„๋ณด๊ธฐ

{
  "compilerOptions": {
    "strict": true,
    "target": "ES5",
    "module": "CommonJS",
    "alwaysStrict": true,
    "noImplicitAny": true,
    "noImplicitThis": true,
    "sourceMap": true,
    "downlevelIteration": true
  } 
}

1. strict

  • TypeScript์—์„œ ์ง€์ •ํ•œ ์—„๊ฒฉํ•œ ๊ทœ์น™ ์„ธํŠธ
  • default: false
  • Inputs: true / false

2. target

  • ์‚ฌ์šฉํ•˜๊ณ ์ž ํ•˜๋Š” JavaScript ๋ฒ„์ „ ์„ค์ •
  • default: ES3 / ๊ถŒ์žฅ: ES6
  • Inputs: ECMAScript

3. module

  • ES2015์— ๋“ฑ์žฅํ•œ ๋ชจ๋“ˆ ๊ฐœ๋…
  • ์‚ฌ์šฉํ•˜๊ณ ์ž ํ•˜๋Š” ๋ชจ๋“ˆ ์‹œ์Šคํ…œ
  • default: CommonJS,
    (target์ด ES3, ES5, ES6์ด์–ด์•ผ ํ•จ)
  • Inputs: JavaScript Module System

4. alwayStrict

  • ๋ชจ๋“ˆ ํŒŒ์ผ์„ 'use strict' ๋ชจ๋“œ๋กœ ๊ฒ€์‚ฌ
  • default: strict ์†์„ฑ์— ๋”ฐ๋ผ ๋ฐ”๋€œ
  • Inputs: true / false

5. sourceMap

  • TS์—์„œ JS๋กœ ๋ณ€ํ™˜๋œ ํŒŒ์ผ ์ด์™ธ์—, ๊ฐœ๋ฐœ์ž๊ฐ€ ์ž‘์„ฑํ•œ ์›๋ณธ TS ์ฝ”๋“œ๋ฅผ ๋ณด๊ณ  ์‹ถ์„ ๋•Œ ์‚ฌ์šฉ
  • ํ•ด๋‹น ์˜ต์…˜์ด true, ๊ฐœ๋ฐœ์ž ๋„๊ตฌ์—์„œ ํ™•์ธ ๊ฐ€๋Šฅ
  • default: false
  • Inputs: true / false

์ฐธ๊ณ 

ํŒจ์ŠคํŠธ์บ ํผ์Šค ๊น€๋ฏผํƒœ์˜ ํ”„๋ก ํŠธ์—”๋“œ ์•„์นด๋ฐ๋ฏธ

profile
์ผ์ง€๋ฅผ ๊พธ์ค€ํžˆ ์ž‘์„ฑํ•˜์ž.

0๊ฐœ์˜ ๋Œ“๊ธ€