Skip to content

Commit fe06a39

Browse files
authored
fix: store types and some other internal types that got lost in the conversion (#8658)
1 parent b061937 commit fe06a39

File tree

9 files changed

+31
-22
lines changed

9 files changed

+31
-22
lines changed

packages/svelte/src/compiler/compile/render_dom/invalidate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export function invalidate(renderer, scope, node, names, main_execution_context
9191
* @param {import('./Renderer.js').default} renderer
9292
* @param {string} name
9393
* @param {any} [value]
94-
* @param {boolean} main_execution_context
94+
* @param {boolean} [main_execution_context]
9595
* @returns {import('estree').Node}
9696
*/
9797
export function renderer_invalidate(renderer, name, value, main_execution_context = false) {

packages/svelte/src/compiler/preprocess/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ async function process_markup(process, source) {
329329
/**
330330
* @param {string} source
331331
* @param {import('./public.js').PreprocessorGroup | import('./public.js').PreprocessorGroup[]} preprocessor
332-
* @param {{ filename?: string }} options
332+
* @param {{ filename?: string }} [options]
333333
* @returns {Promise<import('./public.js').Processed>}
334334
*/
335335
export default async function preprocess(source, preprocessor, options) {

packages/svelte/src/runtime/internal/Component.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ if (typeof HTMLElement === 'function') {
221221
node.setAttribute('name', name);
222222
}
223223
},
224+
/**
225+
* @param {HTMLElement} target
226+
* @param {HTMLElement} [anchor]
227+
*/
224228
m: function mount(target, anchor) {
225229
insert(target, node, anchor);
226230
},

packages/svelte/src/runtime/internal/dev.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { ensure_array_like } from './each.js';
1717
/**
1818
* @template T
1919
* @param {string} type
20-
* @param {T} detail
20+
* @param {T} [detail]
2121
* @returns {void}
2222
*/
2323
export function dispatch_dev(type, detail) {
@@ -47,7 +47,7 @@ export function append_hydration_dev(target, node) {
4747
/**
4848
* @param {Node} target
4949
* @param {Node} node
50-
* @param {Node} anchor
50+
* @param {Node} [anchor]
5151
* @returns {void}
5252
*/
5353
export function insert_dev(target, node, anchor) {
@@ -57,7 +57,7 @@ export function insert_dev(target, node, anchor) {
5757

5858
/** @param {Node} target
5959
* @param {Node} node
60-
* @param {Node} anchor
60+
* @param {Node} [anchor]
6161
* @returns {void}
6262
*/
6363
export function insert_hydration_dev(target, node, anchor) {
@@ -109,10 +109,10 @@ export function detach_after_dev(before) {
109109
* @param {Node} node
110110
* @param {string} event
111111
* @param {EventListenerOrEventListenerObject} handler
112-
* @param {boolean | AddEventListenerOptions | EventListenerOptions} options
113-
* @param {boolean} has_prevent_default
114-
* @param {boolean} has_stop_propagation
115-
* @param {boolean} has_stop_immediate_propagation
112+
* @param {boolean | AddEventListenerOptions | EventListenerOptions} [options]
113+
* @param {boolean} [has_prevent_default]
114+
* @param {boolean} [has_stop_propagation]
115+
* @param {boolean} [has_stop_immediate_propagation]
116116
* @returns {() => void}
117117
*/
118118
export function listen_dev(
@@ -140,7 +140,7 @@ export function listen_dev(
140140
/**
141141
* @param {Element} node
142142
* @param {string} attribute
143-
* @param {string} value
143+
* @param {string} [value]
144144
* @returns {void}
145145
*/
146146
export function attr_dev(node, attribute, value) {
@@ -152,7 +152,7 @@ export function attr_dev(node, attribute, value) {
152152
/**
153153
* @param {Element} node
154154
* @param {string} property
155-
* @param {any} value
155+
* @param {any} [value]
156156
* @returns {void}
157157
*/
158158
export function prop_dev(node, property, value) {
@@ -163,7 +163,7 @@ export function prop_dev(node, property, value) {
163163
/**
164164
* @param {HTMLElement} node
165165
* @param {string} property
166-
* @param {any} value
166+
* @param {any} [value]
167167
* @returns {void}
168168
*/
169169
export function dataset_dev(node, property, value) {

packages/svelte/src/runtime/internal/dom.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,11 +1001,13 @@ export function toggle_class(element, name, toggle) {
10011001
* @template T
10021002
* @param {string} type
10031003
* @param {T} [detail]
1004+
* @param {{ bubbles?: boolean, cancelable?: boolean }} [options]
10041005
* @returns {CustomEvent<T>}
10051006
*/
10061007
export function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {
10071008
/**
1008-
* @type {CustomEvent<T>} */
1009+
* @type {CustomEvent<T>}
1010+
*/
10091011
const e = document.createEvent('CustomEvent');
10101012
e.initCustomEvent(type, bubbles, cancelable, detail);
10111013
return e;

packages/svelte/src/runtime/internal/transitions.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ export function transition_in(block, local) {
7474
/**
7575
* @param {import('./private.js').Fragment} block
7676
* @param {0 | 1} local
77-
* @param {0 | 1} detach
77+
* @param {0 | 1} [detach]
78+
* @param {() => void} [callback]
7879
* @returns {void}
7980
*/
8081
export function transition_out(block, local, detach, callback) {

packages/svelte/src/runtime/motion/tweened.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export function tweened(value, defaults = {}) {
5757
let target_value = value;
5858
/**
5959
* @param {T} new_value
60-
* @param {import('./private.js').TweenedOptions<T>} opts
60+
* @param {import('./private.js').TweenedOptions<T>} [opts]
6161
*/
6262
function set(new_value, opts) {
6363
if (value == null) {

packages/svelte/src/runtime/store/index.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ const subscriber_queue = [];
1212
/**
1313
* Creates a `Readable` store that allows reading by subscription.
1414
* @template T
15-
* @param {T} value initial value
16-
* @param {import('./public.js').StartStopNotifier<T>} start
15+
* @param {T} [value] initial value
16+
* @param {import('./public.js').StartStopNotifier<T>} [start]
1717
* @returns {import('./public.js').Readable<T>}
1818
*/
1919
export function readable(value, start) {
@@ -25,8 +25,8 @@ export function readable(value, start) {
2525
/**
2626
* Create a `Writable` store that allows both updating and reading by subscription.
2727
* @template T
28-
* @param {T} value initial value
29-
* @param {import('./public.js').StartStopNotifier<T>} start
28+
* @param {T} [value] initial value
29+
* @param {import('./public.js').StartStopNotifier<T>} [start]
3030
* @returns {import('./public.js').Writable<T>}
3131
*/
3232
export function writable(value, start = noop) {
@@ -56,16 +56,18 @@ export function writable(value, start = noop) {
5656
}
5757
}
5858
}
59+
5960
/**
6061
* @param {import('./public.js').Updater<T>} fn
6162
* @returns {void}
6263
*/
6364
function update(fn) {
6465
set(fn(value));
6566
}
67+
6668
/**
6769
* @param {import('./public.js').Subscriber<T>} run
68-
* @param {import('./private.js').Invalidator<T>} invalidate
70+
* @param {import('./private.js').Invalidator<T>} [invalidate]
6971
* @returns {import('./public.js').Unsubscriber}
7072
*/
7173
function subscribe(run, invalidate = noop) {
@@ -95,7 +97,7 @@ export function writable(value, start = noop) {
9597
* @template T
9698
* @overload
9799
* @param {S} stores - input stores
98-
* @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
100+
* @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
99101
* @param {T} [initial_value] - initial value
100102
* @returns {import('./public.js').Readable<T>}
101103
*/

packages/svelte/src/runtime/store/public.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export type Updater<T> = (value: T) => T;
1414
* This function is called when the first subscriber subscribes.
1515
*
1616
* @param {(value: T) => void} set Function that sets the value of the store.
17-
* @param {(value: Updater<T>) => void} set Function that sets the value of the store after passing the current value to the update function.
17+
* @param {(value: Updater<T>) => void} update Function that sets the value of the store after passing the current value to the update function.
1818
* @returns {void | (() => void)} Optionally, a cleanup function that is called when the last remaining
1919
* subscriber unsubscribes.
2020
*/

0 commit comments

Comments
 (0)