-
Notifications
You must be signed in to change notification settings - Fork 33
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
render function giving typescript errror when passed a typescript component #194
Comments
Was able to reproduce using your example, thanks! I'll try to have a look at it this week. And for what it's worth: it's all working if you load your shotgun with |
Found a couple random things. Leaving this be for now. Looking at pure.js, it's looking like the When I edit the
Moreover, I'm not sure what the reasoning was in 167b46b, but switching back from |
Probably related question, is this duplicate https://github.com/testing-library/svelte-testing-library/blob/main/types/index.d.ts#L26-L27 component: SvelteComponent
component: SvelteComponentTyped |
@molily I could be wrong. But since it's a duplicate and since the type is unresolved, I'm assuming this is unintentional. It likely may have been a |
Yeah, when I merged the PR it was pretty old, so I can see how it'd have merged more messily than expected. Ooops. |
I think I got it. Basically, I have a potential fix at #195. Could I get some additional pairs of eyes to make sure I'm not utterly off my rockers? |
I'll try to give it a look within the next hour. |
Having a similar issue with typescript and svelte components. Currently was having "@testing-library/svelte": "3.1.2" As per @theweekendgeek comments -
"@testing-library/svelte": "3.0.3", FYI - for anyone wondering why their tests started failing in the |
3.1.1 is fine, too |
In the name of getting things unb0rked, I'll revert the type changes of 3.1.1, and set them back into a PR that can be tweaked and fixed at leisure. |
#198 it is. |
Great. Can confirm that the jest unit tests for svelte components with typescript works with 3.1.3 indeed. "@testing-library/svelte": "3.1.3", |
Can confirm rolling back to |
I am trying to set up svelte-testing-library together with svelte kit and typescript. I followed the documentation, including the instructions for svelte-jester.
However, when I write a test, i get an error when I pass the imported component to the render function.
The error is
TS2769: No overload matches this call
.From what I can see the render function accepts a
SvelteComponentTyped<any, any, any>
as its first argument.The imported component, however, is of type
typeof SvelteComponentDev
. (I added the whole message below)The error can be seen when executing the test script or already the editor (I tried in vscode and webstorm).
I also created a repo for reproduction. It is basically just a new svelte kit project with typescript and then I followed the instructions to set up svelte-testing-library: https://github.com/theweekendgeek/svelte-testing-library-ts-example
edit: I had another quick look after seeing #181. I compared the repos and saw that they were using
svelte-testing-library
3.0.3
. After installing the exact version number it the typeerror is gone. but when running the tests I get another error:another edit after comparing again with the referenced repo from #181 I think I was able to resolve the issue. I had to change the extension of the
svelte.config.js
to.mjs
and then point the jest config file to it.The text was updated successfully, but these errors were encountered: