Hacker News new | past | comments | ask | show | jobs | submit | wonderlg's comments login

With your library one has to write types twice.

I understand that it’s not TypeScript’s job at the moment, but it’d be great to enable runtime checks with the flick of a switch without typing extra code.

    function upper(s: string) {
      return s.toUpperCase();
    }
This function could have a nice implicit TypeError instead of “undefined is not a function”


I’m not sure what you mean. My library has a `TypeOf` type that lets you extract static type information from validation functions. And calling `toUpperCase` on undefined already results in a TypeError.


The difference is that I can update all dependencies without having to verify whether they contain breaking changes, because I can just look at the number.

Conformism helps us think less. Imagine if every website had their own way of scrolling or logging in. Press T to login. Triple click here.

Semver helps me update 10 dependencies in 5 seconds without opening any release notes.

Developers are under no obligations, but one should not go out of their way to make others’ lives harder. Just use semver.


That is precisely what I mean about not materializing, reality is not like that. Maintainers make mistakes, are not diligent about following semver, and after enough “minor” upgrades that break everything you simply lose all trust in the numbers.


If you’re updating 10 dependencies in 5 seconds without really following along closely what exactly you’re updating and why, maybe don’t do that.


Not exactly 10 dependencies, but I do that many times by using version ranges like ^1.0.0. So to answer your question: What you are updating and why... mostly patch and minor versions that include vulnerability and performance fixes. And I read release notes... but the number gives me a good idea what to read in more detail.

Now the problem of TS not following the convention is that many projects have ranges like ^3.7.1 in their package.json without knowing that a simple install removing package-lock may break your build because 3.8 and 3.9 have breaking changes in it.


I love Bill Burr’s take on this. I can’t find the clip, but the resolution was that after receiving a punch, maybe you’ll reconsider “ehh maybe i was being a bit of a dick back there.”

I never punched anyone, but people who ruin your life as described by the commenter deserve it, maybe they’ll become better people.


> after receiving a punch ... maybe they’ll become better people.

That seems like the logic of a supervillain or sociopath. "When they did something bad, it's because they're a bad person that I'm allowed to hurt, but when I'm violent it's because I'm making the world a better place."

There may be times when that works, or it's the least bad option, but my instinct tells me that the sort of person that most deserves a punch is also the sort of person who is most likely to respond to that violence by doubling down and hurting more people (their victims often being those who can't defend themselves).


I punched a bully in the stomach at school (after many months of the school doing nothing to address it), and after that he completely left me alone. It was a small school, so I'm fairly sure he didn't move on to anyone else either. A few years later, we even became friends, our younger siblings (5 years younger in each case) become friends (without knowing about the incident in question), and since starting his own company has done paid work for our family (which we wouldn't have allowed had there still be any animosity).

I've no doubt violence begets violence in most cases, but it can also improve the situation for both sides in others.


A brawl is violent, and a gunfight is violent. Should English have different words for them? They are not at all the same kind of thing.


The legal term you're looking for is "serious bodily injury". Reasonable expectation thereof is the threshold for the use of lethal force in self-defense in most US jurisdictions, for example.


Generally I’d say that this could work on people that don't expect violence, like the racists who go around the city harassing immigrants.

Why are they making other people’s lives miserable? It’s not fair and the law doesn’t protect you.

This won’t change their opinion, but it might very well stop them from acting out again.

IMHO. I have no psychology background.


There’s an obvious solution to this:

    require('clamp')(num, min, max)
1 million monthly downloads


Apple is doing great even if they’re not super friendly to developers. Why change?

I think that they could become better once they start losing some ground, kinda like Microsoft is all about Linux now that the desktop market isn’t improving for them.


Lol why do you donate to a company that made $120 million in ads last year?


Playing devil’s advocate: Is it possible that, yes, of course you can work from home, and you must do that during lockdown, but is it as efficient as working in the office?

I think that’s why many don’t like remote: They can’t see you working and they’re not as comfortable video-chatting.

I’m a remote-only developer, but if I could, at any time, turn to my coworker and ask about something, I’d be more efficient.


>if I could, at any time, turn to my coworker and ask about something, I'd be more efficient

Haha, I remember when I was in the office before this all started, I had multiple coworkers who would do exactly that. I can't tell you how jarring it is to have headphones in and be in a focus state implementing something, just to have someone imagine they are able to trample on that time for their own efficiency and ask me questions. Doubly worse was they wouldn't even think thru their questions properly

Now, we're all remote, and I just hit back at their impromptu questions with "can you give me more context?" and half the time they solve it themselves. Imagine that


Would your coworker be as efficient if you could, at any time, interrupt them? I agree that there are trade offs with remote work vs colocated worm. The ability to interrupt and distract more easily I don’t consider a strength of colocation.


I don’t get this project. This is nothing special, you can very easily spot that every T is identical. You might as well just use a handwritten font.


It applies Cunningham's Law to find sjv‘s project above.


I kind of agree. I remember having to deal with T_PAAMAYIM_NEKUDOTAYIM

Sure the solution is still one search away, but…


But it is one more search away. Computer science has more often than not enough inherent complexity to keep one busy. I don't think we need this extra layer of incidental obscurity.


I think they’d need some hardware to verify that the transaction happened. A small business owner can use their own phone, but other businesses need a smartphone per point of sale, which might be more expensive than a card reader (that one likely has to have anyway)


You can use a phone (or whatever) to verify the transaction, but in practice I've never seen anyone do that. It probably helps that crime is pretty low in this part of Asia.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: