0
내가 동일한 기능 여기상속이
와 클래스의 배열을 구현하는 방법에 문제가있어 나에게 오류가 제공
interface I<T> {
}
class A<T> implements I<T> {
constructor() {
}
}
class B implements I<number> {
constructor() {
}
}
class C<T> implements I<T> {
private arrr: I<T> [] = [];
constructor() {
this.arrr.push(new A<T>());
this.arrr.push(new B());
}
}
을 제공하는 GOT가 나 오류가 Type is not assignable to type I<T>
* this.arrr.push(new B());
*
어떻게 해결할 수 있습니까? Typescript 1.8을 사용하고 있습니다.
을 도움이된다면
참조? – iberbeu
@iberbeu, 업데이트 된 질문 – Ifozest
글쎄'T'와'number'는 호환되지 않을 수도 있습니다 – Bergi