Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revisionBoth sides next revision
public:computer:typescript [2022/09/11 21:01] alexpublic:computer:typescript [2023/01/03 10:59] alex
Line 3: Line 3:
  
 ===== Quick Start ===== ===== Quick Start =====
 +  * typescript 설치 <sxh bash>
 +$ npm i -g typescript  # install globally, use $ tsc <typescript file>
 +# or
 +$ npm i -D typescript  # install devDependency, use $ npx tsc <typescript file>
  
-<cli prompt="$" comment="  # ">+$ npm ls -g --depth=0  # 확인 
 +$ tsc -v  # global 
 +$ npx tsc -v  # local 
 +</sxh> 
 +  * prettier <sxh bash> 
 +$ npm i tslint-config-prettier 
 +</sxh> 
 +  * set tslint.json <sxh json> 
 +
 +  "defaultSeverity": "error", 
 +  "extends": ["tslint:latest", "tslint-config-prettier"], 
 +  "jsRules": {}, 
 +  "rules":
 +    "semicolon": true 
 +  }, 
 +  "rulesDirectory": [] 
 +
 +</sxh> 
 +  * generate tsconfig.json <sxh json> 
 +$ tsc --init 
 +</sxh> 
 +  * edit package.json for prettier <sxh json> 
 +  "prettier":
 +    "printWidth": 80, 
 +    "useTabs": false, 
 +    "tabWidth": 2, 
 +    "bracketSpacing": true, 
 +    "semi": true, 
 +    "singleQuote": false 
 +  } 
 +
 +</sxh> 
 +  * install ts-node <sxh bash> 
 +$ npm install -g ts-node  # global 
 +$ npm install --save-dev ts-node  # local 
 +</sxh> 
 + 
 +  * 프로젝트 시작하기 <cli prompt="$" comment="  # ">
 $ npm init -y  # create package.json in node.js project $ npm init -y  # create package.json in node.js project
 $ npm install typescript --save-dev  # add typescript $ npm install typescript --save-dev  # add typescript
Line 13: Line 54:
 </cli> </cli>
  
-<code json>+  * package.json <code json>
 "scripts": { "scripts": {
   "start": "npm run build:live",   "start": "npm run build:live",
Line 21: Line 62:
 </code> </code>
  
-<cli prompt="$" comment="  # ">+  * 실행 <cli prompt="$" comment="  # ">
 $ npm start $ npm start
 </cli> </cli>
  
   * [[https://offbyone.tistory.com/445|Node.js + TypeScript 프로젝트 만들기]]   * [[https://offbyone.tistory.com/445|Node.js + TypeScript 프로젝트 만들기]]
-  * +  * [[https://velog.io/@grinding_hannah/TypeScript-nodemon-ts-node-%EB%AA%A8%EB%93%88-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0|[TypeScript] nodemon, ts-node 모듈 설치하기]] 
 +  * [[https://radlohead.gitbook.io/typescript-deep-dive/nodejs|Node.js 시작하기]] 
 + 
 ===== Setup ===== ===== Setup =====
 <cli> <cli>
  • public/computer/typescript.txt
  • Last modified: 2023/01/03 11:34
  • by alex