Hi, I have the following snippet:
---@class Foo
---@field [integer] string
---@field other number
local f = {}
---@param array string[]
local function bar(array)
print(array[1])
end
---@param foo Foo?
local function baz(foo)
foo = foo or { other = 5 } --[[@as Foo]]
bar(foo)
end
baz(f)
This is fine so far, but dropping --[[@as Foo]] introduces a warning because foo is not resolved as Foo anymore and thus not as a valid string[]. Is this a design choice or would it be possible to have the right type resolution without the explicit comment? Thank yon in advance!