Closed as not planned
Description
@generic
seems to be behaving weirdly when being used in a class.
---@class Array<T>: { [integer]: T }
---@type Array<string>
local arr = {}
-- correctly warns that I am assigning a boolean to a string
arr[1] = false
-- no warning despite indexing with a string instead of an integer
arr["foo"] = "bar"
-- correctly does not warn as I am following the type correctly
arr[3] = "Correct"
Behaves even weirder for a dictionary:
---@class Dictionary<T>: { [string]: T }
---@type Dictionary<boolean>
local dict = {}
-- no warning despite indexing with a number
dict[1] = "incorrect"
-- no warning despite assigning a string
dict["foo"] = "bar?"
-- correctly does not warn as I am following the type correctly
dict["correct"] = true
The same issues exist when indexing with .
like dict.foo = "bar?"
Originally posted by @carsakiller in #1362 (comment)