mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Backfill TypeReference.typeArguments in the API (#33714)
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -68,6 +68,10 @@ namespace ts {
|
||||
isClass(): this is InterfaceType;
|
||||
}
|
||||
|
||||
export interface TypeReference {
|
||||
typeArguments?: readonly Type[];
|
||||
}
|
||||
|
||||
export interface Signature {
|
||||
getDeclaration(): SignatureDeclaration;
|
||||
getTypeParameters(): TypeParameter[] | undefined;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user