-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support quick info and go to definition on mapped keys #61061
base: main
Are you sure you want to change the base?
Conversation
Looks like you're introducing a change to the public API surface area. If this includes breaking changes, please document them on our wiki's API Breaking Changes page. Also, please make sure @DanielRosenwasser and @RyanCavanaugh are aware of the changes, just as a heads up. |
Honestly this feels right to me? @typescript-bot test it |
@jakebailey Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
Hey @jakebailey, the results of running the DT tests are ready. Everything looks the same! |
@jakebailey Here are the results of running the user tests with tsc comparing Everything looks good! |
@@ -595,7 +597,8 @@ function isExpandoDeclaration(node: Declaration): boolean { | |||
} | |||
|
|||
function getDefinitionFromSymbol(typeChecker: TypeChecker, symbol: Symbol, node: Node, failedAliasResolution?: boolean, declarationFilter?: (d: Declaration) => boolean): DefinitionInfo[] | undefined { | |||
const filteredDeclarations = declarationFilter !== undefined ? filter(symbol.declarations, declarationFilter) : symbol.declarations; | |||
const declarations = isTransientSymbol(symbol) && symbol.links.checkFlags & CheckFlags.Mapped && !symbol.declarations?.length ? symbol.links.syntheticOrigin?.declarations : symbol.declarations; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find it sort of concerning to reach into the links
like this; I can see maybe one or two other cases where we've done symbol.links
outside the checker and I can't say I like those either. Is there no other way to do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with your concern about reaching into symbol.links. I think there might be a better way to handle this. Maybe we can create a helper function that gets the documentation from the original symbol without directly accessing links. That would make the code more maintainable and less dependent on internal implementation details.
Fixes #50715, Fixes #56019, Fixes #61094
As mentioned in this comment on GitHub (#50715 (comment)), the
@inheritDoc
tag is necessary to enable features like quick info and go to definition.