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

A better error message to replace switch_value is not a constructor #7550

Closed
UltraCakeBakery opened this issue May 20, 2022 · 1 comment · Fixed by #7551
Closed

A better error message to replace switch_value is not a constructor #7550

UltraCakeBakery opened this issue May 20, 2022 · 1 comment · Fixed by #7551

Comments

@UltraCakeBakery
Copy link

UltraCakeBakery commented May 20, 2022

Describe the problem

I've been ripping hairs out left and right for the last days while trying to figure out why I got the following error:
switch_value is not a constructor.

This error apparently occurs when you pass an invalid value to the this="" attribute on <svelte:component /> inside a { #each } block.

My project is pretty large with some components having excessive amounts of binded properties. I thought these were to blame at first, but no, it was the stupid dynamic component that wasn't loaded in correctly.

Here is a recreation of the error using the REPL: https://svelte.dev/repl/904c3f254d9b45eaa96cc1b937b52130?version=3.48.0

Describe the proposed solution

Improve the error message

Alternatives considered

depending on if svelte can't catch the error and improve it, add a hint warning or something

Importance

would make my life easier

@Conduitry
Copy link
Member

3.51.0 now has a better error message - https://svelte.dev/repl/904c3f254d9b45eaa96cc1b937b52130?version=3.51.0

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

Successfully merging a pull request may close this issue.

2 participants