[英]How to extend a TypeScript interface and unpartial it
我希望能够执行以下操作:
interface Partials {
readonly start?: number;
readonly end?: number;
}
interface NotPartials extends Partials /*incorporate Unpartialing somehow */ {
readonly somewhere: number;
}
然后,NotPartials将是:
readonly start: number;
readonly end: number;
readonly somewhere: number;
注意现在如何开始和结束。 反正有可能吗?
好吧,这很愚蠢。
我认为在TypeScript 2.8中这是可能的:
interface Partials {
readonly start?: number;
readonly end?: number;
}
interface NotPartials extends Required<Partials> {
readonly somewhere: number;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.