Skip to content

Different function arguments based off a parametre #2084

New issue

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

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

Already on GitHub? # to your account

Closed
Frityet opened this issue Apr 22, 2023 · 1 comment
Closed

Different function arguments based off a parametre #2084

Frityet opened this issue Apr 22, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@Frityet
Copy link
Contributor

Frityet commented Apr 22, 2023

It would be really useful to have something like

---@overload fun(x: "one", y: integer)
---@param x "two"
---@param y string
---@param z string
local function func(x, y, z) end

so that

func("one", 43)
func("one", "32") --error
func("two", "32", "blah") -- ok
@carsakiller
Copy link
Collaborator

Function overloading and narrowing of the correct overload is already being discussed over in #1456

@sumneko sumneko added the enhancement New feature or request label Apr 24, 2023
@Frityet Frityet closed this as completed Apr 28, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants