@@ -83,36 +83,34 @@ export function create_text(value = '') {
8383/**
8484 * @template {Node} N
8585 * @param {N } node
86- * @returns {Node | null }
8786 */
8887/*@__NO_SIDE_EFFECTS__ */
8988export function get_first_child ( node ) {
90- return first_child_getter . call ( node ) ;
89+ return /** @type { TemplateNode | null } */ ( first_child_getter . call ( node ) ) ;
9190}
9291
9392/**
9493 * @template {Node} N
9594 * @param {N } node
96- * @returns {Node | null }
9795 */
9896/*@__NO_SIDE_EFFECTS__ */
9997export function get_next_sibling ( node ) {
100- return next_sibling_getter . call ( node ) ;
98+ return /** @type { TemplateNode | null } */ ( next_sibling_getter . call ( node ) ) ;
10199}
102100
103101/**
104102 * Don't mark this as side-effect-free, hydration needs to walk all nodes
105103 * @template {Node} N
106104 * @param {N } node
107105 * @param {boolean } is_text
108- * @returns {Node | null }
106+ * @returns {TemplateNode | null }
109107 */
110108export function child ( node , is_text ) {
111109 if ( ! hydrating ) {
112110 return get_first_child ( node ) ;
113111 }
114112
115- var child = /** @type { TemplateNode } */ ( get_first_child ( hydrate_node ) ) ;
113+ var child = get_first_child ( hydrate_node ) ;
116114
117115 // Child can be null if we have an element with a single child, like `<p>{text}</p>`, where `text` is empty
118116 if ( child === null ) {
@@ -130,14 +128,13 @@ export function child(node, is_text) {
130128
131129/**
132130 * Don't mark this as side-effect-free, hydration needs to walk all nodes
133- * @param {DocumentFragment | TemplateNode | TemplateNode[] } fragment
131+ * @param {TemplateNode } node
134132 * @param {boolean } [is_text]
135- * @returns {Node | null }
133+ * @returns {TemplateNode | null }
136134 */
137- export function first_child ( fragment , is_text = false ) {
135+ export function first_child ( node , is_text = false ) {
138136 if ( ! hydrating ) {
139- // when not hydrating, `fragment` is a `DocumentFragment` (the result of calling `open_frag`)
140- var first = /** @type {DocumentFragment } */ ( get_first_child ( /** @type {Node } */ ( fragment ) ) ) ;
137+ var first = get_first_child ( node ) ;
141138
142139 // TODO prevent user comments with the empty string when preserveComments is true
143140 if ( first instanceof Comment && first . data === '' ) return get_next_sibling ( first ) ;
@@ -163,7 +160,7 @@ export function first_child(fragment, is_text = false) {
163160 * @param {TemplateNode } node
164161 * @param {number } count
165162 * @param {boolean } is_text
166- * @returns {Node | null }
163+ * @returns {TemplateNode | null }
167164 */
168165export function sibling ( node , count = 1 , is_text = false ) {
169166 let next_sibling = hydrating ? hydrate_node : node ;
@@ -195,7 +192,7 @@ export function sibling(node, count = 1, is_text = false) {
195192 }
196193
197194 set_hydrate_node ( next_sibling ) ;
198- return /** @type { TemplateNode } */ ( next_sibling ) ;
195+ return next_sibling ;
199196}
200197
201198/**
0 commit comments