You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@generic seems to be behaving weirdly when being used in a class.
---@classArray<T>: { [integer]:T }---@typeArray<string>localarr= {}
-- correctly warns that I am assigning a boolean to a stringarr[1] =false-- no warning despite indexing with a string instead of an integerarr["foo"] ="bar"-- correctly does not warn as I am following the type correctlyarr[3] ="Correct"
Behaves even weirder for a dictionary:
---@classDictionary<T>: { [string]:T }---@typeDictionary<boolean>localdict= {}
-- no warning despite indexing with a numberdict[1] ="incorrect"-- no warning despite assigning a stringdict["foo"] ="bar?"-- correctly does not warn as I am following the type correctlydict["correct"] =true
The same issues exist when indexing with . like dict.foo = "bar?"
Activity
[-]`@generic` misbehaving when used with a class[/-][+]`@generic` class incorrect type checking[/+]carsakiller commentedon Feb 20, 2023
Closing as duplicate of #734 as this is really just asking for generic class support.