Repository navigation
Generics - #786
Generics#786
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
aac05a6 to
3374750
Compare
945e7f0 to
4467089
Compare
|
Hi @xuhuanzy, sorry to bother, I wondered if this PR was allowing to infer the content of generic types captured in parameter ? Something along the lines of ---@generic T
---@param future Future<T>
---@return T
---@async
function await(future)
return future:wait()
end
--- somewhere in uv coroutine context
local result = await fetchUser() --- Future<User>
--- ^ UserAnyway I am so gratetful to start a lua project in this times where this project make it really close to type systems I am used to working with ! Really a great future for embedded scripting <3 |
|
@Aetherall This PR is not needed. It already supported capturing generic parameters before this PR. This PR provides advanced usage, such as conditional types, mapped types, etc.
|
|
I must be using incorrect version or settings, thanks for the confirmation ! Mapped types will allow me to remove a really big chunk of annotations in my project ahah many thanks for this PR |
Expand tuple types when encountering rest parameters (`...`) during generic instantiation close EmmyLuaLs#738
|
You're cooking here, I paused my project because this would allow to remove a good third of my lua files. can't wait for this to drop |
The main functions have been completed, but we need to wait for @CppCXY to conduct a cross-review. |
|
This is amazing! I'm SO looking forward to seeing this. |


泛型实现标准
类型T...的作用是将类型T转换为可变序列, 可变序列允许匹配多参数类型与多返回值定义函数调用时泛型
必须要在函数名称与
(之间使用@<>标注类型