How to write a typescript library

I was a bit annoyed when googling for the topic. After a while when I had scratched together all the information, discarded the outdated one and inserted the missing bits, I decided to spread the knowledge. I went forward and created! Check it out.

You can also skip the tutorial and find the final demo library on github under, but I’d really recommend reading the tutorial or at least skimming the tutorial!

A short summary, sort of just like the ‘diff to a normal project’ would be this:

  • Add declaration: true to tsconfig.json
  • Export public parts via index.ts
  • Create a package.json, with the name your library should later have
  • Configure .npmignore
  • run npm publish