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
This happens because the name of the types file ends with .d.ts which, according to its closest package.json, causes TypeScript to be treated as a types file that defines a CommonJS module.
If I put a package.json file in ./dist/types with "type": "module" then the type errors go away, and the .d.ts file gets treated as ESM. Though I guess this could break the types if you try and require it.
Reproduction example
Note: unable to provide a codesandbox link due to the inability to control the version of TypeScript used by the IDE
Prerequisites
typescript@4.8.3
@testing-library/user-event@14.4.3
type: module
moduleResolution
set toNode16
Expected behavior
userEvent
should be the default export of the moduleActual behavior
userEvent
is exported as a named export calleddefault
User-event version
14.4.3
Environment
Testing Library framework:
JS framework:
Test environment:
DOM implementation:
Additional context
This may be invalid for Node 16's ESM spec.
I suspect changing it to the following will resolve the issue:
The text was updated successfully, but these errors were encountered: