#Question about developing in TypeScript

1 messages · Page 1 of 1 (latest)

ocean nova
#

My bot which is used by 10,000 members is fully written in Sapphire for JavaScript.
I was thinking about converting it to TypeScript to make the code better, and safer.

I wanted to ask, from your experience, does using TypeScript make a difference in how you code? does it make a difference in the performance? Is it worth it? Cheers!

glass ospreyBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

silent steppe
#

Yes, Typescript for me is a life saver! I no longer have to keep the structure of my entire application in my head and at the whims of my memory, + it makes me think harder about how i design things which makes them more scalable in the long term

#

By structure I mean what x function expects and returns, what properties are on y, what parameters are in z callback, etc

#

Not sure what you mean about performance. Obviously it adds a build step, but it's just a few seconds

timber plover
#

same, 100% recommend switching to TS. there are so many things that TS picks up well before you run your bot - things that can be null, undefined properties etc. and you get intellisense everywhere.

as for performance, TS doesn't change it, but you could look into using https://bun.sh/.

Bun

Bundle, install, and run JavaScript & TypeScript — all in Bun. Bun is a new JavaScript runtime with a native bundler, transpiler, task runner, and npm client built-in.

ocean nova
#

I am thinking of switching, i know now what I'm going to do my weekend 😀