Skip to content

param-type-mismatch. It may be worth expanding data type #1264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
RomanSpector opened this issue Jun 30, 2022 · 1 comment
Closed

param-type-mismatch. It may be worth expanding data type #1264

RomanSpector opened this issue Jun 30, 2022 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@RomanSpector
Copy link

image

Example
---@class Enum
Enum =
{
    ---@class Diminishing
    Diminishing =
    {
        NONE                = 0,
        BANISH              = 1,
        CHARGE              = 2,
        OPENING_STUN        = 3, -- / Cheap Shot and Pounce
        CONTROLLED_STUN     = 4,
        CONTROLLED_ROOT     = 5,
        CYCLONE             = 6,
        DISARM              = 7,
        DISORIENT           = 8, -- / Several spells where name cant be generalized.
        ENTRAPMENT          = 9,
        FEAR                = 10,
        HORROR              = 11,
        MIND_CONTROL        = 12,
        ROOT                = 13,
        STUN                = 14,
        SCATTER_SHOT        = 15,
        SILENCE             = 16,
        SLEEP               = 17,
        TAUNT               = 18,
        LIMITONLY           = 19,
        DRAGONS_BREATH      = 20,
    },
}

---@class Unit
local Unit = {};

---@param unitToken? string
---@return Unit
function Unit:New(unitToken) end

---@param diminishGroup Diminishing
---@return boolean
function Unit:HasDiminishing(diminishGroup) end

local palyer = Unit:New("player");
local hasDiminishing = palyer:HasDiminishing(Enum.Diminishing.BANISH)

I think it's worth adding such a data type as enum

Then the next block of code would look like this and it would not be considered an error

Example
---@class Enum
Enum =
{
    ---@enum Diminishing <<-- This line has been changed
    Diminishing =
    {
        NONE                = 0,
        BANISH              = 1,
        CHARGE              = 2,
        OPENING_STUN        = 3, -- / Cheap Shot and Pounce
        CONTROLLED_STUN     = 4,
        CONTROLLED_ROOT     = 5,
        CYCLONE             = 6,
        DISARM              = 7,
        DISORIENT           = 8, -- / Several spells where name cant be generalized.
        ENTRAPMENT          = 9,
        FEAR                = 10,
        HORROR              = 11,
        MIND_CONTROL        = 12,
        ROOT                = 13,
        STUN                = 14,
        SCATTER_SHOT        = 15,
        SILENCE             = 16,
        SLEEP               = 17,
        TAUNT               = 18,
        LIMITONLY           = 19,
        DRAGONS_BREATH      = 20,
    },
}

---@class Unit
local Unit = {};

---@param unitToken? string
---@return Unit
function Unit:New(unitToken) end

---@param diminishGroup Diminishing
---@return boolean
function Unit:HasDiminishing(diminishGroup) end

local palyer = Unit:New("player");
local hasDiminishing = palyer:HasDiminishing(Enum.Diminishing.BANISH)
@sumneko sumneko added the duplicate This issue or pull request already exists label Jun 30, 2022
@sumneko
Copy link
Collaborator

sumneko commented Jun 30, 2022

See #1255

@sumneko sumneko closed this as completed Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants