简体   繁体   English

在Visual Studio中生成单独的.js文件,但使用Typescript合并了.d.ts文件

[英]Generate separate .js files but merged .d.ts files with Typescript in Visual Studio

As far as I can understand, I cannot have the Typescript settings in Visual Studio to generate separate .js files for each .ts file and at the same time generate ONE merged .d.ts file. 据我了解,我无法在Visual Studio中使用Typescript设置来为每个.ts文件生成单独的.js文件,而不能同时生成一个合并的.d.ts文件。

With the current settings, both the .js and the .d.ts are either merged or separate. 使用当前设置,.js和.d.ts可以合并或分开。

Am I missing some obvious setting? 我是否缺少一些明显的设置?

Have you seen dts-bundle ? 你见过dts-bundle吗? You can use this to generate a single .d.ts file which contains an external module. 您可以使用它生成包含外部模块的单个.d.ts文件。 You can then distribute the generated definition file alongside your transpiled library code, so that consuming typescript applications have access to the type definitions of your library. 然后,您可以将生成的定义文件与已编译的库代码一起分发,以便使用中的打字稿应用程序可以访问您的库的类型定义。

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

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