Currently, I am working with two generic types - Client<T>
and MockClient<T>
. Now, I want to introduce a third generic type called Mocked<C extends Client>
. This new type should be a specialized version of MockClient
that corresponds to a specific specialization of Client
. For example:
type PersonClient = Client<Person>;
// the following two types should be equivalent
type MockPersonClient = Mocked<PersonClient>;
type MockPersonClient = MockClient<Person>;
In essence, I aim to define a type like:
type Mocked<C extends Client<T>> = MockClient<T>;
My question is whether it is feasible to achieve this in Typescript. If not, is there any existing proposal for such functionality (I have no clue what this concept might be named), or is what I am proposing ambiguous or inherently complex to implement within a type system?