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/17 14:42] – 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 260: | Line 330: | ||
| | ||
+ | ===== Examples ===== | ||
+ | <sxh typescript title: value 값으로 key 값 찾기> | ||
+ | this.listJoinPath[Object.keys(this.listJoinPath).find(key => this.listJoinPath[key].dtlCd === thisjoinPathCd)].joinPathCont | ||
+ | </ | ||
+ | |||
+ | * [[https:// | ||
Line 268: | Line 344: | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | * [[https:// |