fix: extract feature-flag zod schema to separate file

This commit is contained in:
Mythie
2023-08-30 17:31:23 +10:00
parent d8f6a25059
commit 463dc48ea6
2 changed files with 11 additions and 10 deletions

View File

@ -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<typeof ZFeatureFlagValueSchema>;
import { TFeatureFlagValue } from './feature-flag.types';
export type FeatureFlagContextValue = {
getFlag: (_key: string) => TFeatureFlagValue;

View File

@ -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<typeof ZFeatureFlagValueSchema>;