Open
Description
When using some c api's (In my case Factorio's modding api) when you retrieve a value you get one type, but you can set it with multiple different types.
---@class Surface
---@class Player
local Player = {}
---@fieldread surface Surface
---@fieldwrite surface Surface|string
local p = Player.surface --- p is Surface
p.surface = "Other Surface" --No warnings
Another thought I had was attribute types, which would more easily support more attributes in the future
---@field{read} surface Surface
---@field{write} surface Surface|string
---@field{read,write} surface -- the default if no attributes are supplied