From 300f1b289afa24b87739c8b56e100c34dd983ce2 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Tue, 14 May 2019 21:32:10 -0700 Subject: [PATCH] fix(ivy): improve assert error message (#30453) PR Close #30453 --- packages/core/src/render3/assert.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/core/src/render3/assert.ts b/packages/core/src/render3/assert.ts index 8dc9d23802..483b8d2ccd 100644 --- a/packages/core/src/render3/assert.ts +++ b/packages/core/src/render3/assert.ts @@ -36,8 +36,9 @@ export function assertPreviousIsParent(isParent: boolean) { assertEqual(isParent, true, 'previousOrParentTNode should be a parent'); } -export function assertHasParent(tNode: TNode) { - assertDefined(tNode.parent, 'previousOrParentTNode should have a parent'); +export function assertHasParent(tNode: TNode | null) { + assertDefined(tNode, 'previousOrParentTNode should exist!'); + assertDefined(tNode !.parent, 'previousOrParentTNode should have a parent'); } export function assertDataNext(lView: LView, index: number, arr?: any[]) {