top | item 40395527

(no title)

metaskills | 1 year ago

LMAO. Yes, I love ESM modules. So maybe more like 2012 or 2015. Would you like to see TypeScript?

discuss

order

alluro2|1 year ago

Thank you for using vanilla JS!

fy20|1 year ago

Not OP, but I use TypeScript because it adds a layer of safety to the codebase.

It's like having good test coverage - you can make large changes and if the tests pass (the code compiles), you can be fairly confident that you didn't mess anything up.

I've written Ruby for years, so I'm used to dynamically typed languages. But JavaScript is it's own level of special, and there's so many ways you can accidentally mess things up.

Having tests cover every single path (especially failure paths) can be very time consuming, and often hard or messy to setup (how would you mock the OpenAI module returning an error when adding metadata to a thread?), where as using something like TypeScript can make sure your code handles all paths somewhat correctly (at least as well as the types you defined).

Your code looks clean, and you appear to have good test coverage, so you do you though :-)

taf2|1 year ago

Yes this is great so much easier to work with

zknowledge|1 year ago

I was pleasantly surprised to see the .js. THANK YOU!!