From 08ff0ee8e2457e84a31011b2983ba3c36ba0306e Mon Sep 17 00:00:00 2001 From: p-sw Date: Tue, 4 Jun 2024 22:57:47 +0900 Subject: [PATCH] fix: use falsy check instead of typeof --- packages/react/src/components/LoadedCode.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react/src/components/LoadedCode.tsx b/packages/react/src/components/LoadedCode.tsx index 29b4e0d..002cce6 100644 --- a/packages/react/src/components/LoadedCode.tsx +++ b/packages/react/src/components/LoadedCode.tsx @@ -32,8 +32,8 @@ export const LoadedCode = ({ size="icon" className="absolute top-4 right-4 text-black dark:text-white z-10" onClick={() => { - if (typeof state === "string" && state.length > 0) { - navigator.clipboard.writeText(state ?? ""); + if (state && state.length > 0) { + void navigator.clipboard.writeText(state ?? ""); toast({ title: "Copied", description: "The code has been copied to your clipboard.",