LuaHelper icon indicating copy to clipboard operation
LuaHelper copied to clipboard

多维数组类型,注解不能正常解析

Open GingerWine opened this issue 2 years ago • 0 comments

测试代码

如下:

---@type number[][] 
local mdArray = {{1,2,3}, {4,5,6}}  
local subArray = mdArray[1]
local element = subArray[1]

预期

mdArray 被识别为 number[][] subArray 被识别为 number[] element 被识别为 number

实际识别结果

image image image

临时解决方法

将 ---@type number[][] 改为 ---@type (number[])[] 如下:

---@type (number[])[] 
local mdArray = {{1,2,3}, {4,5,6}}  
local subArray = mdArray[1]
local element = subArray[1]

则可以正常解析: image

但这样写确实有点丑,并且不太方便

GingerWine avatar Jul 04 '23 03:07 GingerWine