Skip to content

Commit f597797

Browse files
authored
refactor(Suspense): remove unnecessary casts (#819)
1 parent 16a737d commit f597797

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

packages/runtime-core/src/componentRenderUtils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ function hasPropsChanged(prevProps: Data, nextProps: Data): boolean {
260260

261261
export function updateHOCHostEl(
262262
{ vnode, parent }: ComponentInternalInstance,
263-
el: object // HostNode
263+
el: typeof vnode.el // HostNode
264264
) {
265265
while (parent && parent.subTree === vnode) {
266266
;(vnode = parent.vnode).el = el

packages/runtime-core/src/components/Suspense.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ function createSuspenseBoundary<HostNode, HostElement>(
255255
hiddenContainer,
256256
anchor,
257257
deps: 0,
258-
subTree: null as any, // will be set immediately after creation
259-
fallbackTree: null as any, // will be set immediately after creation
258+
subTree: (null as unknown) as VNode, // will be set immediately after creation
259+
fallbackTree: (null as unknown) as VNode, // will be set immediately after creation
260260
isResolved: false,
261261
isUnmounted: false,
262262
effects: [],
@@ -290,11 +290,11 @@ function createSuspenseBoundary<HostNode, HostElement>(
290290
// if the fallback tree was mounted, it may have been moved
291291
// as part of a parent suspense. get the latest anchor for insertion
292292
anchor = next(fallbackTree)
293-
unmount(fallbackTree as VNode, parentComponent, suspense, true)
293+
unmount(fallbackTree, parentComponent, suspense, true)
294294
}
295295
// move content from off-dom container to actual container
296-
move(subTree as VNode, container, anchor, MoveType.ENTER)
297-
const el = (vnode.el = (subTree as VNode).el!)
296+
move(subTree, container, anchor, MoveType.ENTER)
297+
const el = (vnode.el = subTree.el!)
298298
// suspense as the root node of a component...
299299
if (parentComponent && parentComponent.subTree === vnode) {
300300
parentComponent.vnode.el = el
@@ -340,7 +340,7 @@ function createSuspenseBoundary<HostNode, HostElement>(
340340

341341
// move content tree back to the off-dom container
342342
const anchor = next(subTree)
343-
move(subTree as VNode, hiddenContainer, null, MoveType.LEAVE)
343+
move(subTree, hiddenContainer, null, MoveType.LEAVE)
344344
// remount the fallback tree
345345
patch(
346346
null,
@@ -352,7 +352,7 @@ function createSuspenseBoundary<HostNode, HostElement>(
352352
isSVG,
353353
optimized
354354
)
355-
const el = (vnode.el = (fallbackTree as VNode).el!)
355+
const el = (vnode.el = fallbackTree.el!)
356356
// suspense as the root node of a component...
357357
if (parentComponent && parentComponent.subTree === vnode) {
358358
parentComponent.vnode.el = el

0 commit comments

Comments
 (0)