UNPKG

feature-toggle-jsx

Version:

Toggle component on/off based on feature configuration

6 lines (5 loc) 840 B
import * as React from 'react'; import { FeatureConfig } from '../FeaturesContext'; export declare type withoutFeatureHoC<TFeatureConfig extends FeatureConfig> = <TOrigProps extends Record<string, unknown>, TFeatureName extends Extract<keyof TFeatureConfig, string | number>>(Component: React.ComponentType<TOrigProps>, featureName: TFeatureName, isEnabled?: (feature: TFeatureConfig[TFeatureName]) => boolean) => React.FC<TOrigProps>; declare const withoutFeature: <TOrigProps extends Record<string, unknown>, TFeatureConfig extends Record<string, Record<string | number, any>>, TFeatureName extends Extract<keyof TFeatureConfig, string | number>>(Component: React.ComponentType<TOrigProps>, featureName: TFeatureName, isEnabled?: (feature: TFeatureConfig[TFeatureName]) => boolean) => React.FC<TOrigProps>; export default withoutFeature;