如何从Typescript中的类数组中排除属性类型
在typescript中,是否可以从嵌套在另一个类中的数组中的一个类中深度移除一个道具?例如,这种方式:
class Nested {
propX!: string;
propY!: string;
propZ!: string;
}
class Parent {
propA!: string;
propB!: number;
propC!: string;
nesteds!: Nested[];
}
// remove propZ from nesteds in Parrant class
class ParentInput implement Exclude<Parent, 'propC'|'nesteds.propZ'> {
//...
}
转载请注明出处:http://www.dbgszz.com/article/20230330/915896.html