You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Incorrect types are causing errors when using TypeScript with moduleResolution set to node16 or nodenext #1146
Just spreading awareness, typescript-eslint has dropped node10 support meaning anyone using typescript-eslint@6 or above (which only supports node16 and above module resolution) and @testing-library/user-event (which only supports node10 resolution due to this bug) are incompatible with one another.
@wojtekmaj FYI there seems to be a bug in the typescript playground (not the link you sent but the playground itself) preventing your reproduction from loading correctly. Some additional steps:
We keep the default export for backward compatibility and there's still a bit of an issue with the types masquerading as ESM, but at least this should unblock most folks.
Unfortunately I don't have any more time to improve things more officially.
Reacted by silverwind, Corban Riley and fregante
Reacted by henry, Wojciech Maj, Paul Shryock, Oussama MESSAOUDI, Dustin Ruetz, fregante and victoria-fedev
I use 14.5.0 and import { userEvent } from '@testing-library/user-event'; and getting error:
./node_modules/@testing-library/user-event/dist/esm/_interop/dtl.js:3:61-73 - Error: export 'default' (imported as 'def__default') was not found in '@testing-library/dom'
Reacted by Michaël Perrin, kle-pra, Yann Braga, Lucas Curti and Joshua Unrau
I have the same error as @sysmat when running StoryBook with version 14.5.0 of the @testing-library/user-event library. I will try to provide more details about that issue.
Activity
Add TypeScript config that checks module resolution
k2snowman69 commentedon Aug 6, 2023
Just spreading awareness, typescript-eslint has dropped node10 support meaning anyone using typescript-eslint@6 or above (which only supports node16 and above module resolution) and @testing-library/user-event (which only supports node10 resolution due to this bug) are incompatible with one another.
@wojtekmaj FYI there seems to be a bug in the typescript playground (not the link you sent but the playground itself) preventing your reproduction from loading correctly. Some additional steps:
You should now see the error originally mentioned
kentcdodds commentedon Aug 8, 2023
For anyone looking for a workaround until this is fixed, you can add this to the top of your test file:
k2snowman69 commentedon Aug 8, 2023
This workaround worked unblocked me and it should be forward compatible whenever it gets fixed.
fix(exports): add a named export for userEvent
kentcdodds commentedon Sep 14, 2023
I just pushed and published a quick fix in
@testing-library/user-event@14.5.0. So now you can use a named import:And this won't have the same problems.
We keep the default export for backward compatibility and there's still a bit of an issue with the types masquerading as ESM, but at least this should unblock most folks.
Unfortunately I don't have any more time to improve things more officially.
sysmat commentedon Sep 15, 2023
michaelperrin commentedon Sep 15, 2023
I have the same error as @sysmat when running StoryBook with version 14.5.0 of the @testing-library/user-event library. I will try to provide more details about that issue.
yannbf commentedon Sep 15, 2023
Hey @kentcdodds as others have stated, this release ended up having unfortunate side effects.
I created an issue with reproduction steps here: #1160
@michaelperrin (and any other Storybook users): I just released v0.2.1 with a temporary fix for this issue.
Update @testing-library/user-event to fix :check
Update @testing-library/user-event to fix :check
Update @testing-library/user-event to fix :check
Update @testing-library/user-event to fix :check
djalmaaraujo commentedon Apr 3, 2024
I still can't make it work using 14.5.0. Anyone?
ryaa commentedon Apr 5, 2024
This workaround worked for me #1146 (comment)
Update dependency @testing-library/user-event to v14.5.2 (#47)