As of version 0.629, the recently added Instances
global type doesn’t respect inheritance for items in it, completely making them unusable as it’s not possible to have an instance of type Instance
. Declaring a type as {[number]: Instance}
does not cause this issue and respects inheritance as per usual.
This occurs both in strict and nonstrict mode, and casting an instance to type Instance
doesn’t work either.
Repro code and place file (in ServerScriptService
):
instancesType.rbxl (52.5 KB)
--!strict
local instances:Instances = {}
--table.insert, no casts
table.insert(instances, Instance.new('Model'))
--newindex, casted to instance
instances[2] = Instance.new('RemoteEvent')::Instance
--table.move, casted to Instances
table.move({Instance.new('Part'), Instance.new('Folder')}::Instances, 1, 3, 3, instances)
--table.clone, casted to {[number]:Instance}
instances = table.clone({Instance.new('Part')}::{[number]:Instance})
Expected behavior
The Instances
type acts as an alias for {[number]: Instance}
and respects inheritence normally.