Backfill TypeReference.typeArguments in the API (#33714)

This commit is contained in:
Wesley Wigham
2019-10-02 14:50:12 -07:00
committed by GitHub
parent 08aaf6aae8
commit a8bea77d1e
4 changed files with 19 additions and 0 deletions
+9
View File
@@ -452,6 +452,15 @@ namespace ts {
isClass(): this is InterfaceType {
return !!(getObjectFlags(this) & ObjectFlags.Class);
}
/**
* This polyfills `referenceType.typeArguments` for API consumers
*/
get typeArguments() {
if (getObjectFlags(this) & ObjectFlags.Reference) {
return this.checker.getTypeArguments(this as Type as TypeReference);
}
return undefined;
}
}
class SignatureObject implements Signature {
+4
View File
@@ -68,6 +68,10 @@ namespace ts {
isClass(): this is InterfaceType;
}
export interface TypeReference {
typeArguments?: readonly Type[];
}
export interface Signature {
getDeclaration(): SignatureDeclaration;
getTypeParameters(): TypeParameter[] | undefined;
+3
View File
@@ -4902,6 +4902,9 @@ declare namespace ts {
isClassOrInterface(): this is InterfaceType;
isClass(): this is InterfaceType;
}
interface TypeReference {
typeArguments?: readonly Type[];
}
interface Signature {
getDeclaration(): SignatureDeclaration;
getTypeParameters(): TypeParameter[] | undefined;
+3
View File
@@ -4902,6 +4902,9 @@ declare namespace ts {
isClassOrInterface(): this is InterfaceType;
isClass(): this is InterfaceType;
}
interface TypeReference {
typeArguments?: readonly Type[];
}
interface Signature {
getDeclaration(): SignatureDeclaration;
getTypeParameters(): TypeParameter[] | undefined;