testing-library/svelte-testing-library

Argument of type 'typeof SvelteComponentDev' is not assignable to parameter of type 'SvelteComponentDev'.

peterpeterparker opened this issue ยท 4 comments

Hi,

Probably more a question than an issue per se but, I am a bit confuse about the new improved props typing for render function (fb97676) that was release in last version.

Given a component Menu.svelte when I try following:

const renderResult = render<Menu>(Menu);

I get following error:

TS2345: Argument of type 'typeof SvelteComponentDev' is not assignable to parameter of type 'SvelteComponentDev'. Type 'typeof SvelteComponentDev' is missing the following properties from type 'SvelteComponentDev': $set, $on, $destroy, $$prop_def, and 5 more.

Am I missing something or should actually the render function accepts typeof SvelteComponent rather than SvelteComponent?

A new release with a potential fix (#204) was released a few moments ago. Can you give it a whirl and see if it fixes this problem?

It works like a charm (tested locally and CI is green too). Thanks for the ultra fast fix!

W00t! Excellent. That typing is proving to be tricky. ๐Ÿ˜…

Definitely! Went also back and forth between v3.2.0 and v3.2.1 to be sure i could reproduce the error and that it fixed it. Well played