Skip to content

Conversation

@arendjr
Copy link
Contributor

@arendjr arendjr commented Jun 16, 2025

Summary

Fixes to the resolver that allow for resolving type definitions for files that are explicitly referenced with a JavaScript extension. For instance, when a file is explicitly imported as types.js, we can still pull the types from types.d.ts instead. This is relied upon by some NPM packages such as swr.

As part of this, the resolver API has changed slightly, and .d.ts extensions should no longer be supplied by the consumer of the resolver.

I can confirm that with this change, some imports from the swr package are now recognised correctly, improving inference. The result from the useSWRConfig() call in the test is not yet inferred though.

I've also spotted a few opportunities to avoid allocations inside the resolver, so we don't allocate a new path for every extension we try anymore.

Test Plan

Tests added.

@arendjr arendjr requested review from a team June 16, 2025 13:16
@github-actions github-actions bot added the A-Project Area: project label Jun 16, 2025
@arendjr arendjr merged commit 6a88bab into biomejs:next Jun 16, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Project Area: project

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant