tsconfig.json은 TypeScript 컴파일러(tsc)에게 어떤 파일을, 어떤 규칙으로 검사하고, 무엇을 출력할지 알려 주는 프로젝트 설정 파일이다. tsc --init으로 만들고, 이 파일이 있으면 tsc만 쳐도 프로젝트 전체를 컴파일한다(-w는 감시 모드, watch mode).
범위와 출력
include·exclude: 검사할 파일 패턴. 둘이 겹치면 include한 뒤 exclude한다target: 출력할 JS(JavaScript) 버전(다운레벨링 기준).lib: 쓸 수 있는 내장 API(Application Programming Interface) 선언(생략하면 target에 맞춰짐)rootDir·outDir: 소스와 출력 위치(src→dist)sourceMap: 브라우저 디버거에서 원본 TS를 보게 하는.map파일 생성noEmitOnError: 타입 에러가 있으면 JS를 내보내지 않음(기본은 에러가 있어도 내보냄). 아예 출력하지 않는 noEmit도 있다declaration: 라이브러리용.d.ts생성(선언 파일(.d.ts)과 declare)
strict 묶음
"strict": true 하나가 아래를 한꺼번에 켠다. TypeScript 6.0부터는 기본값이 true다(2026 기준). 이전 버전이라면 직접 켜고 시작한다.
noImplicitAny: 추론할 수 없어 암묵적으로any가 된 곳을 에러로strictNullChecks:null·undefined를 별도 타입으로 다룬다. 꺼져 있으면querySelector()결과를 확인 없이 써도 통과한다(옵셔널 체이닝과 null 병합 연산자)strictFunctionTypes: 함수 매개변수를 반공변으로 검사(공변성과 반공변성)strictBindCallApply,strictPropertyInitialization,noImplicitThis,useUnknownInCatchVariables(any와 unknown),strictBuiltinIteratorReturn,alwaysStrict
strict에 들어 있지는 않지만 많이 켜는 옵션으로 noUnusedLocals, noUnusedParameters, noImplicitReturns, noUncheckedIndexedAccess가 있다. 파일 단위 변환 도구와 맞추는 옵션은 verbatimModuleSyntax와 import type에 정리했다.
출처: TSConfig Reference · strict