Sergei Basharov
Sergei Basharov

Reputation: 53870

How to join two interfaces declarations into one?

I have two properties of an interface:

export interface IInvoicesData {
    invoice: IInvoice;
    invoiceWithTotals: IInvoice & IInvoiceTotals;
}

This works fine and I make invoiceWithTotals property to contain properties from both IInvoice & IInvoiceTotals interfaces.

How can I move declaration IInvoice & IInvoiceTotals to its own interface so that replace IInvoice & IInvoiceTotals with something like IInvoiceWithTotals besides using extends?

Upvotes: 1

Views: 61

Answers (1)

JB Nizet
JB Nizet

Reputation: 691865

type IInvoiceWithTotals = IInvoice & IInvoiceTotals;

seems to work fine.

Upvotes: 2

Related Questions