Skip to content

Commit 3334134

Browse files
author
Andy Hanson
committed
Fix #7966: A non-anonymous type can still fail to have a symbol. For example, an intersection type.
(We still need the check for the Anonymous flags or else anonymous function tooltips will look like `var lambdaFoo: (Anonymous function)(a: number, b: number) => number'` instead of `var lambdaFoo: (a: number, b: number) => number`)
1 parent d8d5daf commit 3334134

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/services/services.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4349,7 +4349,7 @@ namespace ts {
43494349
displayParts.push(keywordPart(SyntaxKind.NewKeyword));
43504350
displayParts.push(spacePart());
43514351
}
4352-
if (!(type.flags & TypeFlags.Anonymous)) {
4352+
if (!(type.flags & TypeFlags.Anonymous) && type.symbol) {
43534353
addRange(displayParts, symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, SymbolFormatFlags.WriteTypeParametersOrArguments));
43544354
}
43554355
addSignatureDisplayParts(signature, allSignatures, TypeFormatFlags.WriteArrowStyleSignature);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
////function f(): string & {(): any} {
2+
//// return <any>{};
3+
////}
4+
////let x = f();
5+
////x/**/();
6+
7+
goTo.marker();
8+
verify.quickInfoIs("let x: () => any");

0 commit comments

Comments
 (0)