1

我正在用打字稿编写一个凉亭包,该包将在内部使用。它引用了诸如 angular 之类的库中的一些 boered,并且这些类型的类型是使用类型化获得的,并且是绝对类型化的。它还引用了一些也包含在其中的内部库。

目前,我可以看到我的 bower 包需要在 index.d.ts 文件中包含我的 js 和我的类型。我知道任何使用我的包的人都需要进行类型安装以获取角度等的类型,但是我该怎么做内部库的类型呢?我怎样才能让它变得容易?

我有这样的事情:

MYBowerComponent
|_ bower_components
   |_ angular
   |_ inhousecomponent1
   |_ inhousecomponent2
   |_ inhousecomponent3
|_ dist
   |_ my_bower_component.js
   |_ index.d.ts
   |_ bower.json
|_ app
   |_ (a load of ts code)
   |_ app.ts
   |_ references.ts
|_ typings
   |_ globals
      |_ (angular etc)
   |_ index.d.ts

其中 app/references.ts 包括对 inhousecomponent1、inhousecomponent2 和 inhousecomponent3 的任何引用以及对 typings/index.d.ts 的引用。dist/index.d.ts 包括我的 js 的类型。

从广义上讲,我可以看到答案是 a) 以某种方式允许消费者安装我内部库的类型或 b) 将 reference.d.ts 的内容包含在 dist/index.d.ts 中。

a) 可能吗?如果 b) 是推荐的方法,我该如何处理引用中的相对路径?或者,还有更好的方法?

谢谢,

亚当

4

0 回答 0