Reputation: 21304
I have an Angular
app where I'm using npm
and typings
to manage pulling down my type definition files .d.ts
for TypeScript
. However I have a few .d.ts
files that don't exist in typings
and are either hand rolled or downloaded from an alternate source manually.
From a project structure perspective, how should I manage these outsider type definition files in the project? Is it correct to just add them manually to the typings/global
folder, and then add a reference to index.d.ts
, or is this problematic and these should be placed separately in a segregated spot away from the files managed by typings
?
Upvotes: 2
Views: 551
Reputation: 37918
One of the options would be pointing typings.json to your custom definitions file. For example having the following folder structure:
/typings
/custom
hand-rolled.d.ts
/global
...
typings.json will have reference pointing to file system:
"globalDependencies": {
"hand-rolled": "file:typings/custom/hand-rolled.d.ts"
}
You'll not need manually add a reference to index.d.ts. And you can check in typings/custom
into source control.
Upvotes: 5
Reputation: 13196
IMHO you shouldn't be adding your own type declarations to the typings
folder, because unless I am mistaken you are not meant to check the typings
folder into source control - the same way you don't check-in your node_modules
.
It's up to you how you want to structure your typings, but it would make sense to physically separate ambient/global and external modules.
Also - why not contribute your type declarations to the project you have created them for or the typings
registry?
Upvotes: 3