Essay - Published: 2020.06.22 | javascript | p5js | typescript |
DISCLOSURE: If you buy through affiliate links, I may earn a small commission. (disclosures)
I've been building a lot of projects with p5js (the javascript port of the Processing creative coding library, see: prickly and vicidual) lately and wanted to start using Typescript so that I could get the benefits of static typing in my projects.
So I started gathering info and trying out what other people were doing for similar problems in the modern web dev ecosystem and this is what I came up with.
The solution I found to be easiest to get up and running with and to be extensible with other P5 libraries (like p5.sound for instance) without additional modifications was by cloning ardelta's p5-typescript-starter repo.
This project runs with parceljs which bundles up the typescript files you have into javascript that you can then use anywhere.
Reasons I like it:
npm startnpm build then take the output artifacts and use them anywhereOverall, it's just an extremely practical way to get coding with p5js and Typescript.
If you have a different workflow / project setup, I'd love to hear about it! I'm always in the market for a better dev experience so lmk below or shoot me a message.
The best way to support my work is to like / comment / share for the algorithm and subscribe for future updates.