본문 바로가기

Uber Eats

# 2-2 TypeScript 특징 및 컴파일 위치 및 타입스크립트 설정

const sayHi = {name: string, age: number, gender: string}:string => {
	return `Hello ${name}, you are ${age}. you are a ${gender}`;
};

sayHi("Seunghwan", 30, "male");

export {};

타입스크립트에서는 파라미터 변수의 데이터 타입을 명시할 수 있다. 

파라미터 옆 : string을 통해서 return값을 설정할 수 있다.

 

tsc-watch를 통해 새로고침시 변경된 적용을 불러오게 한다.

yarn add tsc-watch --dev 

 

include를 src/**/*로 하면 typescript는 src안으로 가게 되고 컴파일 된 내용은

outDir에 설정한 dist 로 들어가게 된다.

 

'Uber Eats' 카테고리의 다른 글

# 2-4 TypeScript - class  (0) 2021.02.10
# 2-3 TypeScript - 파라미터에 Object 넘기기  (0) 2021.02.10
# 2-1 TypeScript - 특징 및 규칙  (0) 2021.02.10
# 2-0 TypeScript - config setting 환경설정  (0) 2021.02.10
# 1 준비단계  (0) 2021.02.10