Skip to content

[Feature Request] Support capturing generic type for @overload #3190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
amsitlab opened this issue May 20, 2025 · 3 comments
Open

[Feature Request] Support capturing generic type for @overload #3190

amsitlab opened this issue May 20, 2025 · 3 comments

Comments

@amsitlab
Copy link

---@class base

---@class builder
---@generic T: base
---@overload fun(name: `T`): T
local builder = {}

local function __call(self, name)
....
end

setmetatable(builder, { __call = __call })

Thats will be helpfull for table have an metatable.__call

@tomlau10
Copy link
Contributor

this has long been feature requested: #723

@CppCXY
Copy link
Collaborator

CppCXY commented May 22, 2025

I think the grammar should like:

---@class builder
---@overload fun<T>(name: `T`): T
local builder = {}

@amsitlab
Copy link
Author

I think the grammar should like:

---@Class builder
---@overload fun(name: T): T
local builder = {}

thats awesome
look like c++ template

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants