From cb4b1f0a189803bed04adcb90fbd4334782e8469 Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Fri, 24 Nov 2023 14:51:46 +0100 Subject: [PATCH] fix: remove constructor overload 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. --- .changeset/ten-worms-reflect.md | 5 +++++ packages/svelte/src/main/public.d.ts | 7 ------- 2 files changed, 5 insertions(+), 7 deletions(-) create mode 100644 .changeset/ten-worms-reflect.md diff --git a/.changeset/ten-worms-reflect.md b/.changeset/ten-worms-reflect.md new file mode 100644 index 0000000000..a78d6b052f --- /dev/null +++ b/.changeset/ten-worms-reflect.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +fix: remove constructor overload diff --git a/packages/svelte/src/main/public.d.ts b/packages/svelte/src/main/public.d.ts index 6851d3f1d7..63f5122bbe 100644 --- a/packages/svelte/src/main/public.d.ts +++ b/packages/svelte/src/main/public.d.ts @@ -52,13 +52,6 @@ export class SvelteComponent< Slots extends Record = 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