简体   繁体   English

合并/检索打字稿声明文件

[英]Combine/retrieve typescript declaration files

I have a TypeScript typings project containing several *.d.ts files. 我有一个包含多个* .d.ts文件的TypeScript类型项目 This is a set of 'global' declarations (ie named modules). 这是一组“全局”声明(即,命名模块)。 I use typings to pull the declaration files from that typings project into a TypeScript project. 我使用类型将声明文件从该类型项目中拉到TypeScript项目中。

typings install github:phreed/typed-npm-webgme -SG

The resulting typings/globals/index.d.ts only contains the file identified as the "main" in typings.json . 产生的typeings / globals / index.d.ts仅包含在types.json中标识为“主要”的文件 I expect it to include (concatenate) all of content of the "files" appearing in the tsconfig.json . 我希望它包括(连接)出现在tsconfig.json中的“文件”的所有内容。

How do I cause typings/globals/index.d.ts to contain the concatenation of the *.d.ts files? 如何使types / globals / index.d.ts包含* .d.ts文件的串联?

There is a 'files' field where additional declaration files can be indicated. 有一个“文件”字段,可在其中指示其他声明文件。 Here is an example of the 'typings.json' file. 这是'typings.json'文件的示例。 json { "name": "foo", "main": "foo.d.ts", "files": [ "./bar.d.ts", "./baz.d.ts", "./froz.d.ts", "./fig.d.ts"], "global": true, "dependencies": { }, "devDependencies": {}, "globalDependencies": { "q": "registry:dt/q#0.0.0+20160613154756" }, "globalDevDependencies": { } } The git repository (assume github) holds these *.d.ts files separately. json { "name": "foo", "main": "foo.d.ts", "files": [ "./bar.d.ts", "./baz.d.ts", "./froz.d.ts", "./fig.d.ts"], "global": true, "dependencies": { }, "devDependencies": {}, "globalDependencies": { "q": "registry:dt/q#0.0.0+20160613154756" }, "globalDevDependencies": { } } git存储库(假设github)分别保存了这些* .d.ts文件。 When installed, using typings install github:foo/foo --save --global 安装后,使用typings install github:foo/foo --save --global

  • retrieves and concatenates the '*.d.ts' files into 'typings/globals/foo/index.d.ts'. 检索“ * .d.ts”文件并将其串联到“ typings / globals / foo / index.d.ts”中。
  • updates 'typings/globals/foo/typings.json' with the package typings information. 使用包类型信息更新“ typings / globals / foo / typings.json”。
  • updates 'typings/index.d.ts' with '/// <reference path="globals/foo/index.d.ts" /> 用'/// <参考路径=“ globals / foo / index.d.ts” />更新'typings / index.d.ts'
  • updates 'globalDependencies' in 'typings.json' with "foo": "github:foo/foo" 用“ foo”更新“ typings.json”中的“ globalDependencies”:“ github:foo / foo”

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

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