Why Deno will stop using TypeScript

栏目: IT技术 · 发布时间: 5年前

内容简介:A document surfaced today pointing that Deno will stop using TypeScript in its internal code, citing several problems with the current environment. Issues mentioned involve TypeScript compiling times, structuring and code organization, among others. Moving

A document surfaced today pointing that Deno will stop using TypeScript in its internal code, citing several problems with the current environment. Issues mentioned involve TypeScript compiling times, structuring and code organization, among others. Moving forward, Deno will use pure JavaScript for its internal code.

Deno problems with TypeScript

The unfavorable situations that the Deno team is currently experiencing while usingTypeScript for its internal code are:

  • TypeScript compile time when changing files takes several minutes, making continuous compiling an excruciatingly slow process
  • The Typescript structure that they’re using in the source files that create the actual Deno executable and the user-facing APIs is creating runtime performance problems
  • TypeScript isn’t proving itself helpful to organize Deno code. On the contrary, the Deno team is experiencing the opposite effect. One of the issues mentioned is that they ended up with duplicate independent Body classes in two locations https://github.com/denoland/deno/issues/4748
  • The internal code and runtime TypeScript declarations must be manually kept in sync since the TypeScript Compiler isn’t helpful to generate the d.ts files
  • They’re maintaining two TS compiler hosts: one for the internal Deno code and another other for external user code even though both have a similar goal

Removing TypeScript in internal Deno code

TheDeno team aims to remove all build-time TS type checking and bundling for internal Deno code. They’re looking forward to move all the runtime code into a singleJavaScript file. However, they’ll still use a companion d.ts file to keep the type definitions and documentation.

It’s worth mentioning that Deno will stop using TypeScript only for the internal Deno code: the Deno user code will still be in TypeScript and thus type checked.

While TypeScript is sometimes seen as an improved version of JavaScript, this case is showing that in fact, it’s not. It has flaws like any other language. One of the most important ones is its slow compilation time. While small projects might not see a huge spike in compilation time when switching from pure JavaScript to TypeScript, it will be noticeable in large projects like a complexReact app. Given the large size of its runtime, it’s not surprising that Deno will stop using TypeScript.

The safety of type checking during development does have its cost at compilation time. It’s not without reason that the TypeScript project has an extensive document on how to address and improve compilation time . One of the most interesting approaches is to use Project References , that allows developers to break apart a big TypeScript piece of code into smaller pieces.

Read more about why Deno will stop using TypeScript

The complete discussion about the decision to drop TypeScript from the internal Deno code and use JavaScript instead can be found in this document , where Ryan Dahl and collaborators discuss the problem, its solution, and how it’s going to be implemented.


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

计算几何

计算几何

周培德 / 2008-7 / 69.00元

《计算几何:算法设计与分析(第3版)》系统地介绍了计算几何中的基本概念、求解诸多问题的算法及复杂性分析,概括了求解几何问题所特有的许多思想方法、几何结构与数据结构。全书共分11章,包括:预备知识,几何查找(检索),多边形,凸壳及其应用,Voronoi图、三角剖分及其应用,交与并及其应用,多边形的获取及相关问题,几何体的划分与等分、算法的运动规划、几何拓扑网络设计、随机几何算法与并行几何算法等。一起来看看 《计算几何》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

html转js在线工具
html转js在线工具

html转js在线工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具