타입 스크립트 설치

yarn add global typescript

tsconfig.json 생성

{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es2015",
    "sourceMap": true
  },
  "include": ["index.ts"],
  "exclude": ["node_modules"]
}

컴파일

tsc index.ts

ts파일을 컴파일 해서 결과를 만들어 준다.

파일 못 찾아서 당황했는데 웹스톰에서는 계층 구조로 js 안에서 보여주네

스크립트를 만들자

{
  "name": "typechain",
  "version": "1.0.0",
  "main": "index.js",
  "repository": "<https://github.com/almond-bongbong/typechain>",
  "license": "MIT",
  "scripts": {
    "prestart": "tsc",
    "start": "node index.js"
  },
  "dependencies": {
    "global": "^4.4.0",
    "typescript": "^3.6.2"
  }
}