From 616c7d7482401586d1a0085ddf1cac0a14e80c9d Mon Sep 17 00:00:00 2001 From: Alexander Brandon Coles Date: Tue, 25 Aug 2026 21:31:50 -0800 Subject: [PATCH] collapse redundant type unions in newContent JSDoc Element is a subtype of Node, so `Element | Node | ...` in the two public newContent annotations is just `Node | ...`. normalizeParent's annotation carried a third redundancy: `Document & {generatedByIdiomorph:boolean}` is likewise absorbed by Node, and the property it names does not exist -- generatedByIdiomorph is a WeakSet, not a field. It was added in e4eeb8a to satisfy tsc, after the WeakSet landed in 7f07002; the cast on the `.has()` call covers it now. No behavioural or type-level change: the annotations denote exactly the same types. Relates to #103. --- src/idiomorph.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/idiomorph.js b/src/idiomorph.js index 835ae9a..fbabba3 100644 --- a/src/idiomorph.js +++ b/src/idiomorph.js @@ -84,7 +84,7 @@ * @callback Morph * * @param {Element | Document} oldNode - * @param {Element | Node | HTMLCollection | Node[] | string | null} newContent + * @param {Node | HTMLCollection | Node[] | string | null} newContent * @param {Config} [config] * @returns {Promise | Node[]} */ @@ -149,7 +149,7 @@ var Idiomorph = (function () { * Core idiomorph function for morphing one DOM tree to another * * @param {Element | Document} oldNode - * @param {Element | Node | HTMLCollection | Node[] | string | null} newContent + * @param {Node | HTMLCollection | Node[] | string | null} newContent * @param {Config} [config] * @returns {Promise | Node[]} */ @@ -1228,7 +1228,7 @@ var Idiomorph = (function () { /** * - * @param {null | string | Node | HTMLCollection | Node[] | Document & {generatedByIdiomorph:boolean}} newContent + * @param {null | string | Node | HTMLCollection | Node[]} newContent * @returns {Element} */ function normalizeParent(newContent) {