325
you are viewing a single comment's thread
view the rest of the comments
[-] folkrav@lemmy.world 86 points 1 year ago

Might as well not use TypeScript

[-] PoopMonster@lemmy.world 41 points 1 year ago

Just as irritating as seeing people use linters only to have a lot of files with @ts-ignore all over the place... Like why even bother?

[-] master5o1@lemmy.nz 8 points 1 year ago

oh you've got a private variable that I want to use? No worries, (foo as any)['secret'].

[-] fusio@lemmy.world 12 points 1 year ago

using any is actually much worse than using TS, because you're basically telling the compiler "don't help me here".. at least with JS the IDE is gonna help you.. :/

[-] seeyouinteawhy@lib.lgbt 10 points 1 year ago

That's the joke

[-] chicken@lemmy.dbzer0.com 3 points 1 year ago

tbh I don't remember why I'm using TypeScript

[-] folkrav@lemmy.world 3 points 1 year ago

Cause otherwise it's plain JS :/

[-] xmunk@sh.itjust.works 3 points 1 year ago

I don't follow, stamping every function with : any lets you merge the branch and deploy it... trying to properly type everything extends the initial migration time likely to a level where management just says no.

[-] folkrav@lemmy.world 7 points 1 year ago* (last edited 1 year ago)

Use a combination of allowJs and ts-ignore, do progressive enhancement, and convert your codebase file by file. Adding any everywhere literally turns off type checking altogether codebase wide, including type inference. It also means a huge PR that's both just noise that needs to be fixed later, and messes with your git history (good luck getting anything useful out of blame or bisect now).

Just getting a green build doesn't mean things are okay. You're worse off than before doing that.

[-] xmunk@sh.itjust.works 4 points 1 year ago* (last edited 1 year ago)

I disagree that you're worse off (the core of my comment was that even a shitty migration encourages better practices)... but I wasn't super familiar with TS hinting - using ts-ignore would be preferable.

Personally, I mostly work in PHP and we use a similar system. Strict typing is default off so we've slowly propagated declare(strict_types=1); to enable compile and runtime checking on a per file basis.

[-] CannotSleep420@lemmygrad.ml 2 points 1 year ago

Forreal. Even a bespoke inferred return type is better than any 9 times out of 10.

[-] digdug@kbin.social 4 points 1 year ago

This is the only reason I haven't pushed my team to switch. I'm worried too many of them will be OP.

this post was submitted on 18 Oct 2023
325 points (96.0% liked)

Programmer Humor

32302 readers
207 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS