如何从另一个(开发时)程序访问 TypeScript 中的类型信息?
How do I get an access to type information in TypeScript from another (development-time) program?
我想获取 TypeScript 中函数参数类型的列表。正如 Google 搜索结果一目了然,TypeScript 缺乏 Java 类反射。我认为可能会有某种编译器 API 来获取此类数据以满足 IDE 开发需求等,但我发现 none.
那么如何从另一个程序(构建工具、lint 等)访问 TypeScript 中的类型信息?
I've thought there could be some kind of compiler API to get such data for IDE development needs etc., but I've found none.
它叫做 "TypeScript Language Service"。有它的文档:https://github.com/Microsoft/TypeScript/wiki/Using-the-Language-Service-API
我还有一个使用它的 OSS 项目:https://atom.io/packages/atom-typescript that has stuff like an AST viewer and a quickfix architecture : https://github.com/TypeStrong/atom-typescript/blob/master/CONTRIBUTING.md#quickfix
还有一本书,里面有一些编译器文档http://basarat.gitbooks.io/typescript/content/docs/compiler/overview.html
我想获取 TypeScript 中函数参数类型的列表。正如 Google 搜索结果一目了然,TypeScript 缺乏 Java 类反射。我认为可能会有某种编译器 API 来获取此类数据以满足 IDE 开发需求等,但我发现 none.
那么如何从另一个程序(构建工具、lint 等)访问 TypeScript 中的类型信息?
I've thought there could be some kind of compiler API to get such data for IDE development needs etc., but I've found none.
它叫做 "TypeScript Language Service"。有它的文档:https://github.com/Microsoft/TypeScript/wiki/Using-the-Language-Service-API
我还有一个使用它的 OSS 项目:https://atom.io/packages/atom-typescript that has stuff like an AST viewer and a quickfix architecture : https://github.com/TypeStrong/atom-typescript/blob/master/CONTRIBUTING.md#quickfix
还有一本书,里面有一些编译器文档http://basarat.gitbooks.io/typescript/content/docs/compiler/overview.html