@@ -2818,9 +2818,11 @@ namespace ts {
2818
2818
const parameterDeclaration = getDeclarationOfKind<ParameterDeclaration>(parameterSymbol, SyntaxKind.Parameter);
2819
2819
const modifiers = parameterDeclaration.modifiers && parameterDeclaration.modifiers.map(getSynthesizedClone);
2820
2820
const dotDotDotToken = isRestParameter(parameterDeclaration) ? createToken(SyntaxKind.DotDotDotToken) : undefined;
2821
- const name = parameterDeclaration.name.kind === SyntaxKind.Identifier ?
2822
- setEmitFlags(getSynthesizedClone(parameterDeclaration.name), EmitFlags.NoAsciiEscaping) :
2823
- cloneBindingName(parameterDeclaration.name);
2821
+ const name = parameterDeclaration.name ?
2822
+ parameterDeclaration.name.kind === SyntaxKind.Identifier ?
2823
+ setEmitFlags(getSynthesizedClone(parameterDeclaration.name), EmitFlags.NoAsciiEscaping) :
2824
+ cloneBindingName(parameterDeclaration.name) :
2825
+ parameterSymbol.name;
2824
2826
const questionToken = isOptionalParameter(parameterDeclaration) ? createToken(SyntaxKind.QuestionToken) : undefined;
2825
2827
2826
2828
let parameterType = getTypeOfSymbol(parameterSymbol);
@@ -6696,8 +6698,10 @@ namespace ts {
6696
6698
return length(type.target.typeParameters);
6697
6699
}
6698
6700
6699
- // Get type from reference to class or interface
6700
- function getTypeFromClassOrInterfaceReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference, symbol: Symbol, typeArgs: Type[]): Type {
6701
+ /**
6702
+ * Get type from type-reference that reference to class or interface
6703
+ */
6704
+ function getTypeFromClassOrInterfaceReference(node: TypeReferenceType, symbol: Symbol, typeArgs: Type[]): Type {
6701
6705
const type = <InterfaceType>getDeclaredTypeOfSymbol(getMergedSymbol(symbol));
6702
6706
const typeParameters = type.localTypeParameters;
6703
6707
if (typeParameters) {
@@ -6738,10 +6742,12 @@ namespace ts {
6738
6742
return instantiation;
6739
6743
}
6740
6744
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 {
6745
+ /**
6746
+ * Get type from reference to type alias. When a type alias is generic, the declared type of the type alias may include
6747
+ * references to the type parameters of the alias. We replace those with the actual type arguments by instantiating the
6748
+ * declared type. Instantiations are cached using the type identities of the type arguments as the key.
6749
+ */
6750
+ function getTypeFromTypeAliasReference(node: TypeReferenceType, symbol: Symbol, typeArguments: Type[]): Type {
6745
6751
const type = getDeclaredTypeOfSymbol(symbol);
6746
6752
const typeParameters = getSymbolLinks(symbol).typeParameters;
6747
6753
if (typeParameters) {
@@ -6766,16 +6772,18 @@ namespace ts {
6766
6772
return type;
6767
6773
}
6768
6774
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 {
6775
+ /**
6776
+ * Get type from reference to named type that cannot be generic (enum or type parameter)
6777
+ */
6778
+ function getTypeFromNonGenericTypeReference(node: TypeReferenceType, symbol: Symbol): Type {
6771
6779
if (node.typeArguments) {
6772
6780
error(node, Diagnostics.Type_0_is_not_generic, symbolToString(symbol));
6773
6781
return unknownType;
6774
6782
}
6775
6783
return getDeclaredTypeOfSymbol(symbol);
6776
6784
}
6777
6785
6778
- function getTypeReferenceName(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference ): EntityNameOrEntityNameExpression | undefined {
6786
+ function getTypeReferenceName(node: TypeReferenceType ): EntityNameOrEntityNameExpression | undefined {
6779
6787
switch (node.kind) {
6780
6788
case SyntaxKind.TypeReference:
6781
6789
return (<TypeReferenceNode>node).typeName;
@@ -6803,7 +6811,7 @@ namespace ts {
6803
6811
return resolveEntityName(typeReferenceName, SymbolFlags.Type) || unknownSymbol;
6804
6812
}
6805
6813
6806
- function getTypeReferenceType(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference , symbol: Symbol) {
6814
+ function getTypeReferenceType(node: TypeReferenceType , symbol: Symbol) {
6807
6815
const typeArguments = typeArgumentsFromTypeReferenceNode(node); // Do unconditionally so we mark type arguments as referenced.
6808
6816
6809
6817
if (symbol === unknownSymbol) {
@@ -6846,7 +6854,7 @@ namespace ts {
6846
6854
case "Object":
6847
6855
return anyType;
6848
6856
case "Function":
6849
- return anyFunctionType ;
6857
+ return globalFunctionType ;
6850
6858
case "Array":
6851
6859
case "array":
6852
6860
return !node.typeArguments || !node.typeArguments.length ? createArrayType(anyType) : undefined;
@@ -6862,7 +6870,7 @@ namespace ts {
6862
6870
return strictNullChecks ? getUnionType([type, nullType]) : type;
6863
6871
}
6864
6872
6865
- function getTypeFromTypeReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference ): Type {
6873
+ function getTypeFromTypeReference(node: TypeReferenceType ): Type {
6866
6874
const links = getNodeLinks(node);
6867
6875
if (!links.resolvedType) {
6868
6876
let symbol: Symbol;
@@ -6893,7 +6901,7 @@ namespace ts {
6893
6901
return links.resolvedType;
6894
6902
}
6895
6903
6896
- function typeArgumentsFromTypeReferenceNode(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference ): Type[] {
6904
+ function typeArgumentsFromTypeReferenceNode(node: TypeReferenceType ): Type[] {
6897
6905
return map(node.typeArguments, getTypeFromTypeNode);
6898
6906
}
6899
6907
0 commit comments