I am trying to create a type that represents an inventory item, but some inventory items have more/different attributes than others. In the scope that I’m creating the type in, I only care that the inventory item has a Type and a Name attribute. How can I enforce this using type checking without running into errors when the item has more than those 2 attributes? This is my starting idea, but from my understanding this will create a “sealed” table that doesn’t allow additional attributes.
type InventoryItem = {
Name: string,
Type: string,
}
function signature: function AddItemDataToCache(player: Player, item: InventoryItem)