1) Make as few assumptions as possible regarding what the reader knows or has experience with
2) Make code samples as complete and "copy-and-pastable" as possible.
You're assuming that all developers reading this guide will effortlessly translate that TS code to JS.
Using TS creates a possible barrier to understanding, which I'm sure isn't the intent of someone publishing such a guide. Better to simply write some comments or augment the prose in the guide.