fix: store types and some other internal types that got lost in the conversion (#8658)

pull/8695/head
gtmnayan 2 years ago committed by GitHub
parent b0619377b1
commit fe06a39229
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -91,7 +91,7 @@ export function invalidate(renderer, scope, node, names, main_execution_context
* @param {import('./Renderer.js').default} renderer * @param {import('./Renderer.js').default} renderer
* @param {string} name * @param {string} name
* @param {any} [value] * @param {any} [value]
* @param {boolean} main_execution_context * @param {boolean} [main_execution_context]
* @returns {import('estree').Node} * @returns {import('estree').Node}
*/ */
export function renderer_invalidate(renderer, name, value, main_execution_context = false) { export function renderer_invalidate(renderer, name, value, main_execution_context = false) {

@ -329,7 +329,7 @@ async function process_markup(process, source) {
/** /**
* @param {string} source * @param {string} source
* @param {import('./public.js').PreprocessorGroup | import('./public.js').PreprocessorGroup[]} preprocessor * @param {import('./public.js').PreprocessorGroup | import('./public.js').PreprocessorGroup[]} preprocessor
* @param {{ filename?: string }} options * @param {{ filename?: string }} [options]
* @returns {Promise<import('./public.js').Processed>} * @returns {Promise<import('./public.js').Processed>}
*/ */
export default async function preprocess(source, preprocessor, options) { export default async function preprocess(source, preprocessor, options) {

@ -221,6 +221,10 @@ if (typeof HTMLElement === 'function') {
node.setAttribute('name', name); node.setAttribute('name', name);
} }
}, },
/**
* @param {HTMLElement} target
* @param {HTMLElement} [anchor]
*/
m: function mount(target, anchor) { m: function mount(target, anchor) {
insert(target, node, anchor); insert(target, node, anchor);
}, },

@ -17,7 +17,7 @@ import { ensure_array_like } from './each.js';
/** /**
* @template T * @template T
* @param {string} type * @param {string} type
* @param {T} detail * @param {T} [detail]
* @returns {void} * @returns {void}
*/ */
export function dispatch_dev(type, detail) { export function dispatch_dev(type, detail) {
@ -47,7 +47,7 @@ export function append_hydration_dev(target, node) {
/** /**
* @param {Node} target * @param {Node} target
* @param {Node} node * @param {Node} node
* @param {Node} anchor * @param {Node} [anchor]
* @returns {void} * @returns {void}
*/ */
export function insert_dev(target, node, anchor) { export function insert_dev(target, node, anchor) {
@ -57,7 +57,7 @@ export function insert_dev(target, node, anchor) {
/** @param {Node} target /** @param {Node} target
* @param {Node} node * @param {Node} node
* @param {Node} anchor * @param {Node} [anchor]
* @returns {void} * @returns {void}
*/ */
export function insert_hydration_dev(target, node, anchor) { export function insert_hydration_dev(target, node, anchor) {
@ -109,10 +109,10 @@ export function detach_after_dev(before) {
* @param {Node} node * @param {Node} node
* @param {string} event * @param {string} event
* @param {EventListenerOrEventListenerObject} handler * @param {EventListenerOrEventListenerObject} handler
* @param {boolean | AddEventListenerOptions | EventListenerOptions} options * @param {boolean | AddEventListenerOptions | EventListenerOptions} [options]
* @param {boolean} has_prevent_default * @param {boolean} [has_prevent_default]
* @param {boolean} has_stop_propagation * @param {boolean} [has_stop_propagation]
* @param {boolean} has_stop_immediate_propagation * @param {boolean} [has_stop_immediate_propagation]
* @returns {() => void} * @returns {() => void}
*/ */
export function listen_dev( export function listen_dev(
@ -140,7 +140,7 @@ export function listen_dev(
/** /**
* @param {Element} node * @param {Element} node
* @param {string} attribute * @param {string} attribute
* @param {string} value * @param {string} [value]
* @returns {void} * @returns {void}
*/ */
export function attr_dev(node, attribute, value) { export function attr_dev(node, attribute, value) {
@ -152,7 +152,7 @@ export function attr_dev(node, attribute, value) {
/** /**
* @param {Element} node * @param {Element} node
* @param {string} property * @param {string} property
* @param {any} value * @param {any} [value]
* @returns {void} * @returns {void}
*/ */
export function prop_dev(node, property, value) { export function prop_dev(node, property, value) {
@ -163,7 +163,7 @@ export function prop_dev(node, property, value) {
/** /**
* @param {HTMLElement} node * @param {HTMLElement} node
* @param {string} property * @param {string} property
* @param {any} value * @param {any} [value]
* @returns {void} * @returns {void}
*/ */
export function dataset_dev(node, property, value) { export function dataset_dev(node, property, value) {

@ -1001,11 +1001,13 @@ export function toggle_class(element, name, toggle) {
* @template T * @template T
* @param {string} type * @param {string} type
* @param {T} [detail] * @param {T} [detail]
* @param {{ bubbles?: boolean, cancelable?: boolean }} [options]
* @returns {CustomEvent<T>} * @returns {CustomEvent<T>}
*/ */
export function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) { export function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {
/** /**
* @type {CustomEvent<T>} */ * @type {CustomEvent<T>}
*/
const e = document.createEvent('CustomEvent'); const e = document.createEvent('CustomEvent');
e.initCustomEvent(type, bubbles, cancelable, detail); e.initCustomEvent(type, bubbles, cancelable, detail);
return e; return e;

@ -74,7 +74,8 @@ export function transition_in(block, local) {
/** /**
* @param {import('./private.js').Fragment} block * @param {import('./private.js').Fragment} block
* @param {0 | 1} local * @param {0 | 1} local
* @param {0 | 1} detach * @param {0 | 1} [detach]
* @param {() => void} [callback]
* @returns {void} * @returns {void}
*/ */
export function transition_out(block, local, detach, callback) { export function transition_out(block, local, detach, callback) {

@ -57,7 +57,7 @@ export function tweened(value, defaults = {}) {
let target_value = value; let target_value = value;
/** /**
* @param {T} new_value * @param {T} new_value
* @param {import('./private.js').TweenedOptions<T>} opts * @param {import('./private.js').TweenedOptions<T>} [opts]
*/ */
function set(new_value, opts) { function set(new_value, opts) {
if (value == null) { if (value == null) {

@ -12,8 +12,8 @@ const subscriber_queue = [];
/** /**
* Creates a `Readable` store that allows reading by subscription. * Creates a `Readable` store that allows reading by subscription.
* @template T * @template T
* @param {T} value initial value * @param {T} [value] initial value
* @param {import('./public.js').StartStopNotifier<T>} start * @param {import('./public.js').StartStopNotifier<T>} [start]
* @returns {import('./public.js').Readable<T>} * @returns {import('./public.js').Readable<T>}
*/ */
export function readable(value, start) { 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. * Create a `Writable` store that allows both updating and reading by subscription.
* @template T * @template T
* @param {T} value initial value * @param {T} [value] initial value
* @param {import('./public.js').StartStopNotifier<T>} start * @param {import('./public.js').StartStopNotifier<T>} [start]
* @returns {import('./public.js').Writable<T>} * @returns {import('./public.js').Writable<T>}
*/ */
export function writable(value, start = noop) { export function writable(value, start = noop) {
@ -56,6 +56,7 @@ export function writable(value, start = noop) {
} }
} }
} }
/** /**
* @param {import('./public.js').Updater<T>} fn * @param {import('./public.js').Updater<T>} fn
* @returns {void} * @returns {void}
@ -63,9 +64,10 @@ export function writable(value, start = noop) {
function update(fn) { function update(fn) {
set(fn(value)); set(fn(value));
} }
/** /**
* @param {import('./public.js').Subscriber<T>} run * @param {import('./public.js').Subscriber<T>} run
* @param {import('./private.js').Invalidator<T>} invalidate * @param {import('./private.js').Invalidator<T>} [invalidate]
* @returns {import('./public.js').Unsubscriber} * @returns {import('./public.js').Unsubscriber}
*/ */
function subscribe(run, invalidate = noop) { function subscribe(run, invalidate = noop) {
@ -95,7 +97,7 @@ export function writable(value, start = noop) {
* @template T * @template T
* @overload * @overload
* @param {S} stores - input stores * @param {S} stores - input stores
* @param {(values: import('./public.js').StoresValues<S>, set: import('./public.js').Subscriber<T>, update: (fn: import('./public.js').Updater<T>) => void) => import('./public.js').Unsubscriber | void} fn - function callback that aggregates the values * @param {(values: import('./public.js').StoresValues<S>, set: (value: T) => void, update: (fn: import('./public.js').Updater<T>) => void) => import('./public.js').Unsubscriber | void} fn - function callback that aggregates the values
* @param {T} [initial_value] - initial value * @param {T} [initial_value] - initial value
* @returns {import('./public.js').Readable<T>} * @returns {import('./public.js').Readable<T>}
*/ */

@ -14,7 +14,7 @@ export type Updater<T> = (value: T) => T;
* This function is called when the first subscriber subscribes. * This function is called when the first subscriber subscribes.
* *
* @param {(value: T) => void} set Function that sets the value of the store. * @param {(value: T) => void} set Function that sets the value of the store.
* @param {(value: Updater<T>) => void} set Function that sets the value of the store after passing the current value to the update function. * @param {(value: Updater<T>) => 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 * @returns {void | (() => void)} Optionally, a cleanup function that is called when the last remaining
* subscriber unsubscribes. * subscriber unsubscribes.
*/ */

Loading…
Cancel
Save