I want to be able to do the following:
interface Partials {
readonly start?: number;
readonly end?: number;
}
interface NotPartials extends Partials /*incorporate Unpartialing somehow */ {
readonly somewhere: number;
}
Then, NotPartials would be:
readonly start: number;
readonly end: number;
readonly somewhere: number;
Notice how start and end are required now. Is this possible anyway?
Well, this is silly.
I think in TypeScript 2.8 this is possible:
interface Partials {
readonly start?: number;
readonly end?: number;
}
interface NotPartials extends Required<Partials> {
readonly somewhere: number;
}
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.