svelte icon indicating copy to clipboard operation
svelte copied to clipboard

feat: migrate `Component` to `ReturnType<typeof Component>` in TS

Open paoloricciuti opened this issue 1 year ago • 4 comments

Svelte 5 rewrite

Closes #13491

I added the migration only for TS because with JSDoc would be immensely more complex (unless i'm missing something) because we would basically need to parse the JSDoc comment ourselves.

WDYT?

Please note that the Svelte codebase is currently being rewritten for Svelte 5. Changes should target Svelte 5, which lives on the default branch (main).

If your PR concerns Svelte 4 (including updates to svelte.dev.docs), please ensure the base branch is svelte-4 and not main.

Before submitting the PR, please make sure you do the following

  • [x] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • [x] Prefix your PR title with feat:, fix:, chore:, or docs:.
  • [x] This message body should clearly illustrate what problems it solves.
  • [x] Ideally, include a test that fails without this PR but passes with it.

Tests and linting

  • [x] Run the tests with pnpm test and lint the project with pnpm lint

paoloricciuti avatar Oct 17 '24 21:10 paoloricciuti

🦋 Changeset detected

Latest commit: 7fb4fd1194a6bf475f7ea17c21dc983ce085dd8b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Oct 17 '24 21:10 changeset-bot[bot]

What are your thoughts on #13441. Merging that and instead of ReturnType<typeof Component> use ComponentExports<typeof Component>.

FoHoOV avatar Oct 18 '24 11:10 FoHoOV

What are your thoughts on #13441. Merging that and instead of ReturnType<typeof Component> use ComponentExports<typeof Component>.

I think it could be interesting...is the language server returning the same type also for legacy components? If i remember they use a different type right @dummdidumm ? Would this type work in that case?

paoloricciuti avatar Oct 18 '24 21:10 paoloricciuti

@paoloricciuti AFAIK everything is of type Component, it has the legacy types in it for now.

FoHoOV avatar Oct 24 '24 21:10 FoHoOV

pnpm add https://pkg.pr.new/svelte@13656

commit: 7fb4fd1

pkg-pr-new[bot] avatar Oct 31 '24 11:10 pkg-pr-new[bot]

pnpm add https://pkg.pr.new/svelte@13656

commit: 6b65293

pkg-pr-new[bot] avatar Oct 31 '24 11:10 pkg-pr-new[bot]