Reputation: 4551
I'm trying to get a type in object which belong to interface
interface Action {
type: string,
payload: {
name: string
}
}
In this case I want to pick payload.name type how to do this?
What I tried is Pick<Action , "payload.name">
, but failed any ideas?
Upvotes: 0
Views: 141
Reputation: 1042
type A = Action["payload"]["name"] // yield string
direct access to the index will give you the desired type
Upvotes: 3