Skip to content

Commit

Permalink
fix: remove constructor overload
Browse files Browse the repository at this point in the history
The original intent was for typing generation tools like svelte2tsx to use the virtual constructor instead, but it does more harm than good. Most notably, the TS error message when props are wrong becomes completely useless. It's better for tooling to silence the deprecation message and switch over to a new virtual constructor once we remove the deprecated one.
  • Loading branch information
dummdidumm committed Nov 24, 2023
1 parent b7af2ff commit cb4b1f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/ten-worms-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: remove constructor overload
7 changes: 0 additions & 7 deletions packages/svelte/src/main/public.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,6 @@ export class SvelteComponent<
Slots extends Record<string, any> = any
> {
[prop: string]: any;

/**
* For type checking capabilities only.
* Does not exist at runtime.
* ### DO NOT USE!
*/
constructor(props: Props);
/**
* @deprecated This constructor only exists when using the `asClassComponent` compatibility helper, which
* is a stop-gap solution. Migrate towards using `mount` or `createRoot` instead. See
Expand Down

1 comment on commit cb4b1f0

@vercel
Copy link

@vercel vercel bot commented on cb4b1f0 Nov 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

svelte-5-preview – ./sites/svelte-5-preview

svelte-5-preview-git-main-svelte.vercel.app
svelte-octane.vercel.app
svelte-5-preview.vercel.app
svelte-5-preview-svelte.vercel.app

Please sign in to comment.