Skip to content

Svelte 5 types support #207

@khromov

Description

@khromov

Check that this is really a bug

  • I confirm

Reproduction link

Bug description

Overall Konsta works fine with Svelte 5 as it's backwards compatible with 4 but there seems to be a small issues with Svelte 5 support:

Types have changed, leading to TypeScript errors in each component.

Screenshot 2024-05-11 at 15 48 34

Argument of type 'typeof Actions' is not assignable to parameter of type 'ConstructorOfATypedSvelteComponent'.

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)
(alias) class Actions

In addition, there are some small changes in Svelte 5 that now trigger a notice warning:

/Users/k/Documents/GitHub/x/node_modules/konsta/svelte/components/Actions.svelte:25:2 Self-closing HTML tags for non-void elements are ambiguous — use `<div ...></div>` rather than `<div ... />`

There's some background for this change here:
sveltejs/svelte#11052

To reproduce

  • Start a new project with npm create svelte@latest my-app
  • Select Svelte 5 alpha/beta during the installation process
  • Install Konsta UI and use any component in the SvelteKit project.

Expected Behavior

No errors when importing components

Actual Behavior

Errors in VSCoe

Konsta UI version

konsta@3.1.3

Platform/Target and Browser Versions

macOS

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
  • Make sure this is a Konsta UI issue and not a framework-specific issue

Would you like to open a PR for this bug?

  • I'm willing to open a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    SvelteIssue with Tailwind Mobile Sveltet0gglesLinked to the t0ggles task

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions