Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| public:computer:typescript [2021/12/16 23:35] – [Fundamentals] alex | public:computer:typescript [2023/01/03 11:34] (current) – alex | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== TypeScript ====== | ====== TypeScript ====== | ||
| + | |||
| + | |||
| + | ===== Quick Start ===== | ||
| + | * typescript 설치 <sxh bash> | ||
| + | $ npm i -g typescript | ||
| + | # or | ||
| + | $ npm i -D typescript | ||
| + | |||
| + | $ npm ls -g --depth=0 | ||
| + | $ tsc -v # global | ||
| + | $ npx tsc -v # local | ||
| + | </ | ||
| + | * prettier <sxh bash> | ||
| + | $ npm i tslint-config-prettier | ||
| + | </ | ||
| + | * set tslint.json <sxh json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | * generate tsconfig.json <sxh json> | ||
| + | $ tsc --init | ||
| + | </ | ||
| + | * edit package.json for prettier <sxh json> | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | * install ts-node <sxh bash> | ||
| + | $ npm install -g ts-node | ||
| + | $ npm install --save-dev ts-node | ||
| + | </ | ||
| + | |||
| + | * 프로젝트 시작하기 <cli prompt=" | ||
| + | $ npm init -y # create package.json in node.js project | ||
| + | $ npm install typescript --save-dev | ||
| + | $ npm install @types/node --save-dev | ||
| + | $ npx tsc --init --rootDir src --outDir lib --esModuleInterop --resolveJsonModule --lib es6,dom --module commonjs | ||
| + | $ npm install ts-node --save-dev | ||
| + | $ npm install nodemon --save-dev | ||
| + | </ | ||
| + | |||
| + | * package.json <code json> | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | </ | ||
| + | |||
| + | * 실행 <cli prompt=" | ||
| + | $ npm start | ||
| + | </ | ||
| + | |||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | |||
| ===== Setup ===== | ===== Setup ===== | ||
| Line 218: | Line 288: | ||
| * 제네릭 프로그래밍 | * 제네릭 프로그래밍 | ||
| + | * 제네릭 타입의 이해 | ||
| + | * 제네릭 사용 | ||
| + | * 제네릭 타입 제약(generic type constraint) | ||
| + | * new 타입 제약 | ||
| + | * 팩토리 함수(factory function) | ||
| + | * 인덱스 타입 제약(index type constraint) | ||
| + | * 대수 데이터 타입(algebraic data type) | ||
| + | * ADT 추상 데이터 타입(abstract data type) | ||
| + | * 합집합 타입(union type) or |, 교집합 타입(intersection type) and & | ||
| + | * 식별 합집합(discriminated unions) | ||
| + | * 타입 가드(type guard) | ||
| + | * instanceof 연산자 | ||
| + | * is 연산자 | ||
| + | * F-바운드 다형성(F-bound polymorphism) | ||
| + | * nullable 타입 | ||
| + | * 옵션 체이닝(option chaining) | ||
| + | * 널 병합 연산자(nullish coalescing operator) | ||
| + | * 세이프 내비게이션 연산자(safe navigation operator) | ||
| + | * 펑터(functor) | ||
| + | * NaN(Not a Number) | ||
| + | | ||
| + | |||
| + | |||
| + | * 모나드(Monad) | ||
| + | * 카테고리 이론(category theory) | ||
| + | * 코드 설계 패턴(design pattern) | ||
| + | * 타입 클래스(type class) | ||
| + | * 고차 타입(higher-kinded type) | ||
| + | * 판타지랜드 규격(fantasy-land) | ||
| + | * 모나드 조건 | ||
| + | * 펑터(Functor): | ||
| + | * 어플라이(Apply): | ||
| + | * 애플리커티브(Applicative): | ||
| + | * 체인(Chain): | ||
| + | * 모나드 룰, 왼쪽 법칙, 오른쪽 법칙 | ||
| + | * 엔도(endo)-, | ||
| + | * Maybe 모나드; Just 모나드, Nothing 모나드 | ||
| + | * Validation 모나드; Success 모나드, Failure 모나드, -> 비밀번호 검증, 이메일 주소 검증, | ||
| + | * IO 모나드; | ||
| + | |||
| + | | ||
| + | |||
| + | ===== Examples ===== | ||
| + | <sxh typescript title: value 값으로 key 값 찾기> | ||
| + | this.listJoinPath[Object.keys(this.listJoinPath).find(key => this.listJoinPath[key].dtlCd === thisjoinPathCd)].joinPathCont | ||
| + | </ | ||
| + | |||
| + | * [[https:// | ||
| Line 226: | Line 344: | ||
| * [[https:// | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| + | * [[https:// | ||