Skip to content

Commit 2710ea8

Browse files
committed
Fix crash in goto-def on @override
When the base type is not defined, getDefinitionFromOverriddenMember will have its type as errorType, which has no symbol. The error handling previously only handled the case of no baseType at all -- which I'm not sure ever actually happens.
1 parent c81bf4d commit 2710ea8

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/services/goToDefinition.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ namespace ts.GoToDefinition {
176176

177177
const name = unescapeLeadingUnderscores(getTextOfPropertyName(classElement.name));
178178
const symbol = hasStaticModifier(classElement)
179-
? typeChecker.getPropertyOfType(typeChecker.getTypeOfSymbolAtLocation(baseType.symbol, baseDeclaration), name)
179+
? baseType.symbol && typeChecker.getPropertyOfType(typeChecker.getTypeOfSymbolAtLocation(baseType.symbol, baseDeclaration), name)
180180
: typeChecker.getPropertyOfType(baseType, name);
181181
if (!symbol) return;
182182

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/// <reference path="fourslash.ts" />
2+
// @Filename: goToDefinitionOverrideJsdoc.ts
3+
// @allowJs: true
4+
// @checkJs: true
5+
6+
//// export class C extends CompletelyUndefined {
7+
//// /**
8+
//// * @override/*1*/
9+
//// * @returns {{}}
10+
//// */
11+
//// static foo() {
12+
//// return {}
13+
//// }
14+
//// }
15+
16+
verify.goToDefinition(['1'], [])

0 commit comments

Comments
 (0)