diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ce0d28b68533b..4016d82dafd9a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -49143,15 +49143,14 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return resolveJSDocMemberName(name); } } - else if (isTypeReferenceIdentifier(name as EntityName)) { + else if (isEntityName(name) && isTypeReferenceIdentifier(name)) { const meaning = name.parent.kind === SyntaxKind.TypeReference ? SymbolFlags.Type : SymbolFlags.Namespace; - const symbol = resolveEntityName(name as EntityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); - return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name as EntityName); + const symbol = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); + return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name); } if (name.parent.kind === SyntaxKind.TypePredicate) { return resolveEntityName(name as Identifier, /*meaning*/ SymbolFlags.FunctionScopedVariable); } - return undefined; } diff --git a/tests/cases/fourslash/quickInfoPrivateIdentifierInTypeReferenceNoCrash1.ts b/tests/cases/fourslash/quickInfoPrivateIdentifierInTypeReferenceNoCrash1.ts new file mode 100644 index 0000000000000..89bb8d7a8ee62 --- /dev/null +++ b/tests/cases/fourslash/quickInfoPrivateIdentifierInTypeReferenceNoCrash1.ts @@ -0,0 +1,13 @@ +/// + +// @target: esnext + +//// class Foo { +//// #prop: string = ""; +//// +//// method() { +//// const test: Foo.#prop/*1*/ = ""; +//// } +//// } + +verify.quickInfoAt("1", "");