320x100
320x100

tsc 설치

npm install -g typescript

 

- 사용방법

tsc app.ts

// 타입 검사 오류를 수행하지 않고 코드 실행
tsc --noEmitOnError app.ts

// 다운 레벨링 (TS는 기본적으로 ES3 버전으로 동작)
tsc --target es2015 app.ts

 

 

 

 

 

엄격도 설정

: 타입스크립트는 기본적으로 가장 관대한 기준으로 검사를 수행

: 잠재적인 null / undefined 값에 대한 검사를 수행하지 않음

 

- 엄격한 검사

tsc --strict app.ts

 

- tsconfig.json

// 모든 플래그 활성화
"strict": true
// noImplicitAny : 타입이 any로 암묵적으로 추론
// strictNullChecks : null과 undefined를 명시적으로 처리

 

 

 

 

 

타입선언

: https://www.typescriptlang.org/ko/docs/handbook/2/everyday-types.html

 

Documentation - Everyday Types

언어의 원시 타입들.

www.typescriptlang.org

 

 

 

함수에 대한 타입선언

: https://www.typescriptlang.org/ko/docs/handbook/2/functions.html

 

Documentation - More on Functions

TypeScript에서 함수가 어떻게 동작하는지 알아봅시다.

www.typescriptlang.org

 

 

 

 

 

 

Reference

 

Documentation - The Basics

TypeScript를 배우는 첫 걸음: 기본 타입.

www.typescriptlang.org

 

300x250
728x90