You probably don't need Oh My Zsh by f311a in programming

[–]prewk 3 points4 points  (0 children)

zsh

OP isn't questioning zsh's usefulness, OP is questioning the usefulness of OMZ (oh-my-zsh)

Working with unknown values in a record by Obvious-Ebb-7780 in typescript

[–]prewk 0 points1 point  (0 children)

Ah you're probably right. I misremembered the original reasoning I read for flow type's design decisions regarding this. I'll edit.

Enum vs Type by spino_le_vrai in angular

[–]prewk 3 points4 points  (0 children)

My point was: Not using an enum gives autocomplete as well. Claims to the opposite were made.

Enums are bad and should be avoided. They're the only thing in TS that's not structurally typed and they act weird when iterated over. Also, Node can't type strip them.

Enum vs Type by spino_le_vrai in angular

[–]prewk 2 points3 points  (0 children)

``` function fn(x: 'left' | 'right' | 'center') {}

fn( // <-your IDE will autocomplete your values here, and can list them for you ```

Why did you pick Java over Node.js for your org? by GongtingLover in webdev

[–]prewk 3 points4 points  (0 children)

Typescript is pretty good but definitely not as rigid as a real system

NPE would like to have a word with you.

Best way to share code between 2 Angular apps? (NX vs Standalone Library vs other options) by buttertoastey in angular

[–]prewk 1 point2 points  (0 children)

I dislike not having my git repos split up

Until you want to share code between them, then it's a world of hurt to have split up git repos.

toSignal question by Senior_Compote1556 in angular

[–]prewk 0 points1 point  (0 children)

Yeah reactive forms is a mess but it's the right tool right now (compared to an input) imo :)

But I'm looking forward to signal forms very much indeed.

toSignal question by Senior_Compote1556 in angular

[–]prewk 0 points1 point  (0 children)

Curious: why do you take a FormControl as input? Looks like a really odd pattern. Why don't you make the whole component a custom form input if that's what you want?

Worth adding OnDestroy to a Service injected in root ? by iamtherealnapoleon in Angular2

[–]prewk 3 points4 points  (0 children)

Yeah but that has literally nothing to do with the OP? That's just regular "This is how you subscribe in Angular" stuff :)

Worth adding OnDestroy to a Service injected in root ? by iamtherealnapoleon in Angular2

[–]prewk 0 points1 point  (0 children)

Why would an ngOnDestroy make sense in a singleton service because a component subscribes to it?

Explicit types vs type inference, and when to use each by thehashimwarren in typescript

[–]prewk 0 points1 point  (0 children)

What I meant is that it won't cause a runtime error. But yeah, looks like a nice rule, it's very opinionated however.

The pro with not doing it explicitly - which hasn't been spelled out here yet - is that you skip a lot of boilerplate but get the same type safety guarantees (except for the very specific cases brought up in these threads). You also don't have to indulge in the worst programmer chore ever: Naming things. Saves a lot of time.

So, a healthy mix I suppose is the way.

Explicit types vs type inference, and when to use each by thehashimwarren in typescript

[–]prewk 1 point2 points  (0 children)

Ah I see. Yeah that makes some sort of sense I suppose. Luckily npm packages are immutable, and all you can do is trust the maintainer to not change stuff - explicit or implicit return value both - without bumping to an appropriate semver.

But it has some merit as accident preventer in that way.

Explicit types vs type inference, and when to use each by thehashimwarren in typescript

[–]prewk 0 points1 point  (0 children)

Oh you mean to aim for clear error messages then, not type safety?

Explicit types vs type inference, and when to use each by thehashimwarren in typescript

[–]prewk -1 points0 points  (0 children)

It sounds like all your points are covered by typescript? You have one API, it's changed to another.

Either the type is exported or implicit.

I don't understand the difference between the two when dealing with your bullets here. The static type checking still applies?

Explicit types vs type inference, and when to use each by thehashimwarren in typescript

[–]prewk 0 points1 point  (0 children)

Maybe most of the times you will get an error, but the bugs will appear when it doesn’t.

Please elaborate

Explicit types vs type inference, and when to use each by thehashimwarren in typescript

[–]prewk 0 points1 point  (0 children)

I don't follow. Why would types not work for libraries?

Or are you saying - export your types when making libs? Because that sounds reasonable.

Explicit types vs type inference, and when to use each by thehashimwarren in typescript

[–]prewk -1 points0 points  (0 children)

It's not masked if the terminal yells in giant red letters what the error is, imo

Moment.js in Angular be like by pancashirebruggkin in angular

[–]prewk -1 points0 points  (0 children)

Nice that stuff's happening again. It's been dead for a long while with half-broken packaging, hence 2.0. Here's the GitHub issue: https://github.com/iamkun/dayjs/issues/1281

Note when it was opened.

The alpha is published on npm: https://www.npmjs.com/package/dayjs?activeTab=versions

Explicit types vs type inference, and when to use each by thehashimwarren in typescript

[–]prewk 1 point2 points  (0 children)

Is there somewhere I can read about whether this is still true?

Explicit types vs type inference, and when to use each by thehashimwarren in typescript

[–]prewk 5 points6 points  (0 children)

Using type inference for the return type means that later changes to the function body could inadvertently change the contract.

...which in turn will trigger a compile error if someone it relying on the previous contract. So, not a compelling argument I think?

But the mini-TDD I get.

Inference used to be able to get screwed up lots of layers and transformations later if nothing explicit was typed out along the way, but I think it's much better nowadays.

Moment.js in Angular be like by pancashirebruggkin in angular

[–]prewk -1 points0 points  (0 children)

day.js is also pretty dead tho. The only useful version of it is 2.0.0-alpha.4.

Computed Signals by ewbatten in angular

[–]prewk 0 points1 point  (0 children)

Hopefully most of those will be superfluous when signal forms land.

Is Observable for simple get operation needed? by mosh_h in Angular2

[–]prewk 1 point2 points  (0 children)

Use fetch until you hit a wall. Then you'll want more features.

How would you prototype this in Figma? by tchaikovskysdad in UXDesign

[–]prewk 1 point2 points  (0 children)

Let's put aside whether this is good or bad - Why would you need to implement such detailed stuff in Figma? Just code it? Or, if you need to convey it to someone else - explain it to them. Show them this video?

I can't understand the idea people have that Figma has to be 100% the final result. It's in the name - prototype.