Skip to content

ReySun/typescript

Repository files navigation

使用vscode编译ts

  1. 更新vscode至最新版本,Shift+Ctrl+B 默认自动配置并编译ts。若没有编译成功,在项目根目录配置 .vscode\tasks.json
{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "type": "typescript",
            "tsconfig": "tsconfig.json",
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}
  1. 若要使用node测试编译后的js。按F5并选择Node.js环境,Shift+Ctrl+F5强制重新启动Node.js
  2. Shift+Ctrl+Y在控制台查看输出
  3. TODO:运用gulp等自动化构建。(已完成gulp)
npm i
gulp watch

在项目中使用其他tsd库的*.d.ts智能提示功能

  1. demo移步app.ts

特殊说明

  1. 项目下的typescript demo大部分来自广发证券的书籍《揭秘Angular 2》,部分来源于官网http://www.typescriptlang.org
  2. 使用类型申明文件来源于这位博主的文章-thx for 初心http://blog.csdn.net/z_sherry/article/details/64920239