From adb78edc10063ac83e8a8f1196acfd2721b4b9c6 Mon Sep 17 00:00:00 2001 From: gwagjiug Date: Sat, 19 Apr 2025 17:28:31 +0900 Subject: [PATCH] fix: move NullSymbol declaration inside createSafeContext function --- packages/src/utils/create-safe-context.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/src/utils/create-safe-context.ts b/packages/src/utils/create-safe-context.ts index d30a18e..ddc2d9a 100644 --- a/packages/src/utils/create-safe-context.ts +++ b/packages/src/utils/create-safe-context.ts @@ -1,12 +1,11 @@ import { type Provider, createContext, useContext } from 'react'; -type NullSymbolType = typeof NullSymbol; -const NullSymbol = Symbol('Null'); - export type CreateContextReturn = [Provider, () => T]; export function createSafeContext(displayName?: string): CreateContextReturn { - const Context = createContext(NullSymbol); + const NullSymbol = Symbol('Null'); + + const Context = createContext(NullSymbol); Context.displayName = displayName ?? 'SafeContext'; function useSafeContext() {