typescript init / typescript boilerplate / tsc / typescript 시작 / 타입스크립트 시작
간단하게 typescript 시작하기
- npm 이 설치되어 있다고 가정
- npm init
- npm i -D typescript
- mkdir src
- tsc --init 하면 tsconfig.json 이 생성된다.
- <proj_root>/tsconfig.json생성
- package.json에 build command 추가:- tsc -p tsconfig.json
- node 관련 package 를 사용한다면 npm i @types/node 를 해주자.
tsconfig.json
{
    "compilerOptions": {
        "strict": true,
        "outDir": "./dist/",
        "sourceMap": true,
        "noImplicitAny": true,
        "module": "commonjs",
        "target": "es5",
    },
    "include": [
        "./src/**/*.ts"
    ],
    "exclude": [
        "**/*.test.ts"
    ]
}package.json
{
  ...
  "scripts": {
    "build": "tsc -p tsconfig.json",
    ...
  },
  ...
}  
댓글 없음:
댓글 쓰기