我爱编程

vscode 配置typescript环境

2018-04-15  本文已影响4838人  wwmin_

首先确保已经安装了node,vscode

{
  "name": "test",
  "version": "1.0.0",
  "description": "测试",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [
    "test",
    "javascript"
  ],
  "author": "name(name@163.com)",
  "license": "ISC",
  "dependencies": {}
}
{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es6",
    "removeComments": false,
    "noImplicitAny": false,
    "sourceMap": true,
    "allowJs": true
  },
  "exclude": ["node_modules"]
}

因为写node.js你可以修改targetes6, 要调试把 sourceMap改为true, 添加allowjstrue,就可以ts和js混合用了.

{
  // 使用 IntelliSense 了解相关属性。 
  // 悬停以查看现有属性的描述。
  // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "启动程序",
      "program": "${workspaceFolder}\\index.js",
      "outFiles": [
        "${workspaceFolder}/**/*.js"
      ]
    }
  ]
}
上一篇 下一篇

猜你喜欢

热点阅读