Closed
Description
openedon Dec 12, 2018
I understand that the issue tracker is not for questions, which is why I've already asked this on StackOverflow:
https://stackoverflow.com/questions/53540282/why-is-never-assignable-to-every-type
But as I haven't gotten an answer to the main question in almost two weeks, I thought I'd try here as well:
The TypeScript documentation says that
The
never
type is a subtype of, and assignable to, every type
but doesn't mention why.
Intuitively, I would expect code like this to fail:
const useString = (str: string) => console.log('This is definitely a string:', str)
const useNever = (not_a_string: never) => useString(not_a_string)
but there are no errors, because any never
value is considered a valid string.
Is this intentional? If yes, then why? :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment