This is an old revision of the document!
TypeScript
Setup
npm i -D typescript // devDependency로 설치 npm i -g typescript // global로 설치
- PowerShell 관리자모드 실행
Set-ExecutionPolicy Unrestricted
npx tsc myFirstTypescript.ts // devDependency로 설치 시 tsc myFirstTypescript.ts // global 설치 시
tsc --init
"outDir": "./dist", "rootDir": "./src",
TSLint 설치
npm i -g tslint // tslint package module 설치
tslint --init
{ ... "rules": { "semicolon": true }, ... }
"editor.formatOnSave": false, "tslint.autoFixOnSave": true,
Prettier 설치
npm i tslint-config-prettier // 패키지 설치 후 아래 진행
{ ... "extends": ["tslint:recommended", "tslint-config-prettier"], ... }
editor.formatOnSave: true ... "prettier.tslintIntegration": true
Fundamentals
- 트랜스파일러(transpiler)
- 비구조화 할당(destructuring assignment
- 화살표 함수(arrow function)
- 캡슐화(encapsulation), 상속(inheritance), 다형성(polymorphism)
- 반복기(iterator)
- 생성기(generator)
- Promise, await/async
- 비동기 콜백 함수 asynchronous callback function
- 타입 주석(type annotation)
- 타입 추론(type inference)
- 튜플(tuple)
- 제네릭 타입(generic type)
- 추상 데이터 타입(abstract data type)
- 합집합 타일(union 또는 sum type), 교집합 타입(intersection 또는 product type)
- package.json
- tsconfig.json
- module 키
- moduleResolution 키
- target 키
- baseUrl과 outDir 키
- paths 키
- esModuleInterop 키
- sourceMap 키
- downlevelIteration 키
- noImplicitAny 키
- number, boolean, string, object, any, undefined
- let, const
- 템플릿 문자열; `` 역따옴표(backtick) ${}
- object, interface, class, abstract class
- 선택속성(optional property) ?
- 익명 인터페이스(anonymous interface)
- 클래스; 접근제한자(access modifier), 생성자(constructor)
- 구현 implements
- 상속 extends, super 키워드
- static 속성 in class
- 구조화 structuring ↔ 비구조화 destructuring
- 잔여 연산자 rest operator, 전개 연산자 spread operator
- 타입 변환 type conversion, cf.) type casting, type coercion
- 타입 단언 type assertion
- 매개변수 parameter, 인수 혹은 인자 argument
- 함수 시그니처 function signature
- 타입 별칭 type alias
- undefined, null
- 선택적 매개변수 optional parameter
- 함수 표현식 function expression
- 일등 함수 first-class function
- 표현식, 함수 표현식, 계산법, 함수 호출 연산자, 익명 함수
- 실행문 지향 언어 execution-oriented language, 표현식 지향 언어 expression-oriented language, 다중 패러다임 언어 multi-paradigm language
- 표현식 문 expression statement
- 복합 실행문 compound statement
- 고차 함수 high-order function, 클로저 closure, 부분 애플리케이션 partial application, 부분 적용 함수 partially applied function
- 디폴트 매개변수 default parameter
- 클래스 메서드, this, 메서드 체인 method chain
- 배열, 튜플, 인덱스 연산자; []
- for…in 인덱스값, for…of 아이템값
- 제네릭 타입 generics
- 선언형 프로그래밍 declarative programming, 명령형 프로그래밍 imperative programming,
- 배열의 map, reduce, filter 메서드
- 순수 함수 pure function, 불순 함수 impure function
- 타입 수정자 readonly
- 불변 immutable, 가변 mutable
- 깊은 복사 deep-copy, 얕은 복사 shallow-copy
- 가변 인수 variadic arguments
- 반복기 iterator, Iterable<T>와 Iterator<T> 인터페이스
- 생성기 generator, yield, function*, 세미코루틴 semi-coroutine 반협동 루틴, 멀티스레드 multi-thread, 싱글스레드 single-thread
- 세미코루틴, 코루틴
- 동기 synchronous, 비동기 asynchronous
- Promise → resolve와 reject 함수, then-체인, .resolve 메서드, .reject 메서드, .race 메서드, .all 메서드
- async/await;