ts-node命令
一、新建ts文件
二、debug 添加配置
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug ts",
"type": "node",
"request": "launch",
"runtimeArgs": ["-r", "ts-node/register"],//核心
"args": ["${workspaceFolder}/hello.ts"]
}
]
}
三、当前目录添加局部 ts ts-node
npm i typescript ts-node
自动编译
tsc --init
修改生成json的outDir 即编译后的js目录