appease typescript

pull/12258/head
Rich Harris 2 years ago
parent f31a6d3a81
commit 8ddb60f982

@ -293,7 +293,9 @@ function reconcile(array, state, anchor, render_fn, flags, get_key) {
item = items.get(key);
if (item === undefined) {
var child_anchor = current ? current.e.nodes.start : anchor;
var child_anchor = current
? /** @type {import('#client').EffectNodes} */ (current.e.nodes).start
: anchor;
prev = create_item(
child_anchor,
@ -514,10 +516,12 @@ function create_item(anchor, state, prev, next, value, key, index, render_fn, fl
* @param {Text | Element | Comment} anchor
*/
function move(item, next, anchor) {
var end = item.next ? item.next.e.nodes.start : anchor;
var dest = next ? next.e.nodes.start : anchor;
var end = item.next
? /** @type {import('#client').EffectNodes} */ (item.next.e.nodes).start
: anchor;
var node = item.e.nodes.start;
var dest = next ? /** @type {import('#client').EffectNodes} */ (next.e.nodes).start : anchor;
var node = /** @type {import('#client').EffectNodes} */ (item.e.nodes).start;
while (node !== end) {
var next_node = /** @type {import('#client').TemplateNode} */ (node.nextSibling);

@ -26,6 +26,10 @@ export function template(content, flags) {
/** @type {Node} */
var node;
/**
* Whether or not the first item is a text/element node. If not, we need to
* create an additional comment node to act as `effect.nodes.start`
*/
var has_start = !content.startsWith('<!>');
return () => {
@ -89,6 +93,10 @@ export function template_with_script(content, flags) {
*/
/*#__NO_SIDE_EFFECTS__*/
export function ns_template(content, flags, ns = 'svg') {
/**
* Whether or not the first item is a text/element node. If not, we need to
* create an additional comment node to act as `effect.nodes.start`
*/
var has_start = !content.startsWith('<!>');
var is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;

@ -34,12 +34,14 @@ export interface Derived<V = unknown> extends Value<V>, Reaction {
deriveds: null | Derived[];
}
export interface EffectNodes {
start: TemplateNode;
end: TemplateNode;
}
export interface Effect extends Reaction {
parent: Effect | null;
nodes: null | {
start: TemplateNode;
end: TemplateNode;
};
nodes: null | EffectNodes;
/** The associated component context */
ctx: null | ComponentContext;
/** The effect function */

Loading…
Cancel
Save