Skip to content

Fix Queries type export leaking into js build outputs #4

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

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

aryaemami59
Copy link
Contributor

In vitest it was causing this error:

SyntaxError: Named export 'Queries' not found. The requested module '@testing-library/dom' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@testing-library/dom';
const { Queries } = pkg;

For some reason the Queries type export ended up in js outputs.

@@ -1,6 +1,6 @@
import {queries} from '@testing-library/dom'

export {Queries} from '@testing-library/dom'
export type {Queries} from '@testing-library/dom'
Copy link
Member

Choose a reason for hiding this comment

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

Good catch!

Could be that eslint will expect this to be inside the {}, could you please check that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I checked, ESLint seems to prefer the type keyword to be outside the {}, but if you prefer it the other way around I can still change it.

Copy link
Member

Choose a reason for hiding this comment

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

Nah, I'm fine with this, I just remember fighting ESLint over this yesterday :)
Thanks for the PR!

Copy link

pkg-pr-new bot commented Oct 11, 2024

yarn@berry undefined https://pkg.pr.new/testing-library/react-render-stream-testing-library/@testing-library/react-render-stream@4

commit: 6f0432d

@phryneas phryneas merged commit d0851bc into testing-library:main Oct 11, 2024
4 checks passed
@aryaemami59 aryaemami59 deleted the fix-type-export branch October 11, 2024 19:13
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.

2 participants