diff --git a/packages/lexical-utils/src/__tests__/unit/LexicalNodeHelpers.test.ts b/packages/lexical-utils/src/__tests__/unit/LexicalNodeHelpers.test.ts index 8740dc14048..b86fdc01ebe 100644 --- a/packages/lexical-utils/src/__tests__/unit/LexicalNodeHelpers.test.ts +++ b/packages/lexical-utils/src/__tests__/unit/LexicalNodeHelpers.test.ts @@ -207,7 +207,7 @@ describe('LexicalNodeHelpers tests', () => { test('DFS of empty ParagraphNode returns only itself', async () => { const editor: LexicalEditor = testEnv.editor; - let paragraphKey; + let paragraphKey: string; await editor.update(() => { const root = $getRoot(); @@ -224,10 +224,10 @@ describe('LexicalNodeHelpers tests', () => { await editor.update(() => { const paragraph = $getNodeByKey(paragraphKey); - expect($dfs(paragraph)).toEqual([ + expect($dfs(paragraph ?? undefined)).toEqual([ { depth: 1, - node: paragraph.getLatest(), + node: paragraph?.getLatest(), }, ]); });