As TypeScript is implementing a great number of the ES6 (ECMAScript6) standards, it is important to stay up-to-date with the latest specification updates.
In particular, the module feature is getting central for all framework and libraries developers (me included), who need to be able to package properly their code. and thus how to correctly use them in TypeScript.
If you are using Travis CI to automate the build of a TypeScript, that’s a problem you probably encountered. As Travis CI can allow you to automatically build in various environment, TSD is hitting hard on the GitHub API, which can cause the “GitHub rate limit reached” message to appear.
The solution is quite simple, you’ll have to create a GitHub token and add it in Travis as an environment variable. This tutorial will also work with any build automation system that support environment variables.
The challenge is to properly package the typing information from your TypeScript code, that may get lost in the process if you don’t do it the right way.
That’s why I decided to put together the information I gathered while addressing the issue.
In this tutorial, I will explain the easiest way to package some TypeScript code into a node module, preserving all the typing information from the source code, without using any third-party tool.
You can download the full sample project on my GitHub repo. It is a working example of a TypeScript package.