220502 typescript compiler

SOMEmo·2022년 5월 2일
1
post-thumbnail

02. tscomfig schema

npm init -y
npm i typescript -D
npx tsc --init  => tsconfig.json생성

03. compileOnSave

true/false(default false)


04. extends

상속받을 때 사용

"extends": "./base.json",

파일 (상대) 경로명: string


05. files, include, exclude

셋다 설정이 없으면, 전부다 컴파일
files: 상대 혹은 절대 경로의 리스트 배열입니다. exclude 보다 쎕니다.
include,exclude: glob 패턴. include(exclude보다 약합니다.)
exclude: 설정 안하면 4가지(node_modules, bower_components,jspm_packages, )를 default로 제외합니다. 은 항상 제외합니다.(include에 있어도)


06. compileOptions-typeRoots, types

@types

  • 아무 설정을 안하면 node_modules/@types라는 모든 경로를 찾아서 사용
  • typeRoots를 사용하면? 배열 안에 들어있는 경로들 아래서만 가져옵니다.
  • types를 사용하면? 배열 안의 모듈 혹은./node_modules/@types/ 안의 모듈 이름에서 찾아옵니다.
  • typeRoots와 types를 같이 사용하지 않습니다.

07. compileOptions - target과 lib

target

  • 빌드의 결과물을 어떤 버전으로 할 것이냐
  • 지정을 안하면 es3입니다.
    lib
  • 기본 type definition 라이브러리를 어떤 것을 사용할 것이냐
  • lib 를 지정하면 그 lib 배열로만 라이브러리를 사용합니다.

1개의 댓글

comment-user-thumbnail
2022년 5월 2일

이해가 잘 되네요~

답글 달기