Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Use Visual Studio Code Development TypeScript     - Linux settings Java_home (Linux)

- You can not ignore the seven Git tips (Linux)

- Oracle 12C modify spfile path (Database)

- Java filter (Programming)

- PLSQL Developer synchronization table tools (Database)

- To install Docker under CentOS7 (Linux)

- Several start-up mode of Tomcat (Server)

- After VMware CentOS full VM clone the network card is unavailable Solutions (Linux)

- The practical application of Oracle synonyms + dblink (Database)

- Use Linux built-in firewall to improve network access control (Linux)

- Oracle archive log full cause abnormal slow database performance (Database)

- Use the dd command to the hard disk I / O performance test (Linux)

- Use Python automatically cleared Android Engineering excess resources (Programming)

- Getting Started with Linux system to learn: how to install autossh (Linux)

- Using Android Studio integrated development environment to build Android (Linux)

- Linux system man help tips (Linux)

- High-performance JavaScript DOM programming (Programming)

- Java loop list to solve the problem of Joseph ring (Programming)

- Each catalog Detailed Linux (Linux)

- CentOS 7 virt-manager can not connect a local hypervisor (Linux)

 
         
  Use Visual Studio Code Development TypeScript
     
  Add Date : 2018-11-21      
         
         
         
  Note

In accordance Benpian implementation steps, you can in the "Windows", "OS X" operating system, developed using Visual Studio Code TypeScript.

Foreword

In order to solve JavaScript: Missing object-oriented syntax, the lack of error checking during compilation ... and so on. Microsoft provides an open source TypeScript language, allowing developers to use object-oriented code written TypeScript, followed by TypeScript code compiler will be compiled into JavaScript code, you can build a JavaScript compiled checking code to provide a platform use.

This article describes how to "Windows", "OS X" operating system, through the Visual Studio Code TypeScript development tool, so that no budget purchase the developer tools, it is possible to learn TypeScript syntax. Mainly as to leave a record, but also want to help the needy developers.

Install Node.js

First install Node.js, follow-up can be installed using the NPM TypeScript Compiler tool. The Node.js installer, Node.js can be downloaded from the official website.

Installation TypeScript Compiler

Bahrain Node.js, then you can use to install TypeScript Compiler NPM, then you can see through to the Compiler will TypeScript compiled into JavaScript. Developers use the Command Prompt (or terminal), enter the following command to complete the TypeScript Compiler installation.

npm install -g typescript


Update TypeScript Compiler

View a step on the installed TypeScript Compiler, you will find that the installed version is 1.4.1. But because the next steps required to Version 1.5.0 added new features, developers also use the Command Prompt (or terminal), enter the following command to update TypeScript Compiler to version 1.5.0 and above.

npm update -g typescript

Remove an environment variable (Windows only)

Computer Some developers may have been previously installed TypeScript tools, these tools will be added to the installation path TypeScript Compiler in the Windows environment variable. In order to unify the use of NPM to manage TypeScript Compiler version, developers need to manually remove the installation path TypeScript Compiler from the environment variable:

C: \ Program Files (x86) \ Microsoft SDKs \ TypeScript \ 1.0 \

Install Visual Studio Code

Bahrain TypeScript Compiler, and then install Visual Studio Code, after the program code will be able to develop TypeScript through Visual Studio Code. Visual Studio Code and installer can be downloaded from the Visual Studio Code official website.

Development TypeScript

Establish Workspace

After the installation is complete, open the Visual Studio Code, and select a folder as a development TypeScript working folder (Workspace).

Establish tsconfig.json

Then add a new file in the Workspace "tsconfig.json", and enter the following JSON set parameters.

{
    "CompilerOptions": {
        "Target": "es5",
        "NoImplicitAny": false,
        "Module": "amd",
        "RemoveComments": false,
        "SourceMap": true
    }
}

Establish .settings \ tasks.json

Workspace also joined again in a new folder ".settings" and add a new file "tasks.json" in this folder, then enter the following JSON set parameters.

{
    "Version": "0.1.0",
    "Command": "tsc",
    "IsShellCommand": true,
    "ShowOutput": "always",
    "Args": [ "-p", "."],
    "ProblemMatcher": "$ tsc"
}

Development main.ts

After completing the above steps to add a new file in the Workspace "main.ts", and enter the following TypeScript code.

class Greeter {
    data: string;

    constructor (data: string) {
        this.data = data;
    }

    run () {
        alert (this.data);
    }
}

window.onload = () => {
    var greeter = new Greeter ( "Clark");
    greeter.run ();
};

Finally, press the shortcut key "Ctrl + Shift + B", you can see Visual Studio Code compiled TypeScript, and outputs the corresponding JavaScript file: main.js.

var Greeter = (function () {
    function Greeter (data) {
        this.data = data;
    }
    Greeter.prototype.run = function () {
        alert (this.data);
    };
    return Greeter;
}) ();
window.onload = function () {
    var greeter = new Greeter ( "Clark");
    greeter.run ();
};
// # SourceMappingURL = main.js.map
     
         
         
         
  More:      
 
- Realization of Linux operating system illegal IP censorship (Linux)
- Linux systems dmesg command processing failures and system information collected seven usage (Linux)
- Servlet life cycle code examples (Programming)
- On event processing browser compatibility notes (Programming)
- IOwait Linux system monitoring diagnostic tools (Linux)
- Ubuntu 14.04 installation and configuration environment variable JDK1.8.0_25 (Linux)
- Linux command line to put on your coat GUI (Linux)
- Resolve the host via KVM console can not connect clients (Linux)
- OpenGL Superb Learning Notes - Fragment Shader (Programming)
- Automatic batch resolve dependencies problem locally installed rpm package (Linux)
- Android imitation UC browser scroll up and down functions (Programming)
- CentOS 6.4 Python 2.6 upgrade to 2.7 (Linux)
- Logging information through the web GUI (LogAnalyzer) (Server)
- Seven kinds of NIC binding mode Detail (Linux)
- Linux for enterprises to build a firewall (Linux)
- To install the Contiki development toolchain on Ubuntu (Linux)
- count (*) function in MySQL optimization of InnoDB storage engine (Database)
- Nginx load balancing configuration (TCP proxy) (Server)
- Struts2 interceptor simulation (Programming)
- Oracle 12C RAC on temporary table space Enlighten (Database)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.