Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Root79776208dI’ve gotta refactor a testing framework I wrote into valid typescript so I can automatically generate documentation from it.
It’s … mostly valid, but I cheated in a few places because e.g. it didn’t matter if something was a string or a number, or I don’t know what the proper Playwright types are.
Just. Ugh. Tedium.
I tried other documentation utilities, but they either make a mess of things (all methods, public and private, in the same giant list regardless of their namespacing) or don’t understand basic things like the spread operator and therefore can’t parse my code. 🤦🏻♀️ -
macfanpl102208dI, sort of, understand you, where yoiu coming from; to some extent even agree: TS can be bitch; there are better langs for API........as there are langs that are greater bitches; let Python be examplary one: have you tried it? If yes: go away as fast as possible; if no: lucky you.
-
kobenz868208d@macfanpl I've found python to be a delightful language. Incredible stdlib, pattern matching through `match`, walrus operator. Superb typing library that's actually tangible. only thing better for APIs I think would be Erlang. Though a did very little Erlang in my life
-
Ranchonyx10530207dI'm not gonna lie, I enjoy writing APIs in TS, typing them is fun to me.
I'm probably a masochist -
devRancid653206d@kobenz TS can automatically convert such a string into { momId: string, action: "credits" | "details" | "towns" }
-
kobenz868205d@Ranchonyx types. I know template literal types could cover it, but, let's say `moms/${number}` has a searchParam with an append_to_response query whose value is a comma separated list of values of type "credits"|"details"|"town" which will have their respective `moms/${number}/${"credits"|"details"|"town"}` response added to `moms/${number}`'s response. We can obviously see there's a root object of which mom's derived but not its "children" URIs, or else they would not be there. It's doable, but, shit, what a chore, even with type manipulation since typescript's type system lacks introspection:/
-
Ranchonyx10530205d@kobenz I never really found that to be too much a chore... As I said, probably typescript turned be into a masochist.
ah, APIs... writing APIs is fine, even typing an API can be great! 😃👍🏻
that's it
---
No, actually, all of the above is invalid if you've gotta do it in typescript
rant