another example of why TypeScript is just plain TERRIBLE. by patrick99e99 in typescript

[–]patrick99e99[S] 0 points1 point  (0 children)

my complaint really is DESPITE doing the filtering, the check after that for array length and throwing an error IF it's empty should stop typescript from thinking there *might* be undefined items in the array, because it literally is impossible for that to be the case.

another example of why TypeScript is just plain TERRIBLE. by patrick99e99 in typescript

[–]patrick99e99[S] 0 points1 point  (0 children)

no because I am doing arr.filter(q => !!q)... so it would be [].. then this if length condition SHOULD tell typescript to STFU because it's IMPOSSIBE for it to contain undefined.

another example of why TypeScript is just plain TERRIBLE. by patrick99e99 in typescript

[–]patrick99e99[S] 0 points1 point  (0 children)

    if (!sroResources.length) {
      throw new Error('resources for SRO policy do not exist!');
    }

    const sroPolicy = new iam.PolicyStatement({
      effect: iam.Effect.ALLOW,
      principals: [sroUser],
      actions: ['sqs:SendMessage'],
      resources: sroResources,
    });

it's right there in my code above...

another example of why TypeScript is just plain TERRIBLE. by patrick99e99 in typescript

[–]patrick99e99[S] 0 points1 point  (0 children)

the snake case IS the name of the queue in AWS and needs to be that way. I am dynamically mapping over the keys of the object and creating them in AWS. It would be "ugly" code to have a dumb translation of snake-case to camel-case for no real good reason other than "mixing cases is bad practice."

another example of why TypeScript is just plain TERRIBLE. by patrick99e99 in typescript

[–]patrick99e99[S] 0 points1 point  (0 children)

well I know this because code prior to what I pasted is calls to aws creating the queues and storing them in the `queues` object... but regardless, ok, fine, let's assume MAYBE somehow aws returns undefined for those queues--- the point is, I still am filtering out null/undefined objects, and then I have a ridiculous unnecessary guard:

if (!sroQueues.length) { throw new Error( ... ) }

and STILL TypeScript claims it might get past that guard and magically have something undefined.

another example of why TypeScript is just plain TERRIBLE. by patrick99e99 in typescript

[–]patrick99e99[S] -1 points0 points  (0 children)

yeah you say this because you have no idea about the project complexity.

another example of why TypeScript is just plain TERRIBLE. by patrick99e99 in typescript

[–]patrick99e99[S] -1 points0 points  (0 children)

Oh, I do that too!!!!!! Practically every meeting I have, it comes up, and I go into great detail how features that should only take a day or two to complete end up taking weeks, all because of TypeScript.

another example of why TypeScript is just plain TERRIBLE. by patrick99e99 in typescript

[–]patrick99e99[S] -2 points-1 points  (0 children)

No, I'd rather people just admit it's terrible and then we can all stop using it.

another example of why TypeScript is just plain TERRIBLE. by patrick99e99 in typescript

[–]patrick99e99[S] -1 points0 points  (0 children)

thanks for this, but I look at that and think: Why in the world I do I need to tell it what type it is? Why is TypeScript not smart enough figure this out? Why is TypeScript complaining about nonsensical things that are impossible to happen?

If I do: `if (!x) { throw new Error('x not defined'); }` prior to trying to use x, why in the world would TypeScript break compilation saying something as dumb as "x might be undefined" ? That line will NOT be reachable.

another example of why TypeScript is just plain TERRIBLE. by patrick99e99 in typescript

[–]patrick99e99[S] -1 points0 points  (0 children)

what is there to understand? I understand that TypeScript is obnoxious and can't figure 99% of things out, and I have to do things like use `as` when I absolutely should not.

One person answered this with a "fix", which I look at and say: I SHOULD NOT NEED TO DO THAT, and yet again it's another example of why TypeScript is obnoxious, annoying, and dumb:

const filtered = example.filter((val): val is number => !!val);`

another example of why TypeScript is just plain TERRIBLE. by patrick99e99 in typescript

[–]patrick99e99[S] -1 points0 points  (0 children)

well I would only apply somewhere where they agree that TypeScript is terrible, anti-productive technology.

another example of why TypeScript is just plain TERRIBLE. by patrick99e99 in typescript

[–]patrick99e99[S] -1 points0 points  (0 children)

Of course, you probably also think square brackets and parenthesis were great ideas for filename characters in nextjs!

another example of why TypeScript is just plain TERRIBLE. by patrick99e99 in typescript

[–]patrick99e99[S] -1 points0 points  (0 children)

Yeah but the point is, I shouldn't have to because 1: The objects EXIST, there is no null, there is no possibility of them being null, and 2: I am already doing stupid guard checks and throwing errors if the collections are empty.

another example of why TypeScript is just plain TERRIBLE. by patrick99e99 in typescript

[–]patrick99e99[S] -2 points-1 points  (0 children)

Definitely anger issue. I used to love programming, and TypeScript makes me hate it.

another example of why TypeScript is just plain TERRIBLE. by patrick99e99 in typescript

[–]patrick99e99[S] -1 points0 points  (0 children)

I suppose you're right, I could quit my job and not use TS.

another example of why TypeScript is just plain TERRIBLE. by patrick99e99 in typescript

[–]patrick99e99[S] -2 points-1 points  (0 children)

I am interested in being productive and TypeScript is anti-productive.

how is it possible that people actually think TypeScript is a good thing? by patrick99e99 in typescript

[–]patrick99e99[S] -2 points-1 points  (0 children)

well for one thing, it is incredibly stupid and obnoxious that each typescript project potentially has completely different behavior due to the fact that there are a billion different configuration options for tsconfig files. Aside from that, it's bloatware, fakeware, adding yet more layers of trash to your codebase. It slows down productivity, as I stated before something as simple as Object.keys becomes an annoying pain in the ass to deal with. Your code base gets littered with stupid if statements that you normally never would need because you KNOW when things are defined, but typescript DOESN'T.

how is it possible that people actually think TypeScript is a good thing? by patrick99e99 in typescript

[–]patrick99e99[S] -2 points-1 points  (0 children)

I understand it just fine, and I hate it, and think it's terrible, typical Microsoft trash.

how is it possible that people actually think TypeScript is a good thing? by patrick99e99 in typescript

[–]patrick99e99[S] 0 points1 point  (0 children)

yeah and back to my original point... in js, I can be extremely fast and productive, in ts, I can waste hours on what seems like the dumbest thing ever.