Entry

esbuild: Implementing TypeScript

Solution

{
  "scripts": {
    "start": "node dist/index.js",
    "watch": "npm-run-all --parallel 'build:js --watch' 'build:types -w'",
    "build": "npm-run-all --serial build:js build:types",
    "build:js": "esbuild index.ts --bundle --outfile=dist/index.js --platform=node",
    "build:types": "tsc --declaration index.ts --emitDeclarationOnly --outDir ./dist",
  },
  "devDependencies": {
    "esbuild": "^0.24.0",
    "npm-run-all": "^4.1.5",
    "typescript": "^5.7.2"
  },
}

This setup outputs Simply use npm build & npm watch