Modifying a specific tuple item of a specialized variadic generic type

Hi, suppose I have an app which manages a set of entities and I may add new entity types over time, I'm consiering to use variadic generic type to implement a framework so that I don't need to modify framework code when adding new entity types. However, the framework needs to provide entity type specific CRUD API. I'm considering to implement these APIs in the specialized type. Please see code below:

framework.swift:

protocol Entity {
	var name: String { get }
}

struct DataStore<each T: Entity> {
	var entities: (repeat [each T])

	func combine(another: Self) -> Self {
		Self(entities: repeat (each entities + each another.entities))
	}

    // other methods ...
}

The app's initial version will have two entity types:

struct Foo: Entity {
	var name: String = "foo instance"
}

struct Bar: Entity {
	var name: String = "bar instance"
}

This is the specialized framework type for the app's initial version:

typealias DataStoreV1 = DataStore<Foo, Bar>

extension DataStoreV1 {
    func add(bars: [Bar]) -> DataStoreV1 {
        let tmp = DataStoreV1(entities: ([], bars))
        return combine(another: tmp) // error: pack expansion requires that 'each T' and 'Foo, Bar' have the same shape
    }
}

Unfortunately calling combine() in DataStoreV1 causes this error:

error: pack expansion requires that 'each T' and 'Foo, Bar' have the same shape

Is it expected? I think compiler should be able to determine that each T and Foo, Bar are same for the specialized generic type?

I also tried defining combine() in the specialized type, but that lead to more error messages (I'll skip them below):

extension DataStoreV1 {
    func combine(another: DataStoreV1) -> DataStoreV1 {
        DataStoreV1(entities: repeat (each entities + each another.entities))
    }
}

So it seems unlikely to use variadic generic type to implement my requirement. I wonder how folks in the forum would do it? I used enum in the past, but that was very tedious (a lot of code changes had to be made when adding a new entity type). I'm currently using a solution based on variadic generic function plus some home grown macros. It works but I think using variadic generic types would be the best solution if it works.


PS: while I'm trying it, I also find having only the following code in, say, a swift package, crashes the compiler:

protocol Entity {
	var name: String { get }
}

struct DataStore<each T: Entity> {
	var entities: (repeat [each T])

	func combine(another: Self) -> Self {
		Self(entities: repeat (each entities + each another.entities))
	}
}

My environment:

% swift --version
Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-darwin23.2.0