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

ValidationMessage should be a SvelteComponentTyped #299

Open
gl-aagostino opened this issue Jul 12, 2024 · 2 comments
Open

ValidationMessage should be a SvelteComponentTyped #299

gl-aagostino opened this issue Jul 12, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@gl-aagostino
Copy link

Describe the bug

I started receiving this error upon using ValidationMessage

Argument of type 'typeof ValidationMessage' is not assignable to parameter of type 'ConstructorOfATypedSvelteComponent'.
  Type 'typeof ValidationMessage' provides no match for the signature 'new (args: { target: any; props?: any; }): ATypedSvelteComponent'.

Possible causes:
- You use the instance type of a component where you should use the constructor type
- Type definitions are missing for this Svelte Component. If you are using Svelte 3.31+, use SvelteComponentTyped to add a definition:
  import type { SvelteComponentTyped } from "svelte";
  class ComponentName extends SvelteComponentTyped<{propertyName: string;}> {}ts(2345)

I think it can be fixed by changing this

export default class ValidationMessage extends SvelteComponent

to this

export default class ValidationMessage extends SvelteComponentTyped

Which package/s are you using?

@felte/reporter-svelte

Environment

  • OS:
  • Browser:
  • Version:

To reproduce

No response

Small reproduction example

No response

Screenshots

No response

Additional context

No response

@gl-aagostino gl-aagostino added the bug Something isn't working label Jul 12, 2024
@pablo-abc
Copy link
Owner

Apologies for the delay! Is this still happening to you? If I remember correctly, newer versions of Svelte use SvelteComponent instead of SvelteComponentTyped. Does it still happen with more recent versions of Svelte?

@gl-aagostino
Copy link
Author

Yes, we patched it with a custom type. But on that note, if you upgrade to svelte 5...

**
 * This was the base class for Svelte components in Svelte 4. Svelte 5+ components
 * are completely different under the hood. For typing, use `Component` instead.
 * To instantiate components, use `mount` instead`.
 * See [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes) for more info.
 */
export class SvelteComponent<
	Props extends Record<string, any> = Record<string, any>,
	Events extends Record<string, any> = any,
	Slots extends Record<string, any> = any
>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants