typeChecker.getTypeArguments(referenceType) returns a list of type arguments of all local and parent/outer type parameters as well as sometimes another type argument for the this type.
Luckily the order is deterministic and we can use referenceType.target.{outer,local}TypeParameters to figure out which ones we need to emit.
This also adds logging, just in case my understanding of TypeScript's API is not correct.
Fix number of type args
typeChecker.getTypeArguments(referenceType)
returns a list of type arguments of all local and parent/outer type parameters as well as sometimes another type argument for thethis
type.Luckily the order is deterministic and we can use
referenceType.target.{outer,local}TypeParameters
to figure out which ones we need to emit.This also adds logging, just in case my understanding of TypeScript's API is not correct.