Closed balajeerc closed 1 day ago
all teal types are nillable, so the | nil
is ignored
all types are nillable
Got it, that I suppose also explains why this code also passes type check
local function takes_type(val: string)
print(val)
end
takes_type(nil)
Thanks for the clarification. @Frityet Closing this issue.
I suspect I might have run into a type checking bug as relates to functions returning a union type.
Here's a small snippet:
This script passes
tl check
without errors or warnings. It errors out ontl run
though.tl check
fails to flag the error thatpop_msg_wrapper
is returning aMessage | nil
union type, whereas it should be returning aMessage
type as per the declared signature forpop_msg_wrapper
.Is this a bug or is there a misunderstanding on my part?