From 463dc48ea664c91bf305326a0ef73e3b16d59043 Mon Sep 17 00:00:00 2001 From: Mythie Date: Wed, 30 Aug 2023 17:31:23 +1000 Subject: [PATCH] fix: extract feature-flag zod schema to separate file --- apps/web/src/providers/feature-flag.tsx | 11 +---------- apps/web/src/providers/feature-flag.types.ts | 10 ++++++++++ 2 files changed, 11 insertions(+), 10 deletions(-) create mode 100644 apps/web/src/providers/feature-flag.types.ts diff --git a/apps/web/src/providers/feature-flag.tsx b/apps/web/src/providers/feature-flag.tsx index 58d1bff63..0a09fe0f0 100644 --- a/apps/web/src/providers/feature-flag.tsx +++ b/apps/web/src/providers/feature-flag.tsx @@ -2,8 +2,6 @@ import { createContext, useCallback, useContext, useEffect, useState } from 'react'; -import { z } from 'zod'; - import { FEATURE_FLAG_POLL_INTERVAL, LOCAL_FEATURE_FLAGS, @@ -12,14 +10,7 @@ import { import { getAllFlags } from '~/helpers/get-feature-flag'; -export const ZFeatureFlagValueSchema = z.union([ - z.boolean(), - z.string(), - z.number(), - z.undefined(), -]); - -export type TFeatureFlagValue = z.infer; +import { TFeatureFlagValue } from './feature-flag.types'; export type FeatureFlagContextValue = { getFlag: (_key: string) => TFeatureFlagValue; diff --git a/apps/web/src/providers/feature-flag.types.ts b/apps/web/src/providers/feature-flag.types.ts new file mode 100644 index 000000000..1654a188c --- /dev/null +++ b/apps/web/src/providers/feature-flag.types.ts @@ -0,0 +1,10 @@ +import { z } from 'zod'; + +export const ZFeatureFlagValueSchema = z.union([ + z.boolean(), + z.string(), + z.number(), + z.undefined(), +]); + +export type TFeatureFlagValue = z.infer;