@@ -6696,8 +6696,10 @@ namespace ts {
6696
6696
return length(type.target.typeParameters);
6697
6697
}
6698
6698
6699
- // Get type from reference to class or interface
6700
- function getTypeFromClassOrInterfaceReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference, symbol: Symbol, typeArgs: Type[]): Type {
6699
+ /**
6700
+ * Get type from type-reference that reference to class or interface
6701
+ */
6702
+ function getTypeFromClassOrInterfaceReference(node: TypeReferenceType, symbol: Symbol, typeArgs: Type[]): Type {
6701
6703
const type = <InterfaceType>getDeclaredTypeOfSymbol(getMergedSymbol(symbol));
6702
6704
const typeParameters = type.localTypeParameters;
6703
6705
if (typeParameters) {
@@ -6738,10 +6740,12 @@ namespace ts {
6738
6740
return instantiation;
6739
6741
}
6740
6742
6741
- // Get type from reference to type alias. When a type alias is generic, the declared type of the type alias may include
6742
- // references to the type parameters of the alias. We replace those with the actual type arguments by instantiating the
6743
- // declared type. Instantiations are cached using the type identities of the type arguments as the key.
6744
- function getTypeFromTypeAliasReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference, symbol: Symbol, typeArguments: Type[]): Type {
6743
+ /**
6744
+ * Get type from reference to type alias. When a type alias is generic, the declared type of the type alias may include
6745
+ * references to the type parameters of the alias. We replace those with the actual type arguments by instantiating the
6746
+ * declared type. Instantiations are cached using the type identities of the type arguments as the key.
6747
+ */
6748
+ function getTypeFromTypeAliasReference(node: TypeReferenceType, symbol: Symbol, typeArguments: Type[]): Type {
6745
6749
const type = getDeclaredTypeOfSymbol(symbol);
6746
6750
const typeParameters = getSymbolLinks(symbol).typeParameters;
6747
6751
if (typeParameters) {
@@ -6766,16 +6770,18 @@ namespace ts {
6766
6770
return type;
6767
6771
}
6768
6772
6769
- // Get type from reference to named type that cannot be generic (enum or type parameter)
6770
- function getTypeFromNonGenericTypeReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference, symbol: Symbol): Type {
6773
+ /**
6774
+ * Get type from reference to named type that cannot be generic (enum or type parameter)
6775
+ */
6776
+ function getTypeFromNonGenericTypeReference(node: TypeReferenceType, symbol: Symbol): Type {
6771
6777
if (node.typeArguments) {
6772
6778
error(node, Diagnostics.Type_0_is_not_generic, symbolToString(symbol));
6773
6779
return unknownType;
6774
6780
}
6775
6781
return getDeclaredTypeOfSymbol(symbol);
6776
6782
}
6777
6783
6778
- function getTypeReferenceName(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference ): EntityNameOrEntityNameExpression | undefined {
6784
+ function getTypeReferenceName(node: TypeReferenceType ): EntityNameOrEntityNameExpression | undefined {
6779
6785
switch (node.kind) {
6780
6786
case SyntaxKind.TypeReference:
6781
6787
return (<TypeReferenceNode>node).typeName;
@@ -6803,7 +6809,7 @@ namespace ts {
6803
6809
return resolveEntityName(typeReferenceName, SymbolFlags.Type) || unknownSymbol;
6804
6810
}
6805
6811
6806
- function getTypeReferenceType(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference , symbol: Symbol) {
6812
+ function getTypeReferenceType(node: TypeReferenceType , symbol: Symbol) {
6807
6813
const typeArguments = typeArgumentsFromTypeReferenceNode(node); // Do unconditionally so we mark type arguments as referenced.
6808
6814
6809
6815
if (symbol === unknownSymbol) {
@@ -6862,7 +6868,7 @@ namespace ts {
6862
6868
return strictNullChecks ? getUnionType([type, nullType]) : type;
6863
6869
}
6864
6870
6865
- function getTypeFromTypeReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference ): Type {
6871
+ function getTypeFromTypeReference(node: TypeReferenceType ): Type {
6866
6872
const links = getNodeLinks(node);
6867
6873
if (!links.resolvedType) {
6868
6874
let symbol: Symbol;
@@ -6893,7 +6899,7 @@ namespace ts {
6893
6899
return links.resolvedType;
6894
6900
}
6895
6901
6896
- function typeArgumentsFromTypeReferenceNode(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference ): Type[] {
6902
+ function typeArgumentsFromTypeReferenceNode(node: TypeReferenceType ): Type[] {
6897
6903
return map(node.typeArguments, getTypeFromTypeNode);
6898
6904
}
6899
6905
0 commit comments