Skip to content
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

Conversation

Andarist
Copy link
Contributor

@Andarist Andarist commented Jul 6, 2024

fixes #59159

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Jul 6, 2024
@@ -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) {
Copy link
Contributor Author

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);`,
Copy link
Contributor Author

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.

@andrewbranch andrewbranch self-assigned this Jul 9, 2024
@andrewbranch
Copy link
Member

@typescript-bot cherry-pick to release-5.5

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 10, 2024

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
cherry-pick to release-5.5 ✅ Started ✅ Results

@typescript-bot
Copy link
Collaborator

Hey, @andrewbranch! I've created #59226 for you.

@DanielRosenwasser DanielRosenwasser added this to the TypeScript 5.5.4 milestone Jul 17, 2024
@typescript-bot typescript-bot added For Milestone Bug PRs that fix a bug with a specific milestone and removed For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Jul 17, 2024
@DanielRosenwasser DanielRosenwasser merged commit 4506240 into microsoft:main Jul 17, 2024
29 checks passed
DanielRosenwasser pushed a commit that referenced this pull request Jul 17, 2024
…e-5.5 (#59226)

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Milestone Bug PRs that fix a bug with a specific milestone
Projects
Status: Done
4 participants