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
'Programming > TypeScript' 카테고리의 다른 글
타입스크립트로 배우는 SOLID 원칙 (0) | 2023.09.12 |
---|---|
타입스크립트 설치 및 초기세팅 (0) | 2023.07.07 |
ts-pattern을 활용한 선언적 분기 작성 (0) | 2023.05.29 |
타입스크립트의 유틸리티 (0) | 2023.04.30 |
타입스크립트 (TypeScript) 란? (0) | 2023.04.30 |