I have a module holding every custom type my project uses, to save on declaring the same types at the top of every script.
Importing a type from the module is as simple as
local Types = require(<path>)
local Data: Types.EntityData = {}
The problem is, every time I use a type from the module I’m indexing the module. That’s a lot of Variable: Module.Type. Would I actually be better importing each type once and declaring a new type inheriting from the original template type, as in the case below?
local Types = require(<path>)
type EntityData = Types.EntityData
type ComponentData = Types.ComponentData
--etc
--etc
local Data: EntityData = {}
Or is it a case of ‘it really doesn’t matter’? On the one hand, I can see the standard format being less efficient since I’m indexing the module every time I use a type. On the other hand, I can see redeclaring every type I use for every script being inefficient too, since I’m flooding everything with a hierarchy of dummy types. Does anyone have any insight into the subject?