I’ve not worked with type checking very often. I defined a custom table type and found that x and y or z
doesn’t seem to be adequate nil
checking and get Value of type options? could be nil
which is just a warning, but it’s rather annoying as it’s shorthand for this:
if x ~= nil and x.y~= nil then
--...
else
--...
end
Here’s what I see in studio (I’ve written the shorthand version that has a warning and the long version that has no warnings, yet they accomplish the same thing)
I even tried explicitly checking nil:
Metrics.Version = additionalOptions ~= nil and additionalOptions.version ~= nil and additionalOptions.version or "1.0.0"
but I have the same issue here too.
And as you can see they get the same results:
Is there any way I could type check with shorthand or is that just not implemented?