How to write a Typescript plugin?

萝らか妹 提交于 2020-01-13 20:17:25

问题


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


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.


回答1:


You can download https://github.com/microsoft/typescript or via npm.

npm install typescript

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.

https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API https://github.com/Microsoft/TypeScript/wiki/Using-the-Language-Service-API



来源:https://stackoverflow.com/questions/40513148/how-to-write-a-typescript-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!