From 786cbba7bdd90b6cf2e1453df6f64ca4c8ac2a8d Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Fri, 25 Aug 2023 16:54:56 +0530 Subject: [PATCH] fix(utils): update `isClient` to check `document` too (#3329) Co-authored-by: Anthony Fu --- packages/shared/utils/is.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/shared/utils/is.ts b/packages/shared/utils/is.ts index e9f363a5369..16dde83a626 100644 --- a/packages/shared/utils/is.ts +++ b/packages/shared/utils/is.ts @@ -1,5 +1,5 @@ /* eslint-disable antfu/top-level-function */ -export const isClient = typeof window !== 'undefined' +export const isClient = typeof window !== 'undefined' && typeof document !== 'undefined' export const isDef = (val?: T): val is T => typeof val !== 'undefined' export const notNullish = (val?: T | null | undefined): val is T => val != null export const assert = (condition: boolean, ...infos: any[]) => {