简体   繁体   English

从TypeScript定义文件生成其他JS“编译器”的定义?

[英]Generate definition for other JS “compilers” from TypeScript definition file?

Given a TypeScript definition file, is there any (automated/quick/easy) way to "convert" this definition so it will work with other JavaScript compilers? 给定TypeScript定义文件,是否有任何(自动/快速/简单)方式可以“转换”此定义,以便它可与其他JavaScript编译器一起使用?

I realize there are a ton of "JavaScript compilers" out there, but the goal is to determine which are the most popular and be able to provide definition files for those frameworks. 我意识到那里有大量的“ JavaScript编译器”,但目标是确定最流行的JavaScript编译器并能够为这些框架提供定义文件。

is there any (automated/quick/easy) way to "convert" this definition so it will work with other JavaScript compilers 是否有任何(自动/快速/简单)方式可以“转换”此定义,因此它可以与其他JavaScript编译器一起使用

No. And considering the still active development in the TypeScript land it would be a non trivial task to have such a thing without active maintainence. 不会。考虑到TypeScript领域仍在积极发展中,如果没有积极的维护就拥有这样的东西将不是一件容易的事。 Consider the simple case of union types (eg string | number ) which was unsupported by some custom TypeScript parsers for a few months. 考虑union类型(例如string | number )的简单情况,这种情况几个月来一直不受某些自定义TypeScript解析器的支持。

Now the moving target is ES6 module syntax support 现在移动目标是ES6模块语法支持

Soon : others https://github.com/Microsoft/TypeScript/wiki/Roadmap 不久:其他https://github.com/Microsoft/TypeScript/wiki/Roadmap

You would have to pick one other Compile to JS language that also has TypeSafety (that rules out coffeescript) and start hacking away at it. 您将不得不选择另一种也具有TypeSafety(可以排除coffeescript)的Compile to JS语言,然后开始对其进行破解。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM