Publishing a TypeScript Library

Michele Riva
openmind
Published in
5 min readJun 9, 2019

--

TypeScript is awesome! As seen in the previous article, it can really help improving our code quality and avoiding a wide range of runtime errors.
For that reason, a lot of JavaScript libraries are actually written in TypeScript: Rx.js, Svelte, Angular and many more.

But as you may know, TypeScript needs to be compiled down to JavaScript in order to work on both browsers and servers. So what do we need to do in order to publish our library to npm?

Create your library

Let’s start with the obvious: initialize your library!
We’ll build a simple library called JScream, which will just transform any sentence into a “scream”.

Pretty useless I know, but we need to focus on how to publish and test it the right way!

--

--