diff --git a/packages/core/src/api/apis/definitions/featureFlags.ts b/packages/core/src/api/apis/definitions/featureFlags.ts index dbebec643b..5874bfb052 100644 --- a/packages/core/src/api/apis/definitions/featureFlags.ts +++ b/packages/core/src/api/apis/definitions/featureFlags.ts @@ -28,13 +28,19 @@ import { FeatureFlagName } from '../../plugin/types'; * or unstable upcoming features. Although there will be a common interface for users * to enable and disable feature flags, this API acts as another way to enable/disable. */ + +export enum FeatureFlagState { + NotEnabled = false, + Enabled = true, +} + export type FeatureFlagsApi = { /** * Get the current user's status of a Feature Flag * * @returns bool True if the current user has enabled the feature flag */ - getItem(name: FeatureFlagName): boolean; + getItem(name: FeatureFlagName): FeatureFlagState; /** * Enable an registered feature flag. diff --git a/packages/core/src/api/app/FeatureFlags.tsx b/packages/core/src/api/app/FeatureFlags.tsx index 6459b38f0d..8373e538c2 100644 --- a/packages/core/src/api/app/FeatureFlags.tsx +++ b/packages/core/src/api/app/FeatureFlags.tsx @@ -16,7 +16,10 @@ import React, { ComponentType, createContext, FC } from 'react'; import { FeatureFlagName } from '../plugin/types'; -import { FeatureFlagsApi } from '../apis/definitions/featureFlags'; +import { + FeatureFlagState, + FeatureFlagsApi, +} from '../apis/definitions/featureFlags'; // TODO: figure out where to put implementations of APIs, both inside apps // but also in core/separate package. @@ -55,8 +58,8 @@ class FeatureFlagsImpl implements FeatureFlagsApi { ); } - getItem(name: FeatureFlagName): boolean { - return this.getUserEnabledFeatureFlags().has(name); + getItem(name: FeatureFlagName): FeatureFlagState { + return this.getUserEnabledFeatureFlags().has(name) as FeatureFlagState; } enable(name: FeatureFlagName): void {