본문 바로가기

Uber Eats

# 2-0 TypeScript - config setting 환경설정

TypeScript은 javascript의 superset이다. 

프로그래밍 언어

컴파일하면 자바스크립트로 컴파일 된다. 

자바스크립트 위에 있다.

왜 사용하는가? 

1. 엄격한 규칙

2. 큰 프로젝트, 팀에서 일하거나 버그를 최소화 한다.

3. 예측가능

4. 읽기 쉬운 코드

 

yarn global add typescript

 

tsconfig.json 파일은 typescript에게 어떻게 javascript로 변환하는지 알려준다. 

1.compilerOptions

node.js

다양한 걸 import export

어떤 버전의 자바스크립트 

sourcemap 처리 

 

2.include

어떤 파일들이 컴파일 과정에 포함되는지 

파일의 배열을 적으면 된다. 

예) index.ts 

3.exclude

예) node_modules 

 

명령어 tsc 

ts 파일에 있는 코드를 컴파일해서 index.js와 index.js.map을 만들어준다.

 

tsc 대신 sciprt 아래 start를 작성하여 사용한다. 

ts 파일을 컴파일 하는게 먼저 

prestart는 start전에 실행된다.

node.js는 typesciprt를 이해하지 못한다

 

github.com/hwan02/typescript