# Tsconfig schema 최상위 프로퍼티들
- filesDefinition
- excludeDefinition
- includeDefinition
- compileOnSaveDefinition
- extendsDefinition
- compilerOptionsDefinition
- referencesDefinition
- typeAcquisitionDefinition
- tsNodeDefinition
1.compileOnSave
// tsconfig.json
{
"compileOnSave": true,
"compilerOptions": {
....
}
}
이럴경우 이 프로젝트에서 파일을 저장하면 컴파일을 하겠다는 옵션이다.
디폴트 값은 false 이다.
2.extends
// tsconfig.json
{
"compileOnSave": true,
"extends": "./base.json",
"compilerOptions": { .... }
}
// base.json {
"compilerOptions": {
"strict": true
}
}
확장할 옵션 파일의 경로를 적어주면 된다
상대경로/절대경로 둘 다 가능
3.files,include,exclude
Tsconfig에 files와 include가 없으면 모든 파일을 컴파일 하려고 함
- files
타입은 배열이며 배열안의 타입은 String이다
//tsconfig.json
"files": ["./base.json"],
// 배열안에 String 타입으로 경로가 설정 되어 있음
- exclude
컴파일할때 제외할 파일들을 설정하는 옵션(files에 있는 파일들은 제외하지 못함)
타입은 배열이며 배열안의 타입은 String이다
//tsconfig.json
"exclude": ["./base.json"],
// 배열안에 String 타입으로 경로가 설정 되어 있음
* exclude를 설정하지 않으면 node_modules / bower_components / jspm_packages / <outDir>
이 4개는 디폴트로 제외된다.
* <outDir>은 항상 제외 한다.
- <outDir>이란? : 컴파일 후 생성되는 js파일이 생성될 폴더명
- include
컴파일할때 포함할 파일들을 설정하는 옵션(files 와 exclude에 있는 파일들을 제외하고 모두 컴파일 하려고 함)
타입은 배열이며 배열안의 타입은 String이다
//tsconfig.json
"include": ["./base.json"],
// 배열안에 String 타입으로 경로가 설정 되어 있음
우선 순위는 files > exclude > include 순이다
'JavaScript' 카테고리의 다른 글
React - react 시작하기 (0) | 2021.12.09 |
---|---|
JS - this 키워드 (0) | 2021.12.09 |
TS - Compilation Context (2) | 2021.12.09 |
JS의 type vs TS의 type (0) | 2021.12.09 |
TS - type annoatation (0) | 2021.12.09 |