如何编写Typescript插件?

编程入门 行业动态 更新时间:2024-10-27 23:19:46
本文介绍了如何编写Typescript插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

是否有编写Typescript插件的文档/示例?

Are there any docs / examples of writing a Typescript plugin?

上一次我很受启发将Typescript引入我的项目的想法。但是,目前我发现这是不可能的,因为我的失败尝试找到有关编写Typescript插件的文档。我需要这个插件来在编译期间组合类元数据,然后生成资产。这并不容易,但我已经已经写过了a href =babeljs.io =nofollow noreferrer> babel 现在我很感兴趣,如果可以对Typescript做同样的事情。

For the last time I am very inspired with the idea of bringing Typescript into my projects. However, currently I see this is not possible because of my failed attempts to find any docs about writing a Typescript plugin. I need this plugin for combining classes metadata during compilation and then generating an asset. It was not that easy but I've already written such for babel and now I am interested if it is possible to do the same with Typescript.

推荐答案

您可以下载 github/ microsoft / typescript 或通过npm。

You can download github/microsoft/typescript or via npm.

npm install typescript

然后将它包含到您的项目中并通过编译器API 或 TypeScript语言服务使用TypeScripts代码。如果需要,您可以编写自己的编译器。维基上描述了基础知识。

Then include it into your project and via Compiler API or TypeScript Language Service work with TypeScripts codes. You can write your own compiler if you need. Basics are described on the wiki.

github/Microsoft/TypeScript/wiki/Using-the-Compiler-API github/Microsoft/TypeScript/wiki/Using-the-Language-Service-API

更多推荐

如何编写Typescript插件?

本文发布于:2023-07-23 19:30:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1199682.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:插件   Typescript

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!