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

fix(lsp/check): don't resolve unknown media types to a .js extension #27631

Merged
merged 4 commits into from
Jan 11, 2025

Conversation

nathanwhit
Copy link
Member

@nathanwhit nathanwhit commented Jan 10, 2025

Fixes #25762. Note that some of the things in that issue are not resolved (vite/client types not working properly which has other root causes), but the wildcard module augmentation specifically is fixed by this.

We were telling TSC that files with unknown media types had an extension of .js, so the ambient module declarations weren't applying. Instead, just don't resolve them, so the ambient declaration applies.

Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test? :)

Copy link
Collaborator

@nayeemrmn nayeemrmn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if it works

Comment on lines +17189 to +17258
assert_eq!(diagnostics.all().len(), 0);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we client.shutdown() here for consistency? Probably fine if we don't though

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could remove all of those. I've also just been keeping up the song and dance when writing those tests lol

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably be testing in at least one if the process ends itself upon shutdown, but I think in all of these we're just forcefully ending the process after sending the notification..

Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM too

@nathanwhit nathanwhit enabled auto-merge (squash) January 11, 2025 03:25
@nathanwhit nathanwhit merged commit 70c822b into denoland:main Jan 11, 2025
17 checks passed
bartlomieju pushed a commit that referenced this pull request Jan 16, 2025
#27631)

Fixes #25762. Note that some of
the things in that issue are not resolved (vite/client types not working
properly which has other root causes), but the wildcard module
augmentation specifically is fixed by this.

We were telling TSC that files with unknown media types had an extension
of `.js`, so the ambient module declarations weren't applying. Instead,
just don't resolve them, so the ambient declaration applies.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wildcard module augmentation in TypeScript does not work
3 participants