I have been trying to get the following to work with conditional and mapped types to no avail. I might be missing something obvious, but suppose I had the interface:
interface TestInterface {
x: 1,
y: "hello"
}
Is there a way to get just this:
interface TestInterfaceButJustStrings {
y: "hello"
}
Like this:
type ExtractValues<T, U> = /* ??? */;
type TestInterfaceButJustStrings = ExtractValues<TestInterface, string>;
Where ExtractValues<T, U> is type T with only properties whose values match the type U?