From 0f3264e2056dcc0fa2d102d8d238bf15b40d614f Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Fri, 29 Jan 2021 16:59:57 +0100 Subject: [PATCH] make `SvelteComponentDev` typings more forgiving (#5937) Add `$$events_def` and `$$slot_def` so that users can do ``` let el: SvelteComponent; ``` without type errors. --- CHANGELOG.md | 1 + src/runtime/internal/dev.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 176ef0a1c2..fffeb964be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * Throw a parser error for `class:` directives with an empty class name ([#5858](https://github.com/sveltejs/svelte/issues/5858)) * Fix type inference for derived stores ([#5935](https://github.com/sveltejs/svelte/pull/5935)) * Make parameters of built-in animations and transitions optional ([#5936](https://github.com/sveltejs/svelte/pull/5936)) +* Make `SvelteComponentDev` typings more forgiving ([#5937](https://github.com/sveltejs/svelte/pull/5937)) ## 3.32.0 diff --git a/src/runtime/internal/dev.ts b/src/runtime/internal/dev.ts index 53f6ef3bf1..99ff067474 100644 --- a/src/runtime/internal/dev.ts +++ b/src/runtime/internal/dev.ts @@ -115,6 +115,20 @@ export class SvelteComponentDev extends SvelteComponent { * ### DO NOT USE! */ $$prop_def: Props; + /** + * @private + * For type checking capabilities only. + * Does not exist at runtime. + * ### DO NOT USE! + */ + $$events_def: any; + /** + * @private + * For type checking capabilities only. + * Does not exist at runtime. + * ### DO NOT USE! + */ + $$slot_def: any; constructor(options: { target: Element;