Skip to content

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,确实最初的写法更好

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

Successfully merging this pull request may close these issues.

3 participants