From 709c22578b4a24de187339849e3575e7bdfd98b6 Mon Sep 17 00:00:00 2001
From: Vitaly Turovsky <vital2580@icloud.com>
Date: Sat, 8 Oct 2022 05:18:30 +0300
Subject: [PATCH] fix: fix completion crash by switchCaseExclude

---
 typescript/src/completions/switchCaseExcludeCovered.ts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/typescript/src/completions/switchCaseExcludeCovered.ts b/typescript/src/completions/switchCaseExcludeCovered.ts
index 80997d72..78552ac3 100644
--- a/typescript/src/completions/switchCaseExcludeCovered.ts
+++ b/typescript/src/completions/switchCaseExcludeCovered.ts
@@ -3,6 +3,7 @@ import { cleanupEntryName } from '../utils'
 
 // implementation not even ideal, but it just works for string & enums, which are used in 99% cases
 export default (entries: ts.CompletionEntry[], position: number, sourceFile: ts.SourceFile, leftNode: ts.Node) => {
+    if (!leftNode.parent?.parent) return
     let nodeComp = leftNode
     let enumAccessExpr: string | null | undefined
     if (ts.isStringLiteral(leftNode)) enumAccessExpr = null