From fe06a39229ce3e298f80b6e2a4b3fa48fcafbaf3 Mon Sep 17 00:00:00 2001 From: gtmnayan <50981692+gtm-nayan@users.noreply.github.com> Date: Wed, 31 May 2023 01:02:38 +0545 Subject: [PATCH] fix: store types and some other internal types that got lost in the conversion (#8658) --- .../compiler/compile/render_dom/invalidate.js | 2 +- .../svelte/src/compiler/preprocess/index.js | 2 +- .../svelte/src/runtime/internal/Component.js | 4 ++++ packages/svelte/src/runtime/internal/dev.js | 20 +++++++++---------- packages/svelte/src/runtime/internal/dom.js | 4 +++- .../src/runtime/internal/transitions.js | 3 ++- packages/svelte/src/runtime/motion/tweened.js | 2 +- packages/svelte/src/runtime/store/index.js | 14 +++++++------ packages/svelte/src/runtime/store/public.d.ts | 2 +- 9 files changed, 31 insertions(+), 22 deletions(-) diff --git a/packages/svelte/src/compiler/compile/render_dom/invalidate.js b/packages/svelte/src/compiler/compile/render_dom/invalidate.js index 69934a11e0..83423e952b 100644 --- a/packages/svelte/src/compiler/compile/render_dom/invalidate.js +++ b/packages/svelte/src/compiler/compile/render_dom/invalidate.js @@ -91,7 +91,7 @@ export function invalidate(renderer, scope, node, names, main_execution_context * @param {import('./Renderer.js').default} renderer * @param {string} name * @param {any} [value] - * @param {boolean} main_execution_context + * @param {boolean} [main_execution_context] * @returns {import('estree').Node} */ export function renderer_invalidate(renderer, name, value, main_execution_context = false) { diff --git a/packages/svelte/src/compiler/preprocess/index.js b/packages/svelte/src/compiler/preprocess/index.js index 6d03caae3b..2523686b5c 100644 --- a/packages/svelte/src/compiler/preprocess/index.js +++ b/packages/svelte/src/compiler/preprocess/index.js @@ -329,7 +329,7 @@ async function process_markup(process, source) { /** * @param {string} source * @param {import('./public.js').PreprocessorGroup | import('./public.js').PreprocessorGroup[]} preprocessor - * @param {{ filename?: string }} options + * @param {{ filename?: string }} [options] * @returns {Promise} */ export default async function preprocess(source, preprocessor, options) { diff --git a/packages/svelte/src/runtime/internal/Component.js b/packages/svelte/src/runtime/internal/Component.js index b7c4bed714..4512b3ab35 100644 --- a/packages/svelte/src/runtime/internal/Component.js +++ b/packages/svelte/src/runtime/internal/Component.js @@ -221,6 +221,10 @@ if (typeof HTMLElement === 'function') { node.setAttribute('name', name); } }, + /** + * @param {HTMLElement} target + * @param {HTMLElement} [anchor] + */ m: function mount(target, anchor) { insert(target, node, anchor); }, diff --git a/packages/svelte/src/runtime/internal/dev.js b/packages/svelte/src/runtime/internal/dev.js index 494c276260..8069141015 100644 --- a/packages/svelte/src/runtime/internal/dev.js +++ b/packages/svelte/src/runtime/internal/dev.js @@ -17,7 +17,7 @@ import { ensure_array_like } from './each.js'; /** * @template T * @param {string} type - * @param {T} detail + * @param {T} [detail] * @returns {void} */ export function dispatch_dev(type, detail) { @@ -47,7 +47,7 @@ export function append_hydration_dev(target, node) { /** * @param {Node} target * @param {Node} node - * @param {Node} anchor + * @param {Node} [anchor] * @returns {void} */ export function insert_dev(target, node, anchor) { @@ -57,7 +57,7 @@ export function insert_dev(target, node, anchor) { /** @param {Node} target * @param {Node} node - * @param {Node} anchor + * @param {Node} [anchor] * @returns {void} */ export function insert_hydration_dev(target, node, anchor) { @@ -109,10 +109,10 @@ export function detach_after_dev(before) { * @param {Node} node * @param {string} event * @param {EventListenerOrEventListenerObject} handler - * @param {boolean | AddEventListenerOptions | EventListenerOptions} options - * @param {boolean} has_prevent_default - * @param {boolean} has_stop_propagation - * @param {boolean} has_stop_immediate_propagation + * @param {boolean | AddEventListenerOptions | EventListenerOptions} [options] + * @param {boolean} [has_prevent_default] + * @param {boolean} [has_stop_propagation] + * @param {boolean} [has_stop_immediate_propagation] * @returns {() => void} */ export function listen_dev( @@ -140,7 +140,7 @@ export function listen_dev( /** * @param {Element} node * @param {string} attribute - * @param {string} value + * @param {string} [value] * @returns {void} */ export function attr_dev(node, attribute, value) { @@ -152,7 +152,7 @@ export function attr_dev(node, attribute, value) { /** * @param {Element} node * @param {string} property - * @param {any} value + * @param {any} [value] * @returns {void} */ export function prop_dev(node, property, value) { @@ -163,7 +163,7 @@ export function prop_dev(node, property, value) { /** * @param {HTMLElement} node * @param {string} property - * @param {any} value + * @param {any} [value] * @returns {void} */ export function dataset_dev(node, property, value) { diff --git a/packages/svelte/src/runtime/internal/dom.js b/packages/svelte/src/runtime/internal/dom.js index aced965a67..f456e9abd7 100644 --- a/packages/svelte/src/runtime/internal/dom.js +++ b/packages/svelte/src/runtime/internal/dom.js @@ -1001,11 +1001,13 @@ export function toggle_class(element, name, toggle) { * @template T * @param {string} type * @param {T} [detail] + * @param {{ bubbles?: boolean, cancelable?: boolean }} [options] * @returns {CustomEvent} */ export function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) { /** - * @type {CustomEvent} */ + * @type {CustomEvent} + */ const e = document.createEvent('CustomEvent'); e.initCustomEvent(type, bubbles, cancelable, detail); return e; diff --git a/packages/svelte/src/runtime/internal/transitions.js b/packages/svelte/src/runtime/internal/transitions.js index 925316d75e..4575e184ac 100644 --- a/packages/svelte/src/runtime/internal/transitions.js +++ b/packages/svelte/src/runtime/internal/transitions.js @@ -74,7 +74,8 @@ export function transition_in(block, local) { /** * @param {import('./private.js').Fragment} block * @param {0 | 1} local - * @param {0 | 1} detach + * @param {0 | 1} [detach] + * @param {() => void} [callback] * @returns {void} */ export function transition_out(block, local, detach, callback) { diff --git a/packages/svelte/src/runtime/motion/tweened.js b/packages/svelte/src/runtime/motion/tweened.js index 1e0eb8b282..8e2d8f3d26 100644 --- a/packages/svelte/src/runtime/motion/tweened.js +++ b/packages/svelte/src/runtime/motion/tweened.js @@ -57,7 +57,7 @@ export function tweened(value, defaults = {}) { let target_value = value; /** * @param {T} new_value - * @param {import('./private.js').TweenedOptions} opts + * @param {import('./private.js').TweenedOptions} [opts] */ function set(new_value, opts) { if (value == null) { diff --git a/packages/svelte/src/runtime/store/index.js b/packages/svelte/src/runtime/store/index.js index 1c35cca40a..c0c20a885b 100644 --- a/packages/svelte/src/runtime/store/index.js +++ b/packages/svelte/src/runtime/store/index.js @@ -12,8 +12,8 @@ const subscriber_queue = []; /** * Creates a `Readable` store that allows reading by subscription. * @template T - * @param {T} value initial value - * @param {import('./public.js').StartStopNotifier} start + * @param {T} [value] initial value + * @param {import('./public.js').StartStopNotifier} [start] * @returns {import('./public.js').Readable} */ export function readable(value, start) { @@ -25,8 +25,8 @@ export function readable(value, start) { /** * Create a `Writable` store that allows both updating and reading by subscription. * @template T - * @param {T} value initial value - * @param {import('./public.js').StartStopNotifier} start + * @param {T} [value] initial value + * @param {import('./public.js').StartStopNotifier} [start] * @returns {import('./public.js').Writable} */ export function writable(value, start = noop) { @@ -56,6 +56,7 @@ export function writable(value, start = noop) { } } } + /** * @param {import('./public.js').Updater} fn * @returns {void} @@ -63,9 +64,10 @@ export function writable(value, start = noop) { function update(fn) { set(fn(value)); } + /** * @param {import('./public.js').Subscriber} run - * @param {import('./private.js').Invalidator} invalidate + * @param {import('./private.js').Invalidator} [invalidate] * @returns {import('./public.js').Unsubscriber} */ function subscribe(run, invalidate = noop) { @@ -95,7 +97,7 @@ export function writable(value, start = noop) { * @template T * @overload * @param {S} stores - input stores - * @param {(values: import('./public.js').StoresValues, set: import('./public.js').Subscriber, update: (fn: import('./public.js').Updater) => void) => import('./public.js').Unsubscriber | void} fn - function callback that aggregates the values + * @param {(values: import('./public.js').StoresValues, set: (value: T) => void, update: (fn: import('./public.js').Updater) => void) => import('./public.js').Unsubscriber | void} fn - function callback that aggregates the values * @param {T} [initial_value] - initial value * @returns {import('./public.js').Readable} */ diff --git a/packages/svelte/src/runtime/store/public.d.ts b/packages/svelte/src/runtime/store/public.d.ts index 567730d406..b7368137ac 100644 --- a/packages/svelte/src/runtime/store/public.d.ts +++ b/packages/svelte/src/runtime/store/public.d.ts @@ -14,7 +14,7 @@ export type Updater = (value: T) => T; * This function is called when the first subscriber subscribes. * * @param {(value: T) => void} set Function that sets the value of the store. - * @param {(value: Updater) => void} set Function that sets the value of the store after passing the current value to the update function. + * @param {(value: Updater) => void} update Function that sets the value of the store after passing the current value to the update function. * @returns {void | (() => void)} Optionally, a cleanup function that is called when the last remaining * subscriber unsubscribes. */