Giter Site home page Giter Site logo

typescript's Introduction

一、概述

  • TypeScript 语言用于大规模应用的JavaScript开发。
  • TypeScript 支持类型,是JavaScript的超集且可以编译成纯JavaScript代码。
  • TypeScript 兼容所有浏览器,所有宿主环境,所有操作系统。
  • TypeScript 是开源的。
  • TypeScript 文件后缀名为.ts

二、安装

$ npm install typescript
$ yarn add typescript

查看版本:

$ ./node_modules/.bin/tsc --version
Version 3.7.2

三、编译

1. 在线编译

http://www.typescriptlang.org/play/index.html

2. tsc

# 编译文件
$ ./node_modules/.bin/tsc index.ts  --outfile index.js
# 编译目录
$ ./node_modules/.bin/tsc ./ts  --outfile ./js

3. vscode

  1. 首先在工程首页自定义 -> 工具和语言中 选择 "Typescript" 进行安装

  2. 在终端中进入项目,通过 tsc -init 创建 " tsconfig.json" 文件

  3. 配置如下:

    {
      "compilerOptions" : {
        "target": "es5", // 编译目标平台
        "outDir": "./",    // 输出目录
      }
    }
  4. 输入快捷键 ctr/cmd + shfit + b 选择任务进行编译

typescript's People

Contributors

lihongyao avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.