From f535cece08e9edacede83cf74827833e77cd990d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A1=BE=E4=BC=8A=E5=87=A1?= Date: Mon, 27 May 2024 19:14:59 +0800 Subject: [PATCH] fix: use optional chaining to get object values --- src/shared-store.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/shared-store.ts b/src/shared-store.ts index 7878721..9937cd5 100644 --- a/src/shared-store.ts +++ b/src/shared-store.ts @@ -188,9 +188,7 @@ export function displayResult( displayingObjectType = allDisplayingObjects[0].objectType; displayingObject = allDisplayingObjects[0]; if ( - Object.hasOwn(allDisplayingObjects[0], "value") && - Object.hasOwn(allDisplayingObjects[0].value, "localStore") && - allDisplayingObjects[0].value.localStore.__genieObjectType === + allDisplayingObjects[0]?.value?.localStore?.__genieObjectType === "HelperClass" ) { displayingObjectType = "undefined"; @@ -200,9 +198,7 @@ export function displayResult( displayingObjectType = allDisplayingObjects[0].objectType + "[]"; displayingObject = allDisplayingObjects; if ( - Object.hasOwn(allDisplayingObjects[0], "value") && - Object.hasOwn(allDisplayingObjects[0].value, "localStore") && - allDisplayingObjects[0].value.localStore.__genieObjectType === + allDisplayingObjects[0]?.value?.localStore?.__genieObjectType === "HelperClass" ) { displayingObjectType = "undefined";