Skip to content

Commit 6822dec

Browse files
authored
tidy up (#10874)
1 parent 04879c5 commit 6822dec

File tree

5 files changed

+13
-20
lines changed

5 files changed

+13
-20
lines changed

packages/svelte/src/internal/client/dom/blocks/html.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { reconcile_html, remove } from '../reconciler.js';
88
* @returns {void}
99
*/
1010
export function html(dom, get_value, svg) {
11-
/** @type {import('#client').TemplateNode | import('#client').TemplateNode[]} */
11+
/** @type {import('#client').Dom} */
1212
let html_dom;
1313

1414
/** @type {string} */

packages/svelte/src/internal/client/dom/blocks/if.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import { create_block } from './utils.js';
1717
/**
1818
* @param {Comment} anchor
1919
* @param {() => boolean} get_condition
20-
* @param {(anchor: Node) => import('#client').TemplateNode | import('#client').TemplateNode[]} consequent_fn
21-
* @param {null | ((anchor: Node) => import('#client').TemplateNode | import('#client').TemplateNode[])} alternate_fn
20+
* @param {(anchor: Node) => import('#client').Dom} consequent_fn
21+
* @param {null | ((anchor: Node) => import('#client').Dom)} alternate_fn
2222
* @param {boolean} [elseif] True if this is an `{:else if ...}` block rather than an `{#if ...}`, as that affects which transitions are considered 'local'
2323
* @returns {void}
2424
*/
@@ -27,10 +27,10 @@ export function if_block(anchor, get_condition, consequent_fn, alternate_fn, els
2727

2828
hydrate_block_anchor(anchor);
2929

30-
/** @type {undefined | import('#client').TemplateNode | Array<import('#client').TemplateNode>} */
30+
/** @type {undefined | import('#client').Dom} */
3131
let consequent_dom;
3232

33-
/** @type {undefined | import('#client').TemplateNode | Array<import('#client').TemplateNode>} */
33+
/** @type {undefined | import('#client').Dom} */
3434
let alternate_dom;
3535

3636
/** @type {import('#client').Effect | null} */

packages/svelte/src/internal/client/dom/reconciler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function create_fragment_with_script_from_html(html) {
2929
}
3030

3131
/**
32-
* @param {Array<import('../types.js').TemplateNode> | import('../types.js').TemplateNode} current
32+
* @param {import('#client').Dom} current
3333
* @param {Text | Element | Comment} sibling
3434
* @returns {Text | Element | Comment}
3535
*/
@@ -49,7 +49,7 @@ export function insert(current, sibling) {
4949
}
5050

5151
/**
52-
* @param {Array<import('../types.js').TemplateNode> | import('../types.js').TemplateNode} current
52+
* @param {import('#client').Dom} current
5353
*/
5454
export function remove(current) {
5555
if (is_array(current)) {

packages/svelte/src/internal/client/dom/template.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,10 @@ export function comment(anchor) {
178178
* @param {Element | Text} dom
179179
* @param {boolean} is_fragment
180180
* @param {null | Text | Comment | Element} anchor
181-
* @returns {import('#client').TemplateNode | import('#client').TemplateNode[]}
181+
* @returns {import('#client').Dom}
182182
*/
183183
function close_template(dom, is_fragment, anchor) {
184-
/** @type {import('#client').TemplateNode | Array<import('#client').TemplateNode>} */
184+
/** @type {import('#client').Dom} */
185185
var current = is_fragment
186186
? is_array(dom)
187187
? dom

packages/svelte/src/internal/client/types.d.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ export type Equals = (this: Value, value: unknown) => boolean;
4949

5050
export type TemplateNode = Text | Element | Comment;
5151

52+
export type Dom = TemplateNode | TemplateNode[];
53+
5254
export interface Block {
5355
/** dom */
54-
d: null | TemplateNode | Array<TemplateNode>;
56+
d: null | Dom;
5557
}
5658

5759
export type EachState = {
@@ -65,7 +67,7 @@ export type EachItem = {
6567
/** animation manager */
6668
a: AnimationManager | null;
6769
/** dom */
68-
d: null | TemplateNode | Array<TemplateNode>;
70+
d: null | Dom;
6971
/** effect */
7072
e: Effect;
7173
/** item */
@@ -139,15 +141,6 @@ export type StoreReferencesContainer = Record<
139141

140142
export type ActionPayload<P> = { destroy?: () => void; update?: (value: P) => void };
141143

142-
export type Render = {
143-
/** dom */
144-
d: null | TemplateNode | Array<TemplateNode>;
145-
/** effect */
146-
e: null | Effect;
147-
/** prev */
148-
p: Render | null;
149-
};
150-
151144
export type Raf = {
152145
/** Alias for `requestAnimationFrame`, exposed in such a way that we can override in tests */
153146
tick: (callback: (time: DOMHighResTimeStamp) => void) => any;

0 commit comments

Comments
 (0)