Typescript 如何将两个接口声明合并为一个?

Typescript 如何将两个接口声明合并为一个?,typescript,Typescript,我有两个接口属性: export interface IInvoicesData { invoice: IInvoice; invoiceWithTotals: IInvoice & IInvoiceTotals; } 这很好,我使用invoiceWithTotals属性来包含IInvoice和IInvoiceTotals接口中的属性 如何将声明IInvoice&IInvoiceTotals移动到其自己的界面,以便在使用extends的同时,将IInvoice&IInv

我有两个接口属性:

export interface IInvoicesData {
    invoice: IInvoice;
    invoiceWithTotals: IInvoice & IInvoiceTotals;
}
这很好,我使用
invoiceWithTotals
属性来包含
IInvoice
IInvoiceTotals
接口中的属性

如何将声明
IInvoice&IInvoiceTotals
移动到其自己的界面,以便在使用
extends
的同时,将
IInvoice&IInvoiceTotals
替换为
IInvoiceWithTotals

type IInvoiceWithTotals = IInvoice & IInvoiceTotals;
看起来很好用