-
-
Notifications
You must be signed in to change notification settings - Fork 385
Closed
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
Currently, alias only takes a name along with values (using the expanded form of alias for example purposes)
---@alias areaType
---| 'TOP'
---| 'BAG
---@param area? areaType
StoreItem = function (area)
if (area:lower() == 'top') then
print('this is a top area')
end
end
The problem comes in that if I want to do anything with those values such as normal string operations (e.g., area:lower()), the editor reports that operation as an undefined field.
I can add string to the alias to eliminate this error.
---@alias areaType string
---| 'TOP'
---| 'BAG
However, string now shows up in the function signature.
I also tried adding ---@type string in front of the alias, but this wasn't recognized.
An enhancement to allow typing the alias or automatically recognizing a list of string values and bringing in the string operations accordingly would address this. I'd prefer the explicit typing as this would open the door to creating enums of other types.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working

