Skip to content

Commit 3191147

Browse files
authored
chore: document init parameters (#9118)
1 parent 6fe17ea commit 3191147

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,25 @@ function make_dirty(component, i) {
8484
component.$$.dirty[(i / 31) | 0] |= 1 << i % 31;
8585
}
8686

87-
/** @returns {void} */
87+
// TODO: Document the other params
88+
/**
89+
* @param {SvelteComponent} component
90+
* @param {import('./public.js').ComponentConstructorOptions} options
91+
*
92+
* @param {import('./utils.js')['not_equal']} not_equal Used to compare props and state values.
93+
* @param {(target: Element | ShadowRoot) => void} [append_styles] Function that appends styles to the DOM when the component is first initialised.
94+
* This will be the `add_css` function from the compiled component.
95+
*
96+
* @returns {void}
97+
*/
8898
export function init(
8999
component,
90100
options,
91101
instance,
92102
create_fragment,
93103
not_equal,
94104
props,
95-
append_styles,
105+
append_styles = null,
96106
dirty = [-1]
97107
) {
98108
const parent_component = current_component;
@@ -139,8 +149,9 @@ export function init(
139149
if (options.target) {
140150
if (options.hydrate) {
141151
start_hydrating();
152+
// TODO: what is the correct type here?
153+
// @ts-expect-error
142154
const nodes = children(options.target);
143-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
144155
$$.fragment && $$.fragment.l(nodes);
145156
nodes.forEach(detach);
146157
} else {

0 commit comments

Comments
 (0)