Comment
Comment by skywal_l
I define a type called Ensure
This type takes two type parameters, one called T and the other K which will consist of Keys belonging to the type T (in our case, "foo", "bar" or "baz").
This new type (called Ensure) will be equal to the union of two types: One will be T and the other will be:
A new type which keys will be picked among the key listed in K
To which we will remove the potential optional qualifier
And which types will be the same as in T.