Is there a way to define a generic type constraint such that
//this will compile
type Contrained = StrongConstraint<"a" | "b" | "c", "a" | "b">
//this wont compile as "a" | "b" | "d" is not a strict subset of "a" | "b" | "c"
type Contrained = StrongConstraint<"a" | "b" | "c", "a" | "b" | "d">
This is similar to Exclude
just stronger as I dont like keys in the second param that are not part of the first.
I don't think your approach is possible (at least not that I am aware of). However, depending on your UseCase you could check about
Partial
.