Skip to content
This repository has been archived by the owner on Apr 30, 2019. It is now read-only.

Added custom.d.ts files #199

Closed
johnpapa opened this issue Aug 8, 2015 · 9 comments
Closed

Added custom.d.ts files #199

johnpapa opened this issue Aug 8, 2015 · 9 comments
Labels

Comments

@johnpapa
Copy link

johnpapa commented Aug 8, 2015

I've got a few custom d.ts files that I'd like to add to the typings folder. Works good. I want to be able to gitignore the typings folder and have not just the regular typings come back but also my custom one.

Is there a feature to allow loading a custom d.ts file from another location? Or to have tsd.json point to a subfolder or some other way to differentiate?

@blakeembrey
Copy link
Member

@johnpapa That's no way to do that right now, but it's the aim for the next version of TSD. For now, I tend to store custom d.ts files somewhere else in the project and use tsconfig.json to reference them and tsd.d.ts. Does that answer your question somewhat?

@johnpapa
Copy link
Author

johnpapa commented Aug 9, 2015

how are you referencing 2 sets of typings?

@blakeembrey
Copy link
Member

You can reference as many as you want using the files array in tsconfig.json or /// <reference ...>. Here's an example from a library I wrote: https://github.com/blakeembrey/popsicle/blob/master/tsconfig.json#L11-L30. lib/typings is my custom ones and typings/tsd.d.ts is for ones that were installed using TSD.

@johnpapa
Copy link
Author

johnpapa commented Aug 9, 2015

Ah, I use empty files array as It would be insane to keep up with all of the files :)

I guess custom typings can go anywhere with that strategy. It would be nice to have a safe place to put them, such as a sub folder in typings for custom ones. I am thinking of moving them to a side folder for custom typings.

@blakeembrey
Copy link
Member

You don't need all the files in the array, just the entry points, but I understand it gets to be a bit of a pain (especially with test files). A safe place can be anywhere in your app, I want to try keeping custom d.ts files out of the typings/ directory in the future because it makes things like this complicated for no reason. For now, you can put them anywhere but I'd recommend creating a secondary typings structure for your own stuff.

@johnpapa
Copy link
Author

johnpapa commented Aug 9, 2015

Yet another folder is just more mess. I think the location of a folder to exclude from normal automated typings makes sense. typings/custom by default but use tsconfig.json to set it up. Otherwise we have yet another folder

On that note ... I'd love to see tsd.json go away and become a section of tsconfig.json. #200

@blakeembrey
Copy link
Member

Perhaps, but then you'll have to just set up your gitignore rules and everything else yourself. When I first started working with TSD I used typings/_custom for my own typings, but it doesn't really scale. It's kind of like putting modules you wrote but didn't open source in node_modules/_custom. Right now it's not an issue, in future versions of TSD it might be. In any case, it doesn't stop you from doing it already.

As for merging it into tsconfig.json, I think it's a great idea. I'll look at doing that for the next version. However, future versions of TSD will need the file to look up references correctly, so you'll need to publish tsconfig.json with your module. I don't think that technically changes anything, just a note.

@johnpapa
Copy link
Author

johnpapa commented Aug 9, 2015

the real solution is NOT to have custom d.ts but to get the in this repo, I guess. lol

@johnpapa
Copy link
Author

johnpapa commented Aug 9, 2015

and yeah, i'm good thanks for hashing it out

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants