studye / typescript

타입스크립트는 자바스크립트랑 다른 언어인가요?
7 stars 0 forks source link

[typescript - 2.1] Configuration inheritance #35

Open denzels opened 7 years ago

denzels commented 7 years ago

tsconfig.json 파일은 상속 구조를 지원함.

상황에 따라 중복은 줄이면서 다양하게 설정 파일을 정의 할 수 있음.

tsconfig 파일의 선택은 다음과 같이 -p ( --project) 옵션을 통해 가능함. tsc -p ./tsconfig.json or tsc -p ./tsconfig.nostrictnull.json

configs/base.json

{
  "compilerOptions": {
    "noImplicitAny": true,
    "strictNullChecks": true
  }
}

tsconfig.json

{
  "extends": "./configs/base",
  "files": [
    "main.ts",
    "supplemental.ts"
  ]
}

tsconfig.nostrictnull.json

{
  "extends": "./tsconfig",
  "compilerOptions": {
    "strictNullChecks": false
  }
}