【发布时间】:2022-01-27 00:11:50
【问题描述】:
我有一个界面
export interface Foo {
a: string;
b: string;
}
我现在想要另一个类,它实现了接口的所有键,但可以有另一种类型:
export class Bar implements keysof(Foo) {
a: SomeNewType;
b: SomeNewType2;
}
这在打字稿中可能吗?
背景:我希望Bar 类的键与Foo 同步
【问题讨论】:
标签: typescript