Skip to content
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

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

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

mcous
Copy link
Collaborator

@mcous mcous commented Nov 18, 2024

When using @testing-library/[email protected] 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

  • Adjusts the types so that ESLint does not get mad
  • Adds a failing test case to the types suite

@mcous mcous merged commit acbddfd into main Nov 18, 2024
29 checks passed
@mcous mcous deleted the fix/legacy-types-eslint branch November 18, 2024 21:55
Copy link

🎉 This PR is included in version 5.2.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant