From 0b3d17986e90ea5b10c4c340fe903020a54d49f4 Mon Sep 17 00:00:00 2001 From: paoloricciuti Date: Fri, 3 Apr 2026 13:14:55 +0200 Subject: [PATCH] chore: better types --- packages/svelte/src/internal/client/custom-renderer/index.js | 2 +- packages/svelte/types/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/svelte/src/internal/client/custom-renderer/index.js b/packages/svelte/src/internal/client/custom-renderer/index.js index eeb7b4734b..82ea5112c6 100644 --- a/packages/svelte/src/internal/client/custom-renderer/index.js +++ b/packages/svelte/src/internal/client/custom-renderer/index.js @@ -27,7 +27,7 @@ import { get_parent_node, remove_child } from '../dom/operations.js'; * @property {(element: TElement | TFragment)=>TNode | null} getFirstChild - Return the first child of the element, or null if it has no children. This should work for both elements and fragments * @property {(element: TElement | TFragment)=>TNode | null} getLastChild - Return the last child of the element, or null if it has no children. This should work for both elements and fragments * @property {(node: TElement | TTextNode | TComment)=>TNode | null} getNextSibling - Return the next sibling of the node, or null if it has no next sibling - * @property {(parent: TElement | TFragment, element: TNode, anchor: TNode | null)=>void} insert - Insert the element into the parent before the anchor (if the anchor is null, insert at the end). This should work for both elements and fragments as parents. If `element` is a fragment, all of it's children should be inserted, not the fragment itself. If the element already has a parent, it should be removed from it's current parent before being inserted into the new parent. + * @property {(parent: TElement | TFragment, element: TNode, anchor: TElement | TTextNode | TComment | null)=>void} insert - Insert the element into the parent before the anchor (if the anchor is null, insert at the end). This should work for both elements and fragments as parents. If `element` is a fragment, all of it's children should be inserted, not the fragment itself. If the element already has a parent, it should be removed from it's current parent before being inserted into the new parent. * @property {(node: TElement | TTextNode | TComment)=>void} remove - Remove the node from the tree * @property {(element: TElement | TTextNode | TComment)=>TNode | null} getParent - Return the parent of the element, or null if it has no parent * @property {(target: TElement, type: string, handler: any, options?: any)=>void} addEventListener - Add an event listener of the given type and handler to the target node, with optional options diff --git a/packages/svelte/types/index.d.ts b/packages/svelte/types/index.d.ts index fa58133fc3..fecbcda419 100644 --- a/packages/svelte/types/index.d.ts +++ b/packages/svelte/types/index.d.ts @@ -2642,7 +2642,7 @@ declare module 'svelte/renderer' { /** * - Insert the element into the parent before the anchor (if the anchor is null, insert at the end). This should work for both elements and fragments as parents. If `element` is a fragment, all of it's children should be inserted, not the fragment itself. If the element already has a parent, it should be removed from it's current parent before being inserted into the new parent. */ - insert: (parent: TElement | TFragment, element: TNode, anchor: TNode | null) => void; + insert: (parent: TElement | TFragment, element: TNode, anchor: TElement | TTextNode | TComment | null) => void; /** * - Remove the node from the tree */