Open
Description
Consider we have the following file:
-- a.lua
local M = {}
M.x = 1
M.x = ''
return M
And then we import it in another file:
-- b.lua
local a = require('a')
---@type string
local test = a.x
In a.lua
we get a type error, which is somewhat ok since we never explicitly said if we wanted a union. However, the type of x should still be string
since that is most correct. Inside of b.lua
, a.x
is an integer
which results in a type error in b.lua
, which is not correct.