-
Notifications
You must be signed in to change notification settings - Fork 466
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
Argument of type 'Element' is not assignable to parameter of type 'HTMLElement'. #838
Comments
Hi @Semigradsky! Thanks for opening this one. |
Isn't that an issue with |
That's a fair point I didn't think of.. looks like jest-dom is checking for But it doesn't seem to be the error that @Semigradsky is reporting, jest-dom doesn't have type definitions I think.. |
Could you check why they do that? From their documentation it sounds like any element should work. I'd even argue they should just allow any Node
They do: h |
This is a runtime type test and not a typescript error (which is what @Semigradsky is reporting I think). |
What's a "runtime type test"? The error message sounds exactly like errors from TypeScripts's type-checker e.g. https://www.typescriptlang.org/play?#code/GYVwdgxgLglg9mABFOAhApgSTAFQBboAicEIAtumFABToA26FVAXIgBI4CyAMgKINMoASlYA3ODAAmiAN4BfAFALJ6CHQCGAJ3SIICAM5RE9RpSit+pqgG4FKDNnxES5M7QFmh1oA. |
What i meant to say is that the error thrown here |
I took the liberty to transfer this issue to jest-dom where it belongs. Seems that this needs a fix similar to that in testing-library/jest-dom#307. |
I read the issue description again and don't understand how this would mean a runtime error. The wording doesn't match the runtime errors, sounds like a type error and matches exactly what TypeScript's type-checker says right now. |
I agree on this one, but dom-testing-library/types/queries.d.ts Line 57 in c6e7a83
|
Argh, I pasted the wrong link previously. They do have definitions: https://www.npmjs.com/package/@types/testing-library__jest-dom |
There is also a separate issue with the runtime (not TypeScript) type checking in Jest DOM. I've opened testing-library/jest-dom#313 to track that. |
Co-authored-by: Sebastian Silbermann <silbermann.sebastian@gmail.com>
@testing-library/react
version: 11.2.2Relevant code or config:
Problem description:
After testing-library/react-testing-library#833 I get type errors because
container
no moreHTMLElement
.container as HTMLElement
doesn't seem like a good solution.The text was updated successfully, but these errors were encountered: