# compileOptions

compileOptions - strict
Enable all strict type checking options. > > - —noImplicitAny > - —noImplicitThis > - —strictNullChecks > - —strictFunctionTypes > - —strictPropertyInitialization > - —strictBindCallApply > - —alwaysStrict —noImplicitAny > Raise error on expressions and declarations with an implied any type. > 명시적이지 않게 any 타입을 사용하여 표현식과 선언에 사용하면 에러를 발생 TypeScript 가 추론을 실패한 경우, any 가 맞으면 any 라고 지정 아무것도 쓰지 않으면, 에러를 발생 이 오류를 해결하면, any 라고 지정되어 있지 않은 경우 any 가 아닌 것 (타입 추론) suppressImplici

compileOptions - outDir, outFile, rootDir
npx tsc ⇒ 최상위 경로에 test.js 생성! npx tsc ⇒ dist/test.js 생성! npx tsc ⇒ dist/src/hello.js 생성!

compileOptions - target & lib
target & lib? target 빌드의 결과물을 어떤 버전으로 할 것이냐 지정을 안하면 es3 lib 기본 type definition 라이브러리를 어떤 것을 사용할 것이냐 lib 를 지정하지 않았을 때, target 이 ‘es3’ 이고, default 로 lib.d.ts 를 사용 target 이 ‘es5’ 이면, default 로 dom, es5, scripthost 를 사용 target 이 ‘es6’ 이면, default 로 dom, es6, dom.iterable, scripthost 를 사용 lib 를 지정하면 그 lib 배열로만 라이브러리를 사용 빈 [ ] ⇒ “no definition found ”

compileOptions-typeRoots, types
npm i react npm i --save-dev @types/react node_modules/@types/react/index.d.ts @types? TypeScript 2.0 부터 사용 가능해진 내장 type definition 시스템 아무 설정을 안하면? node_modules/@types 라는 모든 경로를 찾아서 사용 typeRoots 를 사용하면? 배열 안에 들어있는 경로들 아래서만 가져옴 types 를 사용하면? 배열 안의 모듈 혹은 ./node_modules.@types/ 안의 모듈 이름에서 찾아옴 [ ] 빈 배열을 넣는다는 건 이 시스템을 이용하지 않겠다는 것 typeRoots 와 types 를 같이 사용하지 않음

[KDT]FCFE - 5주4일 - TypeScript
TypeScript programming language compiled language ( 전통적은 compiled 는 아니다. ) transpile Compiled / Interpreted compiled 컴파일이 필요 O 컴파일러가 필요 O 컴파일하는 시점 O => 컴파일 타임 컴파일된 결과물을 실행 컴파일된 결과물을 실행하는 시점 interpreted 컴파일이 필요 X 컴파일러가 팔요 X 컴파일하는 시점 X 코드자체를 실행 코드를 실행하는 시점 O = 런타임 설치 > npm i typescript -g 글로벌로 설치. 사용 typescript 로 작성된 파일을 javascript 파일 형식으로 바꿔준다. > tsc 파일명.ts 프로젝트에는 설정 파일을 넣어줘야 한다. > tsc --init tsconfig.json 이 생성된다. 이 안에 tsc 설정을 넣어줄 수