프로그래밍/TypeScript
[ TS ] tsconfig.json 의 내용 정리
L.Joey
2024. 6. 8. 10:44
코드 tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "ES2021",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
"skipLibCheck": true,
"strictNullChecks": true,
"noImplicitAny": true,
"strictBindCallApply": false,
"forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": true,
"strictFunctionTypes": true,
"useUnknownInCatchVariables": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
}
}
- "module": "commonjs" ▶ 생성될 모듈 코드 wlwjd
- "declaration": true ▶ 프로젝트 배포시 .d.ts 파일을 생성
- "removeComments": true ▶ /*!로 시작하는 copy-right 헤더 주석을 제외한 모든 주석을 제거
- "emitDecoratorMetadata": true ▶ 소스에 데코레이터 선언에 대한 설계-타입 메타 데이터를 내보냅니다.
- "experimentalDecorators": true ▶ ES 데코레이터에 대한 실험적인 지원을 사용하도록 활성화합니다.
- "allowSyntheticDefaultImports": true ▶ default export가 없는 모듈에서 default imports를 허용합니다. 코드 방출에는 영향을 주지 않으며, 타입 검사만 수행합니다
- "target": "ES2021" ▶ JavaScript에 대한 버전을 설정합니다.
- "sourceMap": true ▶ 해당하는 .map 파일을 생성합니다.
- "outDir": "./dist" ▶ 컴파일된 파일들을 저장할 디렉토리를 지정합니다.
- "baseUrl": "./" ▶ 상대 경로가 아닌 모듈이 기본적으로 위치한 기준 디렉토리를 설정합니다.
- "incremental": true ▶ 프로젝트를 증분 컴파일할 수 있도록 .tsbuildinfo 파일을 저장합니다.
- "skipLibCheck": true ▶ 모든 .d.ts 파일을 검사하는 형식을 건너뜁니다.
- "strictNullChecks": true ▶ 엄격하게 null 과 undefined 타입을 허락하지 않는다.
- "noImplicitAny": true ▶ any 타입으로 암시한 표현식과 선언에 오류를 발생시킵니다.
- "strictBindCallApply": false ▶ 함수에서 bind, call 그리고 apply 메서드의 더 엄격한 검사를 활성화합니다.
- "forceConsistentCasingInFileNames": false ▶ 파일명에 대소문자 구분하지 않아도 되는 기능 사용 여부
- "noFallthroughCasesInSwitch": true ▶ 스위치 문에 fallthrough cases에 대해 오류 보고를 사용하도록 설정합니다.
- "strictFunctionTypes": true ▶ 함수를 할당할 때 매개 변수와 반환 값이 서브 타입과 호환되는지 확인합니다
- "useUnknownInCatchVariables": true ▶ catch 절의 변수 유형을 any 대신 unknown으로 만듭니다.
- "noImplicitReturns": true ▶ 함수의 모든 코드 경로에서 반환 값이 없을 때 오류를 보고합니다.
- "noUnusedLocals": true ▶사용되지 않은 지역 변수에 대한 오류를 보고합니다.
- "noUnusedParameters": true ▶ 사용되지 않은 매개변수에 대한 오류를 발생시킵니다
*증분컴파일 : 프로그램의 수정된 부분만 다시 컴파일하는 기술
참고자료
- https://typescript-kr.github.io/pages/compiler-options.html
- https://velog.io/@ez1211/tsconfig.json-%ED%95%9C%EA%B8%80-%EB%B2%88%EC%97%AD
- https://inpa.tistory.com/entry/TS-%F0%9F%93%98-%ED%83%80%EC%9E%85%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8-tsconfigjson-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0-%EC%B4%9D%EC%A0%95%EB%A6%AC
- https://velog.io/@ez1211/tsconfig.json-%ED%95%9C%EA%B8%80-%EB%B2%88%EC%97%AD