Closed as duplicate of#2233
Description
How are you using the lua-language-server?
NeoVim
Which OS are you using?
Windows
What is the issue affecting?
Type Checking, Annotations
Expected Behaviour
TO BE
code 1
---@type string|string[]
local x = ""
-- TO BE xs: string[]
-- AS IS xs: string[] | string
local xs = type(a) == "string" and {x} or x
if type(x) == "string" then
xs = {x}
else
xs = a
end
-- but xs:string[]
Actual Behaviour
AS IS
Reproduction steps
- Create file temp.lua
- Append
code 1
- See type of
xs
Additional Notes
No response
Log File
Metadata
Metadata
Assignees
Labels
No labels