Reputation: 5469
I have a interface:
interface IReceipt {
payment: IPayment;
details: string;
}
I have one component which takes payment as parameter:
const renderPayment = (props: {paymentInfo}) => {}
I need to define the type of paymentInfo as Payment. How can I use the IReceipt interface to assign type to paymentInfo
Something like {paymentInfo: IReceipt.payment}
Upvotes: 0
Views: 45
Reputation: 4330
You can simply use:
paymentInfo: IReceipt['payment']
So you can simply write:
interface IReceipt {
payment: IPayment;
details: string;
}
const renderPayment = (props: {paymentInfo: IReceipt['payment']}) => {}
Upvotes: 4