Type guards override assignments? #868
Unanswered
davidgiven
asked this question in
Q&A
Replies: 2 comments
-
These do the same thing:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Yeah, I think this is a known issue: #535 |
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
-
Here's a thing which surprised me:
This fails with
Expected type table, got 'nil' instead
for thesomething
dereference.I'm guessing that the
not something
typeguard is telling the typechecker thatsomething
must benil
, but then the assignment is not overriding this (which means telling it thatsomething
cannot benil
).Is there a way around this?
Beta Was this translation helpful? Give feedback.
All reactions