Repository navigation
fix: match ESM matcher declarations to named runtime exports - #746
Open
rishilifts wants to merge 5 commits into
Open
rishilifts wants to merge 5 commits into
rishilifts wants to merge 5 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #744.
What: Give the
./matchersimport condition an ESM declaration file with named exports. Keep the existing CommonJS declaration for the require condition.Why: A dynamic import currently has a phantom
defaultin its type, although the ESM module only exports named matchers. This makes Bun'sexpect.extend(await import(...))fail type-checking.How: Reuse the standalone matcher signatures in a
.d.mtsdeclaration. Added Bundler and Node16 type fixtures for static and dynamic imports, absence ofdefault, the complete matcher key set, the exported interface and bothtoHaveClassoverloads.Validation:
The test run needs
FORCE_COLOR=1in this environment because diagnostic snapshots contain ANSI colors. Without it, the same 100 snapshot mismatches occur on the unchanged baseline; no snapshots were updated.Checklist: