-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Fixed crash on authored import type nodes when serializing for declarations #59160
Fixed crash on authored import type nodes when serializing for declarations #59160
Conversation
@@ -899,8 +899,14 @@ export function tryGetAutoImportableReferenceFromTypeNode(importTypeNode: TypeNo | |||
if (isLiteralImportTypeNode(node) && node.qualifier) { | |||
// Symbol for the left-most thing after the dot | |||
const firstIdentifier = getFirstIdentifier(node.qualifier); | |||
const name = getNameForExportedSymbol(firstIdentifier.symbol, scriptTarget); | |||
const qualifier = name !== firstIdentifier.text | |||
if (!firstIdentifier.symbol) { |
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.
Value-space identifiers get their .symbol
in the binder but type-level identifiers in import type nodes don't.
Alternatively, this could be fixed in visitExistingNodeTreeSymbolsWorker
but it's more tricky there.
includes: [ | ||
{ | ||
name: "method", | ||
insertText: `method(param: import("./doesntexist.js").Foo);`, |
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.
This is weird but not anything new. Return types nodes with errors are omitted based on NodeBuilderFlags.SuppressAnyReturnType
. No mechanism like this for parameters is used.
@typescript-bot cherry-pick to release-5.5 |
Hey, @andrewbranch! I've created #59226 for you. |
…e-5.5 (#59226) Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
fixes #59159