| 
1 | 1 | ### Basic  | 
2 |  | -It is extremely easy to get started with tsconfig.json as the basic file you need is:  | 
 | 2 | + | 
 | 3 | +필요한 기본 파일로 tsconfig.json을 시작하는 것이 가장 쉽습니다.  | 
 | 4 | + | 
3 | 5 | ```json  | 
4 | 6 | {}  | 
5 | 7 | ```  | 
6 |  | -i.e. an empty JSON file at the *root* of your project. This way TypeScript will include *all* the `.ts` files in this directory (and sub directories) as a part of the compilation context. It will also select a few sane default compiler options.  | 
 | 8 | + | 
 | 9 | +예: 프로젝트 최상단에 하나의 빈 JSON 파일 생성. 이런식으로 타입스크립트는 폴더에 컴파일 컨텍스트의 일부로 `.ts` 파일을 전부 포함시킵니다. 또한 몇가지 정상적인 기본 컴파일러 옵션을 선택합니다.  | 
7 | 10 | 
 
  | 
8 | 11 | ### compilerOptions  | 
9 |  | -You can customize the compiler options using `compilerOptions`:  | 
 | 12 | + | 
 | 13 | +당신이 원하는대로 컴파일 옵션을 `compilerOptions`을 이용하여 지정할 수 있습니다.  | 
10 | 14 | 
 
  | 
11 | 15 | ```json  | 
12 | 16 | {  | 
13 |  | - "compilerOptions": {  | 
14 |  | - | 
15 |  | - /* Basic Options */   | 
16 |  | - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */  | 
17 |  | - "module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'. */  | 
18 |  | - "lib": [], /* Specify library files to be included in the compilation: */  | 
19 |  | - "allowJs": true, /* Allow JavaScript files to be compiled. */  | 
20 |  | - "checkJs": true, /* Report errors in .js files. */  | 
21 |  | - "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */  | 
22 |  | - "declaration": true, /* Generates corresponding '.d.ts' file. */  | 
23 |  | - "sourceMap": true, /* Generates corresponding '.map' file. */  | 
24 |  | - "outFile": "./", /* Concatenate and emit output to single file. */  | 
25 |  | - "outDir": "./", /* Redirect output structure to the directory. */  | 
26 |  | - "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */  | 
27 |  | - "removeComments": true, /* Do not emit comments to output. */  | 
28 |  | - "noEmit": true, /* Do not emit outputs. */  | 
29 |  | - "importHelpers": true, /* Import emit helpers from 'tslib'. */  | 
30 |  | - "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */  | 
31 |  | - "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */  | 
32 |  | -   | 
33 |  | - /* Strict Type-Checking Options */   | 
34 |  | - "strict": true, /* Enable all strict type-checking options. */  | 
35 |  | - "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */  | 
36 |  | - "strictNullChecks": true, /* Enable strict null checks. */  | 
37 |  | - "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */  | 
38 |  | - "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */  | 
39 |  | -   | 
40 |  | - /* Additional Checks */   | 
41 |  | - "noUnusedLocals": true, /* Report errors on unused locals. */  | 
42 |  | - "noUnusedParameters": true, /* Report errors on unused parameters. */  | 
43 |  | - "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */  | 
44 |  | - "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */  | 
45 |  | -   | 
46 |  | - /* Module Resolution Options */   | 
47 |  | - "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */  | 
48 |  | - "baseUrl": "./", /* Base directory to resolve non-absolute module names. */  | 
49 |  | - "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */  | 
50 |  | - "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */  | 
51 |  | - "typeRoots": [], /* List of folders to include type definitions from. */  | 
52 |  | - "types": [], /* Type declaration files to be included in compilation. */  | 
53 |  | - "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */  | 
54 |  | -   | 
55 |  | - /* Source Map Options */   | 
56 |  | - "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */  | 
57 |  | - "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */  | 
58 |  | - "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */  | 
59 |  | - "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */  | 
60 |  | -   | 
61 |  | - /* Experimental Options */   | 
62 |  | - "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */  | 
63 |  | - "emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */  | 
64 |  | - }  | 
 | 17 | + "compilerOptions": {  | 
 | 18 | + /* Basic Options */  | 
 | 19 | + | 
 | 20 | + "target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */,  | 
 | 21 | + "module": "commonjs" /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'. */,  | 
 | 22 | + "lib": [] /* Specify library files to be included in the compilation: */,  | 
 | 23 | + "allowJs": true /* Allow JavaScript files to be compiled. */,  | 
 | 24 | + "checkJs": true /* Report errors in .js files. */,  | 
 | 25 | + "jsx": "preserve" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */,  | 
 | 26 | + "declaration": true /* Generates corresponding '.d.ts' file. */,  | 
 | 27 | + "sourceMap": true /* Generates corresponding '.map' file. */,  | 
 | 28 | + "outFile": "./" /* Concatenate and emit output to single file. */,  | 
 | 29 | + "outDir": "./" /* Redirect output structure to the directory. */,  | 
 | 30 | + "rootDir": "./" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,  | 
 | 31 | + "removeComments": true /* Do not emit comments to output. */,  | 
 | 32 | + "noEmit": true /* Do not emit outputs. */,  | 
 | 33 | + "importHelpers": true /* Import emit helpers from 'tslib'. */,  | 
 | 34 | + "downlevelIteration": true /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */,  | 
 | 35 | + "isolatedModules": true /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */,  | 
 | 36 | + | 
 | 37 | + /* Strict Type-Checking Options */  | 
 | 38 | + | 
 | 39 | + "strict": true /* Enable all strict type-checking options. */,  | 
 | 40 | + "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,  | 
 | 41 | + "strictNullChecks": true /* Enable strict null checks. */,  | 
 | 42 | + "noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */,  | 
 | 43 | + "alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */,  | 
 | 44 | + | 
 | 45 | + /* Additional Checks */  | 
 | 46 | + | 
 | 47 | + "noUnusedLocals": true /* Report errors on unused locals. */,  | 
 | 48 | + "noUnusedParameters": true /* Report errors on unused parameters. */,  | 
 | 49 | + "noImplicitReturns": true /* Report error when not all code paths in function return a value. */,  | 
 | 50 | + "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,  | 
 | 51 | + | 
 | 52 | + /* Module Resolution Options */  | 
 | 53 | + | 
 | 54 | + "moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,  | 
 | 55 | + "baseUrl": "./" /* Base directory to resolve non-absolute module names. */,  | 
 | 56 | + "paths": {} /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */,  | 
 | 57 | + "rootDirs": [] /* List of root folders whose combined content represents the structure of the project at runtime. */,  | 
 | 58 | + "typeRoots": [] /* List of folders to include type definitions from. */,  | 
 | 59 | + "types": [] /* Type declaration files to be included in compilation. */,  | 
 | 60 | + "allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */,  | 
 | 61 | + | 
 | 62 | + /* Source Map Options */  | 
 | 63 | + | 
 | 64 | + "sourceRoot": "./" /* Specify the location where debugger should locate TypeScript files instead of source locations. */,  | 
 | 65 | + "mapRoot": "./" /* Specify the location where debugger should locate map files instead of generated locations. */,  | 
 | 66 | + "inlineSourceMap": true /* Emit a single file with source maps instead of having a separate file. */,  | 
 | 67 | + "inlineSources": true /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */,  | 
 | 68 | + | 
 | 69 | + /* Experimental Options */  | 
 | 70 | + | 
 | 71 | + "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */,  | 
 | 72 | + "emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */  | 
 | 73 | + }  | 
65 | 74 | }  | 
66 | 75 | ```  | 
67 | 76 | 
 
  | 
68 |  | -These (and more) compiler options will be discussed later.  | 
 | 77 | +이러한 컴파일러 옵션은 추후에 의논해야 합니다.  | 
69 | 78 | 
 
  | 
70 | 79 | ### TypeScript compiler  | 
71 |  | -Good IDEs come with built in support for on the fly `ts` to `js` compilation. However, if you want to run the TypeScript compiler manually from the command line when using `tsconfig.json`, you can do it in a few ways:  | 
72 |  | -* Just run `tsc` and it will look for `tsconfig.json` in the current as well as all parent folders till it finds it.  | 
73 |  | -* Run `tsc -p ./path-to-project-directory`. Of course the path can be absolute or relative to the current directory.  | 
74 | 80 | 
 
  | 
75 |  | -You can even start the TypeScript compiler in *watch* mode using `tsc -w` and it will watch your TypeScript project files for changes.  | 
 | 81 | +좋은 IDE는 `ts를`를 `js`로 컴파일합니다. 그러나 `tsconfig.json`을 사용할 때 타입스크립트를 수동으로 컴파일하고 싶다면 당신에게 몇가지 방법이 있습니다.  | 
 | 82 | + | 
 | 83 | +- `tsc`만 실행하면 현재폴더와 모든 상위폴더에서 `tsconfig.json`를 찾습니다.  | 
 | 84 | +- `tsc -p ./path-to-project-directory`를 실행하십시요. 물론 경로는 상대경로 또는 절대경로일 수 있습니다.  | 
 | 85 | + | 
 | 86 | +당신은 타입스크립트 컴파일러를 시작할때 `tsc -w`로 _watch_ 모드를 사용할 수 있습니다. 이것은 타입스크립트 프로젝트 파일들의 변경사항을 볼 수 있습니다.  | 
0 commit comments