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

Example code does not work with vite/svelte #249

Closed
brayden-ooi opened this issue Jul 20, 2023 · 3 comments
Closed

Example code does not work with vite/svelte #249

brayden-ooi opened this issue Jul 20, 2023 · 3 comments

Comments

@brayden-ooi
Copy link

Hi, I recently setup a project with vite + svelte-ts with the following dependency versions

    "@sveltejs/vite-plugin-svelte": "^2.4.2",
    "@tsconfig/svelte": "^5.0.0",
    "svelte": "^4.0.3",
    "svelte-check": "^3.4.4",
    "tslib": "^2.6.0",
    "typescript": "^5.0.2",
    "vite": "^4.4.0"

I tried with the following syntax as according to the example provided but it returned an error.

<Route path="/" component={Home} />

The error:

Type 'typeof Home__SvelteComponent_' is not assignable to type 'typeof SvelteComponent | AsyncSvelteComponent'.
  Type 'typeof Home__SvelteComponent_' is not assignable to type 'typeof SvelteComponent'.
    Types of construct signatures are incompatible.
      Type 'new (options: ComponentConstructorOptions<Record<string, never>>) => Home__SvelteComponent_' is not assignable to type 'new <Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any>(options: ComponentConstructorOptions<Props>) => SvelteComponent<...>'.
        Types of parameters 'options' and 'options' are incompatible.
          Type 'ComponentConstructorOptions<Props>' is not assignable to type 'ComponentConstructorOptions<Record<string, never>>'.
            Type 'Props' is not assignable to type 'Record<string, never>'.
              Type 'Record<string, any>' is not assignable to type 'Record<string, never>'.
                'string' index signatures are incompatible.
                  Type 'any' is not assignable to type 'never'.ts(2322)

However, the syntax below works:

<Route path="/">
  <Home />
</Route>

I'm not knowledgable enough in the Svelte ecosystem to pinpoint if this is some versioning issue or something went wrong on my end, but I would be happy to submit a PR to update the example code to the non-problematic syntax.

@krishnaTORQUE
Copy link
Collaborator

Example will not work because it is too old.
There are so many things has been changed.
Example will be removed in next push.

@rokit
Copy link

rokit commented Jul 31, 2023

@krishnaTORQUE Rather than remove the example, it should be updated. Even the example linked in the readme returns a 404. How is this used now?

@krishnaTORQUE
Copy link
Collaborator

@krishnaTORQUE Rather than remove the example, it should be updated. Even the example linked in the readme returns a 404. How is this used now?

Yes I understand it but the example require complete code changes which also require huge amount of time.
I am open for PR.

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

No branches or pull requests

3 participants