testing-library / testing-library/user-event
moduleResolution: "nodenext" on tsconfig cannot resolve userEvent
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 258
- PR merge metrics
- No merged PRs in 30d
Description
Reproduction example
Prerequisites
Setup a tsconfig.json with moduleResolution "nodenext".
Expected behavior
the following code snippet should build:
import userEvent from '@testing-library/user-event';
test('user event', () => {
userEvent.setup();
})
Actual behavior
Line 4 fails with
Property 'setup' does not exist on type 'typeof import("${HOME}/Projects/repro/node_modules/@testing-library/user-event/dist/types/index")'.
User-event version
14.4.3
Environment
No response
Additional context
When running jest, the issue only happens if I set the preset to ts-jest. When using babel, the test runs fine--you can check on the repo https://github.com/ricardo-passthrough/userevent-nodenext-repro/tree/babel-test.
Clicking through the import in VSCode sends me to node_modules/@testing-library/user-event/dist/types/index.d.ts.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproduction's tsconfig.json and the package entry points referenced by the import, especially dist/types/index.d.ts. Run the provided TypeScript/Jest reproduction with moduleResolution set to "nodenext" and compare it with the Babel setup. Done means the example builds and userEvent.setup() is correctly available under the affected configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100