@testing-library/dom version: 7.30.0@testing-library/user-event version: 13.0.1typescript version: 4.2.3Problem description:
The file typings/index.d.ts contains type imports from ../src/ folder, which does not exist in the distributed package, so all those types are resolved to any.
Codesandbox: https://codesandbox.io/s/romantic-shadow-uio28

typings/index.d.ts in the corresponding node_modules folder:

This concerns the following types:
Might be that removing the typings folder and adding declarations of the JS modules in src is easier than to get rollup(?) to resolve these. It's for sure better than to continue maintaining the seperated typings.
Maybe it would be better to do it the same way as other @testing-library packages do it - to have all type declaration files in the types folder with no imports from src. You can see it in the dom-testing-library for example.
I can try fixing it if you agree.
If you fix the typings, I would of course merge it as a fix for now. :rocket:
The seperate typings are necessary because the libraries have been written in JS. I converted a part of this one to TS and planning to convert the rest. So seperate definition files for already converted modules are duplicates that we have to update and review by hand.
The cleaner solution would be to convert src/index.js and add missing module definitions in src.
This means we could drop the typings folder.
Eventually the solution has to be to convert the remaining JS modules to discover the false type assumptions that might be hidden in the code.
:tada: This issue has been resolved in version 13.0.3 :tada:
The release is available on:
npm package (@latest dist-tag)Your semantic-release bot :package::rocket:
@mkapal Thanks a lot for the reports. Please check out the new version. :smiley:
@all-contributors add @mkapal bug
@ph-fritsche
I've put up a pull request to add @mkapal! :tada:
@mkapal Thanks a lot for the reports. Please check out the new version. 馃槂
Unfortunately, it is still not correct. Now the distributed .d.ts files contain any types, and also, there are .d.js files generated, which I'm guessing shouldn't be there.
For example, the bundled click.d.ts file looks like this:
export function click(element: any, init: any, { skipHover, clickCount }?: {
skipHover?: boolean | undefined;
clickCount?: number | undefined;
}): void;
export function dblClick(element: any, init: any): void;
See https://github.com/testing-library/user-event/pull/596#issuecomment-802792000
.d.js won't hurt
Rollup removed the references to lib.dom.d.ts. I'm on it.
@mkapal Could you have a look at #599 ?
:tada: This issue has been resolved in version 13.0.4 :tada:
The release is available on:
npm package (@latest dist-tag)Your semantic-release bot :package::rocket:
@mkapal Could you have a look at #599 ?
It works great now, thanks for the fix!
Most helpful comment
See https://github.com/testing-library/user-event/pull/596#issuecomment-802792000
.d.jswon't hurtRollup removed the references to
lib.dom.d.ts. I'm on it.