[1] 루트 경로 tsconfig.json
{
"compilerOptions": {
/* Basic Options */
"target": "ES2021", // ECMAScript 타겟 버전 지정: 'ES3' (기본값), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 또는 'ESNEXT'
"module": "commonjs", // 모듈 코드 생성 방식 지정: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', 또는 'ESNext'
"lib": ["ES2021"], // 컴파일에 포함될 라이브러리 파일 지정
"allowJs": true, // JavaScript 파일의 컴파일 허용
"inlineSourceMap": true, // 추가: 디버깅 편의를 위해 소스맵을 인라인으로 포함(js에서 에러 발생 시 원본 ts 파일 라인 표시)
"outDir": "dist", // 출력 구조를 지정된 디렉토리로 리다이렉트
// "rootDir": "src", // 추가: 소스 루트 명시
/* Strict Type-Checking Options */
"strict": true, // 모든 엄격한 타입 검사 옵션 활성화
"noImplicitAny": true, // 암시적 'any' 타입이 있는 표현식 및 선언에 대해 오류 발생
/* Module Resolution Options */
"moduleResolution": "node", // 모듈 해석 전략 지정: 'node' (Node.js) 또는 'classic' (TypeScript 1.6 이전)
"baseUrl": ".", // 절대 경로가 아닌 모듈 이름을 해석하기 위한 기본 디렉토리
"resolveJsonModule": true, // JSON 파일 import 허용
// "paths" // ! moduleResolution: node일 경우 불필요
"allowSyntheticDefaultImports": true, // 기본 내보내기가 없는 모듈에서 기본 가져오기 허용. 코드 생성에는 영향을 주지 않고 타입 검사만 수행
"esModuleInterop": true, // 모든 가져오기에 대한 네임스페이스 객체 생성을 통해 CommonJS와 ES 모듈 간의 상호 운용성 활성화. 'allowSyntheticDefaultImports'를 암시적으로 포함
/* Experimental Options */
"experimentalDecorators": true, // ES7 데코레이터에 대한 실험적 지원 활성화
"emitDecoratorMetadata": true, // 데코레이터에 대한 타입 메타데이터 방출을 위한 실험적 지원 활성화
"skipLibCheck": true, // 선언 파일의 타입 검사 건너뛰기
/* Advanced Options */
"forceConsistentCasingInFileNames": true // 동일한 파일에 대한 일관되지 않은 대소문자 참조 비활성화
/* Additional */
// "declaration": true, // .d.ts 파일 생성 (라이브러리라면 필수)
// "declarationMap": true // .d.ts.map 생성 (declaration과 함께)
},
"include": [
"src/**/*",
],
"exclude": [
"node_modules", "dist", "test",
]
}
[2] 하위 경로(test 폴더 등) tsconfig.json
{
"extends": "../tsconfig.json",
"include": [
"**/*",
"../src/**/*"
],
}