Live data from Hacker News

A complete guide to TypeScript’s 'never' type

zhenghao.io

1–10 of 64 posts

Re: A complete guide to TypeScript’s 'never' type

#6

> Since there’s no values in the set, never type can’t never (pun-intended) have any value That’s not a pun that’s just poor grammar. “never type can never (pun-intended) have any value” makes sense.

I have seen such double negative at many places, to represent strong negative. Don't know if it is some trend!

Re: A complete guide to TypeScript’s 'never' type

#7
post #6

> Since there’s no values in the set, never type can’t never (pun-intended) have any value That’s not a pun that’s just poor grammar. “never type can never (pun-intended) have any value” makes sense.

I have seen such double negative at many places, to represent strong negative. Don't know if it is some trend!

Funnily enough, in Russian the double negative is completely normal and that is a normal way to express many negatives. It always triggers my brain when I have to say a double negative in Russian, "just do it, it's completely normal, don't worry about it..." (inner feeling-based monologue).

https://www.russiantutoring.com/post/double-negation-in-russ...

Re: A complete guide to TypeScript’s 'never' type

#8
tldr: A method that is typed as returning `never` either never returns (infinite while/for loop) or throws an error. And as return types can also be conditional, your given inputs may switch the return to `never`, allowing typescript to tell you that code following that line will never be executed.

Re: A complete guide to TypeScript’s 'never' type

#10
post #7
post #6

Earlier quoted context omitted.

I have seen such double negative at many places, to represent strong negative. Don't know if it is some trend!

Funnily enough, in Russian the double negative is completely normal and that is a normal way to express many negatives. It always triggers my brain when I have to say a double negative in Russian, "just do it, it's completely normal, don't worry about it..." (inner feeling-based monologue). https://www.russiantutoring.com/post/double-negation-in-russ...

Reminds me of a classic linguistics joke (I assume from a Tom Scott video given where I encounter linguistics the most):

A professor is lecturing on linguistics: "In English a double negative has a positive meaning. However, in some languages—such as Russian—a double negative still has a negative meaning. There isn't, however, a language in which a double positive holds a negative meaning."

A student in the back responds: "Yeah, right."

Post reply on HN