I’m wondering, in type checking, if it’s possible to create a type that is just a tree of instances without actually creating instances?
Currently, you can do this by doing typeof() on an instance but the problem is that I actually have to create an instance which I fear could be unwise with respect to memory.
When I say Instance structures, I mean literally a hierarchy of instances, so imagine folders inside of folders with parts inside of these folders and values etc…
I’m only doing this for the autocompletion feature so it isn’t a big deal if it isn’t possible, I can just destroy the instances at runtime but best case scenario would be to not actually have to create any instances.
As far as I’m aware, it is not currently possible to strongly type an Instance’s children other than what roblox can determine from the in-game structure.
Would be happy to be proven wrong, though.
Edit: I can’t test myself atm, but does something like this work?
local a = Instance.new("Part")
local b = Instance.new("Part")
b.Name = "B"
b.Parent = a
local aWithBChild: typeof(a) & { B: typeof(b) }