Skip to content

Commit 6f734d6

Browse files
committed
Addressing CR feedback
1 parent f0ac90f commit 6f734d6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/compiler/checker.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -1535,6 +1535,8 @@ module ts {
15351535
}
15361536

15371537
function writeSymbolTypeReference(symbol: Symbol, typeArguments: Type[], pos: number, end: number) {
1538+
// Unnamed function expressions, arrow functions, and unnamed class expressions have reserved names that
1539+
// we don't want to display
15381540
if (!isReservedMemberName(symbol.name)) {
15391541
buildSymbolDisplay(symbol, writer, enclosingDeclaration, SymbolFlags.Type);
15401542
}
@@ -3522,8 +3524,12 @@ module ts {
35223524
let expectedTypeArgCount = localTypeParameters ? localTypeParameters.length : 0;
35233525
let typeArgCount = node.typeArguments ? node.typeArguments.length : 0;
35243526
if (typeArgCount === expectedTypeArgCount) {
3525-
type = createTypeReference(<GenericType>type, concatenate((<InterfaceType>type).outerTypeParameters,
3526-
map(node.typeArguments, getTypeFromTypeNode)));
3527+
// When no type arguments are expected we already have the right type because all outer type parameters
3528+
// have themselves as default type arguments.
3529+
if (typeArgCount) {
3530+
type = createTypeReference(<GenericType>type, concatenate((<InterfaceType>type).outerTypeParameters,
3531+
map(node.typeArguments, getTypeFromTypeNode)));
3532+
}
35273533
}
35283534
else {
35293535
error(node, Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, /*enclosingDeclaration*/ undefined, TypeFormatFlags.WriteArrayAsGenericType), expectedTypeArgCount);

0 commit comments

Comments
 (0)