클래스 인스턴스 배열을 담을 변수를 만들고 싶은데, 원소 타입은 어떤 '기본' 클래스를 상속한 것이면 모두 허용하고 싶어요. 이 클래스 인스턴스 배열 예제가 제 뜻을 더 잘 보여 줄 거예요:
class Parent { } //Common parent
class FirstChild extends Parent { }
class SecondChild extends Parent { }
//How should this declaration look?
let instances: <U extends Parent>U[] = []; //Allow all descedants of 'Parent' here
//Then these calls would work
instances.push(new Parent());
instances.push(new FirstChild());
instances.push(new SecondChild());
미리 감사드립니다.