I have the following interface:
interface Address {
street: string
town: string
country: string
}
I want a function to accept a key parameter that has to be one of three strings:
function useKey(key: "street" | "town" | "country") {
}
Can I somehow generate the type for the key parameter from the interface?