From d49b568019fbd6578ceba72de68d0790db909bee Mon Sep 17 00:00:00 2001 From: Snaipe Date: Mon, 27 Mar 2023 10:05:04 +0200 Subject: [PATCH] fix: allow use of document root as target in typescript (#7554) It is not possible to use typescript when using `target: document` during component initialization, because target can only be of type Element or ShadowRoot. This means that it is not possible to hydrate the entire document when managing the element as a Svelte component. This commit fixes this by allowing documents to be targets. --- src/runtime/internal/dev.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/runtime/internal/dev.ts b/src/runtime/internal/dev.ts index cd47138fef..323312437b 100644 --- a/src/runtime/internal/dev.ts +++ b/src/runtime/internal/dev.ts @@ -164,8 +164,9 @@ export interface SvelteComponentDev { $destroy(): void; [accessor: string]: any; } + export interface ComponentConstructorOptions = Record> { - target: Element | ShadowRoot; + target: Element | Document | ShadowRoot; anchor?: Element; props?: Props; context?: Map;