1
2

VSCodeでTypescriptを今すぐ実行、デバッグしたい時のメモ

Posted at

プロジェクトの中で実行するのではなく、単に1つのファイルでTypescriptを書いて色々試したい時のための手順です。以下のリンクの通り、丁寧な公式ドキュメントもありますが、手っ取り早く動かしたい時用に書きました。

手順

typescript, ts-nodeがない場合インストール。

npm install -g typescript
npm install -g ts-node

launch.jsonに以下の設定を追加。

{
      "type": "node-terminal",
      "name": "Debug Typescript File",
      "request": "launch",
      "command": "ts-node -- ${fileBasenameNoExtension}",
      "cwd": "${fileDirname}"
},

後はVSCodeのDebugのタブから実行するとbreakpointで止まってくれるはずです。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2