我不明白爲什麼需要打字原稿明確泛型類型定義爲Child2和Child3在這種情況下: abstract class Base {
public static A: string = "Fallback_A";
public DoSmthWithClassName(): string {
return "Fallback_DoSmth";
}
c
我有以下的一般類的打字稿 type UserId = number
type Primative = string | number | boolean
class ColumnValue<T, S extends Primative> {
constructor(public columnName: String, public value: S) { }
}
abstract
我認爲這是一個正確實現泛型的問題,但我不確定。 我創建代表這裏的問題Github的要點是: https://gist.github.com/ORESoftware/66b72b4b85262d957cb03ad097e4743e 說我有這個超: class A {
foo(): A {
return this;
}
}
和幾個子類,一個例子看起來像