lua-language-server
lua-language-server copied to clipboard
[Question] Prefixing/modifying a generic to get a different class
In World of Warcraft we have a Frame class and a AceGUIFrame class, but the problem is they are created with CreateFrame("Frame") and AceGUI:Create("Frame") respectively.
How would I get AceGUI:Create("Frame") to return the AceGUIFrame class?
---@alias FrameType
---|"Frame"
---@class Frame
local Frame = {}
function Frame:SetToplevel(isTopLevel) end
---@generic T
---@param frameType `T` | FrameType
---@return T frame
function CreateFrame(frameType) end
local normalFrame = CreateFrame("Frame")
normalFrame:SetToplevel(true)
---@alias AceGUIContainerType
---|"Frame"
---@class AceGUIFrame
local AceGUIFrame = {}
function AceGUIFrame:SetTitle(text) end
local AceGUI = {}
---@generic T
---@param type `T` | AceGUIContainerType
---@return "AceGUI"..T
function AceGUI:Create(type) end
local aceguiFrame = AceGUI:Create("Frame")
aceguiFrame:SetTitle("Example")
Current behavior

Expected behavior

Original issue: https://github.com/Ketho/vscode-wow-api/pull/43
Operations on types are currently not supported