Skip to content
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

doc param support generic pattern #2484

Merged
merged 4 commits into from
Mar 18, 2024
Merged

Conversation

fesily
Copy link
Contributor

@fesily fesily commented Jan 17, 2024

---@class namespace.A
---@overload fun(x: {id: string})

---@generic T
---@param t namespace.`T`
---@return T
local function new(t) end
new 'A'{
    id
}

@sumneko
Copy link
Collaborator

sumneko commented Jan 17, 2024

感觉这个写法怪怪的,可能用形如 `namespace.<T>` 更好。 `T` 则作为 `<T>` 的语法糖。

@fesily
Copy link
Contributor Author

fesily commented Jan 17, 2024

可以啊,我也没决定怎么写比较好。

@sumneko
Copy link
Collaborator

sumneko commented Jan 17, 2024

不急,过2天看看有没有其他想法

@sumneko sumneko mentioned this pull request Feb 1, 2024
@morgverd
Copy link

感觉这个写法怪怪的,可能用形如 `namespace.<T>` 更好。 `T` 则作为 `<T>` 的语法糖。

In my opinion, the current way feels more intuitive. With the current capture being `T` it seems clearer that namespace.`T` is the same as just capturing the original generic class name with some static prefix. Also I just really want to see this get merged lol.

@sumneko
Copy link
Collaborator

sumneko commented Mar 18, 2024

参考了一下TS,确实最初的写法更好

@sumneko sumneko merged commit e930179 into LuaLS:master Mar 18, 2024
5 of 10 checks passed
@tomlau10 tomlau10 mentioned this pull request Sep 7, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants