当前位置:网站首页>This article will show you what typescript is
This article will show you what typescript is
2022-07-23 23:13:00 【Underwater barbecue shop AI】
Catalog
One 、JavaScript The biggest problem
The most common types of errors written by programmers can be described as Type error : A certain type of value is used where different types of values are expected . This may be due to a simple spelling mistake 、 Unable to understand the Library API The surface of the 、 Wrong assumptions about runtime behavior or other errors .
Use JavaScript The most prominent problem in writing code is type checking : because JavaScript yes Weak type language , Most users can only use the code Operation phase To find the wrong type , This makes the error can not be found and repaired in time , It has buried hidden dangers for future development .
JavaScript No ability to express the relationship between different code units . combination JavaScript Quite strange Runtime semantics , This mismatch between language and program complexity makes JavaScript Development has become a difficult task to manage on a large scale .
TypeScript The goal is to be JavaScript programmatic Static type checker —— let me put it another way , Is a tool that runs before the code runs ( static state ) And make sure the type of program is correct ( Type checking ), So that we can find the type error problem in time in the code writing stage .
Two 、 What is? TypeScript
TypeScript Is a free and open source programming language developed by Microsoft . It is JavaScript One of the Superset , And it essentially adds optional static typing and class-based object-oriented programming to the language .
TypeScript It's a very popular kind of JavaScript Language extension . It's in the existing JavaScript A type layer is added to the syntax , And even if this layer is deleted , It will not affect the original performance of the runtime . Many people think that TypeScript “ Just a compiler ”, But a better understanding is to put TypeScript As two separate systems : compiler ( That is, the part dealing with grammar ) and Language tools ( That is, dealing with the part integrated with the editor ).
3、 ... and 、JS , ES , TS The relationship between
1995 year :JavaScript Be born
Netscape at that time was relying on its
NavigatorBrowser becomesWebThe most famous first generation Internet company when the era opened .Because Netscape wants to be static
HTMLAdd some dynamic effects to the page , therefore Brendan Eich It was designed in two weeksJavaScriptLanguage .It's called
JavaScript, The reason is that at that timeJavaLanguage is very popular , Just want to rub a wave of heat , actuallyJavaScriptExcept in grammarJava, The rest of it doesn't matter .1997 year :ECMAScript Be born
Because Netscape was developed
JavaScript, A year later, Microsoft imitatedJavaScriptDevelopedJScript, In order to makeJavaScriptBecome a global standard , Several companies are unitedECMA(European Computer Manufacturers Association)( European Association of computer manufacturers ) The organization has developedJavaScriptThe standard of language , go by the name ofECMAScriptstandard .2015 year :TypeScript Be born
TypeScriptyesJavaScriptSuperset ( It will eventually be compiled asJavaScriptCode ), Which containsJavaScriptAll elements of , Can runJavaScriptCode for , And expandedJavaScriptThe grammar of . Compared withJavaScript, It also adds static types 、 class 、 modular 、 Functions in interface and type annotation , Easier to develop large projects .TypeScriptProvide up-to-date and evolvingJavaScriptcharacteristic , Including those from 2015 Year ofECMAScriptAnd features in future proposals , For example, asynchronous function andDecorators, To help build robust components .
Sum up the relationship between the three in one sentence :ECMAScript Standard language ,JavaScript yes ECMAScript The implementation of the ,TypeScript yes JavaScript Superset .


Four 、 Why use TypeScript
TypeScript Expanded JavaScript, Provide powerful Type checking and Grammar tip function , Combination such as VS code This kind of compiler , Can greatly improve the development efficiency , Reduce the maintenance cost in the later stage of the project :


边栏推荐
- 糖尿病遗传风险检测挑战赛进阶
- Extract any page number in PDF file with itextpdf
- 浅析基于NVR技术的视频能力与未来发展趋势
- Wechat applet implements a global event bus by itself
- TAP 系列文章9 | 应用开发加速器
- Build your own target detection environment, model configuration, data configuration mmdetection
- Absl tutorial (4): strings Library
- Merge.Avhd into.Vhd manually in Hyper-V
- ES6箭頭函數的使用
- 砺夏行动 2022|源启数字化圆桌论坛即将上线
猜你喜欢

Linked list - 203. remove linked list elements

Three network modes of VMware virtual machine

After reading this article, thoroughly understand grpc!

Tap series article 7 | easy to manage pipeline configuration

Tap series article 4 | backstage based tap developer portal

TAP 系列文章9 | 应用开发加速器

Build your own target detection environment, model configuration, data configuration mmdetection

Preparation for raspberry pie 3B serial port login

The ultimate experiment of OSPF -- learn the example of OSPF century template

疑似未系安全带 林志颖伤势相对稳定
随机推荐
礪夏行動|源啟數字化:既有模式,還是開源創新?
1、 Simplification of digital logic
Stm32f4 check the frequency of each part of the system
疑似未系安全带 林志颖伤势相对稳定
Grey prediction (matlab)
QT set cache and compile output path
The font of Siyuan notes is thinner and lighter than that in other editors (atom, VSC, sublime)
Inspiration from Buffett's shareholders' meeting 2021-05-06
糖尿病遗传风险检测挑战赛Baseline
TAP 系列文章4 | 基于 Backstage 的 TAP 开发者门户
浅析基于NVR技术的视频能力与未来发展趋势
Rails搭配OSS最佳实践
Programming in the novel [serial 16] the moon bends in the yuan universe
mysqlbinlog命令介绍(远程拉取binlog日志)
Array -- 27. remove elements
[web vulnerability exploration] SQL injection vulnerability
【Matplotlib绘图】
Tap series article 9 | application development accelerator
Programming in the novel [serial 17] the moon bends in the yuan universe
ES6 other syntax and extended syntax summary