How do I create and export a new interface - UIInterface: (would like to combine SummaryInterface with few other new properties)
Example:
import { SummaryInterface } from 'x-api'; // summaryInterface has 20+ properties defined and is auto-generated from script
My attempt
export interface UIInterface {
SummaryInterface &
{ displayStatus: string;
flag: boolean };
}
By extending the other interface like so:
export interface UIInterface extends SummaryInterface {
displayStatus: string;
flag: boolean;
}
You can try below code:
By extending the parent class property
Explanation: Basically, your in below code, have both the properties of your parent and child interface.
export interface UIInterface extends SummaryInterface {
displayStatus: string;
flag: boolean;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.