Problem
The TypeScript frontend records a superclass only by its class signature. It drops type arguments from an extends clause. A field inherited from a generic base therefore keeps an unresolved T even when the subclass fixes T to a specific runtime constructor type.
Minimal TypeScript example
class A {}
class Base<T> { ctor!: T; }
class Child extends Base<typeof A> {}
export function check(value: Child): boolean {
return typeof value.ctor === "function";
}
For const child = new Child(); child.ctor = A, check(child) is true in Node.js. The current EtsIR contains Child.superClassName = Base and Base.ctor: GenericType(T) but no typeof A substitution from Child extends Base<typeof A>.
Expected support
Preserve superclass type arguments in the EtsIR class model and JSON/Kotlin round trip. Substitute them when resolving inherited field and method types; do not infer the runtime field value solely from the substituted type. Until a consumer models a constructor-valued field input, it should report that input as explicitly unsupported rather than a completed false typeof result.
Acceptance criteria
- A native frontend regression checks the
Child extends Base<typeof A> relation and inherited ctor type after substitution, including JSON round trip.
- A second regression covers a multi-level generic inheritance chain and an unrelated class with the same name in another file, so substitution follows class identity rather than name alone.
- Existing nongeneric
extends and inherited member resolution remain correct.
Found while reviewing UnitTestBot/usvm#464. That PR guards the unmodeled input conservatively; this issue tracks the missing frontend type relation separately.
Problem
The TypeScript frontend records a superclass only by its class signature. It drops type arguments from an
extendsclause. A field inherited from a generic base therefore keeps an unresolvedTeven when the subclass fixesTto a specific runtime constructor type.Minimal TypeScript example
For
const child = new Child(); child.ctor = A,check(child)istruein Node.js. The current EtsIR containsChild.superClassName = BaseandBase.ctor: GenericType(T)but notypeof Asubstitution fromChild extends Base<typeof A>.Expected support
Preserve superclass type arguments in the EtsIR class model and JSON/Kotlin round trip. Substitute them when resolving inherited field and method types; do not infer the runtime field value solely from the substituted type. Until a consumer models a constructor-valued field input, it should report that input as explicitly unsupported rather than a completed false
typeofresult.Acceptance criteria
Child extends Base<typeof A>relation and inheritedctortype after substitution, including JSON round trip.extendsand inherited member resolution remain correct.Found while reviewing UnitTestBot/usvm#464. That PR guards the unmodeled input conservatively; this issue tracks the missing frontend type relation separately.