Authoring TypeScript/JavaScript libraries

Endel Dreyer
1 min readMar 15, 2017

TLDR: Check out a simple and productive template for authoring libraries with browser testing: https://github.com/endel/library-template.ts

At exactly one year ago, André Staltz wrote about why all JavaScript libraries should be authored in TypeScript. I must admit I wasn’t a TypeScript believer at that time.

A lot has changed since then. TypeScript ecosystem evolved like crazy. Today, If I have the opportunity to choose between writing pure JavaScript or TypeScript, I’d choose TypeScript without a doubt. Excellent tooling and less error-prone.

I love TypeScript because it lets you write whatever style you want. Don’t want to use property and method access level (public, private, protected)? Fine. Don’t want to explicitly type everything? Fine. Using an external node module without type definitions for it? Fine (didn’t used to be). Even if your code doesn’t compile, it’s also fine - your JavaScript output can be generated anyway.

Using this template you can author your own TypeScript/JavaScript libraries with ease: https://github.com/endel/library-template.ts

It has as little configuration as possible for testing on browser and node environments.

I’d encourage you to start developing, and more importantly — authoring your libraries — using TypeScript.

🚀🚀🚀

--

--

Endel Dreyer

Creator of Colyseus Multiplayer Framework — Expert on TypeScript/JavaScript, HTML5 and Node.js