@@ -96,12 +96,6 @@ namespace ts.GoToDefinition {
96
96
return getDefinitionFromSymbol ( typeChecker , symbol , node ) ;
97
97
}
98
98
99
- function isShorthandPropertyAssignmentOfModuleExports ( symbol : Symbol ) : boolean {
100
- const shorthandProperty = tryCast ( symbol . valueDeclaration , isShorthandPropertyAssignment ) ;
101
- const binaryExpression = tryCast ( shorthandProperty ?. parent . parent , isAssignmentExpression ) ;
102
- return ! ! binaryExpression && getAssignmentDeclarationKind ( binaryExpression ) === AssignmentDeclarationKind . ModuleExports ;
103
- }
104
-
105
99
/**
106
100
* True if we should not add definitions for both the signature symbol and the definition symbol.
107
101
* True for `const |f = |() => 0`, false for `function |f() {} const |g = f;`.
@@ -204,29 +198,15 @@ namespace ts.GoToDefinition {
204
198
}
205
199
206
200
function getSymbol ( node : Node , checker : TypeChecker ) : Symbol | undefined {
207
- let symbol = checker . getSymbolAtLocation ( node ) ;
201
+ const symbol = checker . getSymbolAtLocation ( node ) ;
208
202
// If this is an alias, and the request came at the declaration location
209
203
// get the aliased symbol instead. This allows for goto def on an import e.g.
210
204
// import {A, B} from "mod";
211
205
// to jump to the implementation directly.
212
- while ( symbol ) {
213
- if ( symbol . flags & SymbolFlags . Alias && shouldSkipAlias ( node , symbol . declarations [ 0 ] ) ) {
214
- const aliased = checker . getAliasedSymbol ( symbol ) ;
215
- if ( ! aliased . declarations ) {
216
- break ;
217
- }
218
- symbol = aliased ;
219
- }
220
- else if ( isShorthandPropertyAssignmentOfModuleExports ( symbol ) ) {
221
- // Skip past `module.exports = { Foo }` even though 'Foo' is not a real alias
222
- const shorthandTarget = checker . resolveName ( symbol . name , symbol . valueDeclaration , SymbolFlags . Value , /*excludeGlobals*/ false ) ;
223
- if ( ! some ( shorthandTarget ?. declarations ) ) {
224
- break ;
225
- }
226
- symbol = shorthandTarget ;
227
- }
228
- else {
229
- break ;
206
+ if ( symbol && symbol . flags & SymbolFlags . Alias && shouldSkipAlias ( node , symbol . declarations [ 0 ] ) ) {
207
+ const aliased = checker . getAliasedSymbol ( symbol ) ;
208
+ if ( aliased . declarations ) {
209
+ return aliased ;
230
210
}
231
211
}
232
212
return symbol ;
0 commit comments