TypeScript 기본 설정
2020. 10. 4. 15:11ㆍDEV/TypeScript
반응형
TypeScript
자유로운 JavaScript에 규칙을 적용해 공동 작업 등에 용이하도록 만든 언어라고 볼 수 있다.
프로젝트 설정
tsconfig.json
{
"compilerOptions": {
"module": "commonjs", // nodeJS를 사용, import/export 가능하도록 설정
"target": "ES2015", // compile JavaScript Version
"sourceMap": true, // sourceMap 처리 여부 설정
"outDir": "dist" // compile target dirctory
},
"include": ["src/**/*"], // 컴파일 포함 설정
"exclude": ["node_modules"] // 컴파일 제외 설정
}
package.json
간단 파일 테스트
outDir 설정 없이도 사용 가능하다. 일단 테스트 고고!!
"scripts": {
"start" : node index.js
"prestart" : "tsc" // start 이전 compile 실행하도록 설정
},
ts-watch 사용
- package.json : script 설정
- tsconfig.json : outDir 설정
{
"name": "typechain",
"version": "1.0.0",
"description": "Learning Typescript by making a Blockchain with it",
"main": "index.js",
"repository": "https://github.com/nomadcoders/typechain",
"author": "Nicolás Serrano Arévalo <itnico.las.me@gmail.com>",
"license": "MIT",
"scripts": {
"start": "tsc-watch --onSuccess \" node dist/index.js\" ",
},
"devDependencies": {
"tsc-watch": "^1.0.17"
},
"dependencies": {
"crypto-js": "^3.1.9-1"
}
}
Plug-Ins
VS Code
TypeScript Tips 등을 보기 위해 설치해주자.
반응형
'DEV > TypeScript' 카테고리의 다른 글
TypeScript 기본 개념 (0) | 2020.10.04 |
---|