“This is the fifth day of my participation in the August More Text Challenge. For details, see: August More Text Challenge.”

preface

It’s Viruss again with a new column. Let’s play with typescript! (Ps: The five-minute daily Impact Python Basics tutorial is constantly being updated…………. Don’t rush me to update it! Or I get a little grumpy.

What is a typescript

TypeScript is an open source programming language developed by Microsoft and built by adding static typing definitions to JavaScript. TypeScript is translated into JavaScript code via the TypeScript compiler or Babel that runs on any browser and any operating system. TypeScript adds many new ECMAScript features (such as decorators) that have not yet been officially released. Microsoft released the first public version of TypeScript in October 2012, and made TypeScript official on June 19, 2013, after a preview. The latest version is TypeScript 4.0

Simply put, typescript is a superset of type + javascript.

Find out who did it

TypeScript was written by anders hejlsberg, the chief architect of C#. It is an open source and cross-platform programming language. It is a superset of JavaScript and essentially adds optional static typing and class-based object-oriented programming to the language.

TypeScript extends JavaScript’s syntax, so any existing JavaScript program can run in TypeScript.

TypeScript is designed for large-scale application development and can be compiled to JavaScript.

TypeScript supports header files that add type information to existing JavaScript libraries, extending its support for popular libraries such as jQuery, MongoDB, Node.js, and d3.js. The type definitions for these third-party libraries are themselves open source, and all developers can contribute.

The main features

TypeScript is a language extension that adds features to JavaScript.

Type annotation and compile-time type checking

Low class

Low interface

Low module

Low decorator

Syntactically, TypeScript is similar to JScript.NET, another Microsoft implementation of the ECMAScript language standard that adds support for static typing and classic object-oriented language features like classes, inheritance, interfaces, and namespaces.

(ps: See typescript for more details)

Installation environment

Node.js and VS Code need to be installed

1. Install node.js (Nodejs.org/)

When the installation is complete, test whether it has been installed.

Win + R to run, enter CMDRun the node -v NPM -v command to check whether the installation is successful

Install typescript (-g must be included)

Enter NPM install typescript -g on the command line

3. Install vscode (select according to your computer system)

Write a demo to test whether Node.js and VScode are successfully installed and compiled

Create a new file and name it demo.ts

Writing test codeI’m going to run the TS file with terminalAfter entering the command, a compiled JS file is generatedEnter the command to see the effect

If you want a command, compile and run it.

Run the NPM install -g ts-node command to install the plug-inThen enter the ts-node program name in the program to see the effect

Note: If encountered when running TS-NodeSolution: Click here in the lower right corner and create a new tsconfig.json fileThen save the file directly.

conclusion

Typescript is gaining momentum. The other day, typescript made it into the top 10 programming languages, so learn now. Welcome to follow my course to learn oh! If you think my article is ok, please give me a thumbs up or a thumbs-up. (PS: After all, code words really tired!)