Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi @alanhoff,
I'm using your library with Typescript, so I thought I would take a bash at writing a Typescript declaration file for portastic.
If you'd like, you could take this PR, and future TS users of portastic (who just
npm install portastic
as normal) will get to use the typing information provided here without any extra effort. Some tools/IDE's (like VSCode) will even provide typing assistance to normal JS users of the library based on this definition file.Of course, the downside is that ideally the
index.d.ts
declaration needs to be kept up to date as you change your library, otherwise you will have some very confused TS users ;). I hope you feel the maintenance burden is acceptable - even if you don't know TS at all I imagine you can glance over the definition and not be too surprised about what is going on!If that sounds like too much trouble, I can submit these definitions to DefinitelyTyped, which is a seperate repository of typing information. TS users will still be able to get types by doing:
The beauty of taking this PR instead is that the types can be versioned and kept in sync with the project.
You can read more about this whole thing from the official TS guide here.
Cheers!