(这是对我的的跟进。)
我有一个名为Copyable的接口,它只有一个函数
Copyable getObjectCopy();
这是许多其他类使用的。因为这个函数总是返回一个Copyable,所以它会导致未检查的强制转换。示例:
@SuppressWarnings("unchecked") //Copy of itself is the same type.
ValidateValue<L> vvo = (ValidateValue<O>)this_toCopy.getValidator().getObjectCopy();
vvBlkA = vvo;
我试着学习和理解打字本概论,但我被以下情况所困扰:
class A {
helloworld() {
console.log('hello world a')
}
}
interface IConfig<T extends typeof A> {
class: T
}
function testing<T extends typeof A>(config?: IConfig<T>) {
if (config === undefined) {
config = {class: