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

breaking(svelte5): only generate function component shape in runes mode #2517

Merged
merged 6 commits into from
Sep 26, 2024

Commits on Sep 25, 2024

  1. breaking(svelte5): only generate function component shape

    When a component is in runes mode and not using slots or events, adjust the output to only create the function type that mimics the underlying real shape of components in Svelte 5. This is a breaking change because previously the type was enhanced such that it also had the legacy class shape. As a result, users now may need to switch to `typeof Component` when using the component inside types.
    dummdidumm committed Sep 25, 2024
    Configuration menu
    Copy the full SHA
    96d10a7 View commit details
    Browse the repository at this point in the history
  2. Sadly, due to a combination of requirements and TypeScript limitation…

    …s, we need to always create both a legacy class component and function component type.
    
     - Constraints: Need to support Svelte 4 class component types, therefore we need to use __sveltets_2_ensureComponent to transform function components to classes
    - Limitations: TypeScript is not able to preserve generics during said transformation (i.e. there's no way to express keeping the generic etc)
    TODO Svelte 6/7: Switch this around and not use new Component in svelte2tsx anymore, which means we can remove the legacy class component. We need something like _ensureFnComponent then.
    dummdidumm committed Sep 25, 2024
    Configuration menu
    Copy the full SHA
    e3fd0b0 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0c5d009 View commit details
    Browse the repository at this point in the history
  4. fix test

    dummdidumm committed Sep 25, 2024
    Configuration menu
    Copy the full SHA
    1ad1e40 View commit details
    Browse the repository at this point in the history

Commits on Sep 26, 2024

  1. Configuration menu
    Copy the full SHA
    6174dd6 View commit details
    Browse the repository at this point in the history
  2. fix test

    dummdidumm committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    f582586 View commit details
    Browse the repository at this point in the history