never type (and unions) #145
emil14
started this conversation in
Type System
Replies: 1 comment
-
Thought Type inference needed anyway. If component accepts |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
never
type is something like "null that you can't use". with unions it allows to describe invariant bettersuppose we have
{a, b int?}
rec where only 2 states must be possible:{a: null, b: int}
and{a: int, b: null}
so instead of e.g.
{ a: int?, b: int? }
where could sayt = {a: int, b: never} | {a: never, b: int}
Problem 1: need for type inference
Makes type-system more complex because we need to introduce some sort of type inference. To make it possible to do some form of
Beta Was this translation helpful? Give feedback.
All reactions