fix(53138): go-to-definition not working on expression of SatisfiesExpression#53164
Conversation
| //////somewhere in app | ||
| ////STRINGS.[|/*usage*/title|] | ||
|
|
||
| // verify.goToDefinition("usage", "definition"); |
| @@ -0,0 +1,14 @@ | |||
| /// <reference path="./fourslash.ts"/> | |||
|
|
|||
| // @noImplicitOverride: true | |||
There was a problem hiding this comment.
😅 It's copied from other files accidentally.
src/services/goToDefinition.ts
Outdated
| const contextualType = element && typeChecker.getContextualType(element.parent); | ||
| if (contextualType) { | ||
| return flatMap(getPropertySymbolsFromContextualType(element, typeChecker, contextualType, /*unionSymbolOk*/ false), propertySymbol => | ||
| const definitions = flatMap(getPropertySymbolsFromContextualType(element, typeChecker, contextualType, /*unionSymbolOk*/ false), propertySymbol => |
There was a problem hiding this comment.
This seems okay, though, I half wonder if it's better to change this to always return an empty array, then fix the one caller who cares about undefined to check length instead. Maybe Andrew has further comments here.
There was a problem hiding this comment.
I read the usage--you'll have to write the code once somewhere, but moving it to the caller allows the other caller to be simplified, since it is getDefinitionFromObjectLiteralElement(checker, node) || [] right now. I vote to make this change.
src/services/goToDefinition.ts
Outdated
| const contextualType = element && typeChecker.getContextualType(element.parent); | ||
| if (contextualType) { | ||
| return flatMap(getPropertySymbolsFromContextualType(element, typeChecker, contextualType, /*unionSymbolOk*/ false), propertySymbol => | ||
| const definitions = flatMap(getPropertySymbolsFromContextualType(element, typeChecker, contextualType, /*unionSymbolOk*/ false), propertySymbol => |
There was a problem hiding this comment.
I read the usage--you'll have to write the code once somewhere, but moving it to the caller allows the other caller to be simplified, since it is getDefinitionFromObjectLiteralElement(checker, node) || [] right now. I vote to make this change.
|
I had to switch this to the baseline format -- I think maybe the non-baseline verifier got removed recently? |
Fixes #53138