testing-library / svelte-testing-library

:chipmunk: Simple and complete Svelte DOM testing utilities that encourage good testing practices
https://testing-library.com/docs/svelte-testing-library/intro
MIT License
620 stars 33 forks source link

fix(types): adjust legacy types for eslint-plugin-svelte #409

Closed mcous closed 1 week ago

mcous commented 1 week ago

When using @testing-library/svelte@5.2.x with Svelte 4, wrapping render can cause spurious @typescript-eslint/no-unsafe-argument errors. I suspect this is due to some sort of bug in eslint-plugin-svelte, but I have not yet produced a minimal reproduction.

import type { ComponentProps } from 'svelte';
import { render } from '@testing-library/svelte';

import Subject from '../app.svelte';

const renderSubject = (props: ComponentProps<Subject>) => {
  return render(Subject, props);
};
error  Unsafe argument of type `any` assigned to a parameter of type `SvelteComponentOptions<SvelteComponent<Record<string, any>, Record<string, any>, Record<string, any>>> | undefined`  @typescript-eslint/no-unsafe-argument

In the meantime, this PR

github-actions[bot] commented 1 week ago

:tada: This PR is included in version 5.2.5 :tada:

The release is available on:

Your semantic-release bot :package::rocket: